Skip to content

Commit e786239

Browse files
committed
Rename env variable to DD_FLUSH_TO_LOG.
1 parent 9186c49 commit e786239

File tree

5 files changed

+8
-8
lines changed

5 files changed

+8
-8
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ Set the following Datadog environment variable to `datadoghq.eu` to send your da
2222

2323
If your Lambda function powers a performance-critical task (e.g., a consumer-facing API). You can avoid the added latencies of metric-submitting API calls, by setting the following Datadog environment variable to `True`. Custom metrics will be submitted asynchronously through CloudWatch Logs and [the Datadog log forwarder](https://github.com/DataDog/datadog-serverless-functions/tree/master/aws/logs_monitoring).
2424

25-
* DATADOG_FLUSH_TO_LOG
25+
* DD_FLUSH_TO_LOG
2626

2727
### The Serverless Framework
2828

datadog_lambda/metric.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ def lambda_metric(metric_name, value, timestamp=None, tags=None):
4242
Submit a data point to Datadog distribution metrics.
4343
https://docs.datadoghq.com/graphing/metrics/distributions/
4444
45-
When DATADOG_LOG_FORWARDER is True, write metric to log, and
45+
When DD_FLUSH_TO_LOG is True, write metric to log, and
4646
wait for the Datadog Log Forwarder Lambda function to submit
4747
the metrics asynchronously.
4848
@@ -51,7 +51,7 @@ def lambda_metric(metric_name, value, timestamp=None, tags=None):
5151
background thread.
5252
"""
5353
tags = _tag_dd_lambda_layer(tags)
54-
if os.environ.get('DATADOG_FLUSH_TO_LOG') == 'True':
54+
if os.environ.get('DD_FLUSH_TO_LOG').lower() == 'true':
5555
print(json.dumps({
5656
'm': metric_name,
5757
'v': value,

datadog_lambda/wrapper.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class _LambdaDecorator(object):
3333

3434
def __init__(self, func):
3535
self.func = func
36-
self.flush_to_log = os.environ.get('DATADOG_FLUSH_TO_LOG') == 'True'
36+
self.flush_to_log = os.environ.get('DD_FLUSH_TO_LOG').lower() == 'True'
3737

3838
def _before(self, event, context):
3939
try:

tests/test_metric.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ def test_lambda_metric_tagged_with_dd_lambda_layer(self):
3030
])
3131

3232
def test_lambda_metric_flush_to_log(self):
33-
os.environ["DATADOG_FLUSH_TO_LOG"] = 'True'
33+
os.environ["DD_FLUSH_TO_LOG"] = 'True'
3434

3535
lambda_metric('test', 1)
3636
self.mock_metric_lambda_stats.distribution.assert_not_called()
3737

38-
del os.environ["DATADOG_FLUSH_TO_LOG"]
38+
del os.environ["DD_FLUSH_TO_LOG"]

tests/test_wrapper.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def lambda_handler(event, context):
4545
self.mock_patch_all.assert_called()
4646

4747
def test_datadog_lambda_wrapper_flush_to_log(self):
48-
os.environ["DATADOG_FLUSH_TO_LOG"] = 'True'
48+
os.environ["DD_FLUSH_TO_LOG"] = 'True'
4949

5050
@datadog_lambda_wrapper
5151
def lambda_handler(event, context):
@@ -60,4 +60,4 @@ def lambda_handler(event, context):
6060
self.mock_extract_dd_trace_context.assert_called_with(lambda_event)
6161
self.mock_patch_all.assert_called()
6262

63-
del os.environ["DATADOG_FLUSH_TO_LOG"]
63+
del os.environ["DD_FLUSH_TO_LOG"]

0 commit comments

Comments
 (0)