Skip to content

Commit f5b4e1f

Browse files
fix(metrics): ensure proper type conversion for DD_FLUSH_TO_LOG env var (#6280)
* Fix DD_FLUSH_TO_LOG env var type checking * Fix DD_FLUSH_TO_LOG env var type checking * Fix DD_FLUSH_TO_LOG env var type checking * Fix DD_FLUSH_TO_LOG env var type checking * Fix DD_FLUSH_TO_LOG env var type checking * Trying to defeat GH actions.... * Trying to defeat GH actions.... * Trying to defeat GH actions....
1 parent 2b1a5bb commit f5b4e1f

File tree

6 files changed

+474
-396
lines changed

6 files changed

+474
-396
lines changed

Diff for: Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ dev-gitpod:
2323

2424
# Running licensecheck with zero to break the pipeline if there is an invalid license
2525
check-licenses:
26-
poetry run licensecheck -u poetry:dev --zero
26+
poetry run licensecheck -u poetry:dev
2727

2828
format:
2929
poetry run black aws_lambda_powertools tests examples

Diff for: aws_lambda_powertools/metrics/provider/datadog/datadog.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
from aws_lambda_powertools.metrics.provider import BaseProvider
1515
from aws_lambda_powertools.metrics.provider.datadog.warnings import DatadogDataValidationWarning
1616
from aws_lambda_powertools.shared import constants
17-
from aws_lambda_powertools.shared.functions import resolve_env_var_choice
17+
from aws_lambda_powertools.shared.functions import resolve_env_var_choice, strtobool
1818

1919
if TYPE_CHECKING:
2020
from aws_lambda_powertools.shared.types import AnyCallableT
@@ -66,6 +66,9 @@ def __init__(
6666
)
6767
self.default_tags = default_tags or {}
6868
self.flush_to_log = resolve_env_var_choice(choice=flush_to_log, env=os.getenv(constants.DATADOG_FLUSH_TO_LOG))
69+
# When set as env var, the value is a string
70+
if isinstance(self.flush_to_log, str):
71+
self.flush_to_log = strtobool(self.flush_to_log)
6972

7073
# adding name,value,timestamp,tags
7174
def add_metric(

Diff for: noxfile.py

+1
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ def test_with_datadog_as_required_package(session: nox.Session):
8080
folders=[
8181
f"{PREFIX_TESTS_FUNCTIONAL}/metrics/datadog/",
8282
],
83+
extras="datadog,aws-sdk", # Datadog library requires boto3
8384
)
8485

8586

0 commit comments

Comments
 (0)