Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions aws/logs_monitoring/enhanced_lambda_metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
logger.setLevel(logging.getLevelName(os.environ.get("DD_LOG_LEVEL", "INFO").upper()))

try:
from datadog_lambda.metric import lambda_stats
from datadog_lambda.metric import lambda_metric

DD_SUBMIT_ENHANCED_METRICS = True
except ImportError:
Expand Down Expand Up @@ -136,9 +136,7 @@ def submit_to_dd(self):
logger.debug(
"Submitting metric {} {} {}".format(self.name, self.value, self.tags)
)
lambda_stats.distribution(
self.name, self.value, timestamp=timestamp, tags=self.tags
)
lambda_metric(self.name, self.value, timestamp=timestamp, tags=self.tags)


def get_last_modified_time(s3_file):
Expand Down
2 changes: 1 addition & 1 deletion aws/logs_monitoring/forwarder.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ def _forward_logs(self, logs, key=None):
def _forward_metrics(self, metrics, key=None):
"""
Forward custom metrics submitted via logs to Datadog in a background thread
using `lambda_stats` that is provided by the Datadog Python Lambda Layer.
using `lambda_metric` that is provided by the Datadog Python Lambda Layer.
"""
if logger.isEnabledFor(logging.DEBUG):
logger.debug(f"Forwarding {len(metrics)} metrics")
Expand Down
7 changes: 5 additions & 2 deletions aws/logs_monitoring/template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -292,11 +292,14 @@ Parameters:
- CRITICAL
DdTraceEnabled:
Type: String
Default: "true"
Default: "false"
AllowedValues:
- "true"
- "false"
Description: Set to false to disable trace creation and forwarding for the forwarder itself. Enabling this may incur additional Serverless APM charges. See https://docs.datadoghq.com/tracing/trace_collection/library_config/python/#traces
Description: |
Set to true to enable trace creation for the forwarder itself.
Lambda forwarder should be instrumented to forward these traces to Datadog, see https://docs.datadoghq.com/serverless/aws_lambda/.
Enabling this may incur additional Serverless APM charges. See https://docs.datadoghq.com/tracing/trace_collection/library_config/python/#traces.
DdEnhancedMetrics:
Type: String
Default: "false"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
version: "3.8"

services:
recorder:
image: ${PYTHON_BASE}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ SNAPSHOT_DIR="${INTEGRATION_TESTS_DIR}/${SNAPSHOTS_DIR_NAME}/*"
SNAPS=($SNAPSHOT_DIR)
ADDITIONAL_LAMBDA=false
CACHE_TEST=false
DD_FETCH_LAMBDA_TAGS="true"
DD_FETCH_LOG_GROUP_TAGS="true"
DD_FETCH_STEP_FUNCTIONS_TAGS="true"
DD_STORE_FAILED_EVENTS="true"
DD_FETCH_LAMBDA_TAGS="false"
DD_FETCH_LOG_GROUP_TAGS="false"
DD_FETCH_STEP_FUNCTIONS_TAGS="false"
DD_STORE_FAILED_EVENTS="false"

script_start_time=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
echo "Starting script time: $script_start_time"
Expand Down Expand Up @@ -85,6 +85,8 @@ if [ $CACHE_TEST == true ]; then

SNAPSHOTS_DIR_NAME="snapshots-cache-test"
DD_FETCH_LAMBDA_TAGS="true"
DD_FETCH_LOG_GROUP_TAGS="true"
DD_FETCH_STEP_FUNCTIONS_TAGS="true"

# Deploy test lambda function with tags
AWS_LAMBDA_FUNCTION_INVOKED="cache_test_lambda"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,51 +91,6 @@
{
"data": {
"series": [
{
"device": null,
"host": null,
"interval": 10,
"metric": "aws.dd_forwarder.loggroup_cache_fetch_failure",
"points": "<redacted from snapshot>",
"tags": [
"forwardername:test_function",
"forwarder_memorysize:3008",
"forwarder_version:<redacted from snapshot>",
"event_type:awslogs",
"dd_lambda_layer:datadog-python313_8.120.0"
],
"type": "distribution"
},
{
"device": null,
"host": null,
"interval": 10,
"metric": "aws.dd_forwarder.list_tags_log_group_api_call",
"points": "<redacted from snapshot>",
"tags": [
"forwardername:test_function",
"forwarder_memorysize:3008",
"forwarder_version:<redacted from snapshot>",
"event_type:awslogs",
"dd_lambda_layer:datadog-python313_8.120.0"
],
"type": "distribution"
},
{
"device": null,
"host": null,
"interval": 10,
"metric": "aws.dd_forwarder.loggroup_cache_write_failure",
"points": "<redacted from snapshot>",
"tags": [
"forwardername:test_function",
"forwarder_memorysize:3008",
"forwarder_version:<redacted from snapshot>",
"event_type:awslogs",
"dd_lambda_layer:datadog-python313_8.120.0"
],
"type": "distribution"
},
{
"device": null,
"host": null,
Expand All @@ -147,7 +102,7 @@
"forwarder_memorysize:3008",
"forwarder_version:<redacted from snapshot>",
"event_type:awslogs",
"dd_lambda_layer:datadog-python313_8.120.0"
"dd_lambda_layer:<redacted from snapshot>"
],
"type": "distribution"
},
Expand All @@ -162,7 +117,7 @@
"forwarder_memorysize:3008",
"forwarder_version:<redacted from snapshot>",
"event_type:awslogs",
"dd_lambda_layer:datadog-python313_8.120.0"
"dd_lambda_layer:<redacted from snapshot>"
],
"type": "distribution"
},
Expand All @@ -177,7 +132,7 @@
"forwarder_memorysize:3008",
"forwarder_version:<redacted from snapshot>",
"event_type:awslogs",
"dd_lambda_layer:datadog-python313_8.120.0"
"dd_lambda_layer:<redacted from snapshot>"
],
"type": "distribution"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,51 +64,6 @@
{
"data": {
"series": [
{
"device": null,
"host": null,
"interval": 10,
"metric": "aws.dd_forwarder.loggroup_cache_fetch_failure",
"points": "<redacted from snapshot>",
"tags": [
"forwardername:test_function",
"forwarder_memorysize:3008",
"forwarder_version:<redacted from snapshot>",
"event_type:awslogs",
"dd_lambda_layer:datadog-python313_8.120.0"
],
"type": "distribution"
},
{
"device": null,
"host": null,
"interval": 10,
"metric": "aws.dd_forwarder.list_tags_log_group_api_call",
"points": "<redacted from snapshot>",
"tags": [
"forwardername:test_function",
"forwarder_memorysize:3008",
"forwarder_version:<redacted from snapshot>",
"event_type:awslogs",
"dd_lambda_layer:datadog-python313_8.120.0"
],
"type": "distribution"
},
{
"device": null,
"host": null,
"interval": 10,
"metric": "aws.dd_forwarder.loggroup_cache_write_failure",
"points": "<redacted from snapshot>",
"tags": [
"forwardername:test_function",
"forwarder_memorysize:3008",
"forwarder_version:<redacted from snapshot>",
"event_type:awslogs",
"dd_lambda_layer:datadog-python313_8.120.0"
],
"type": "distribution"
},
{
"device": null,
"host": null,
Expand All @@ -120,7 +75,7 @@
"forwarder_memorysize:3008",
"forwarder_version:<redacted from snapshot>",
"event_type:awslogs",
"dd_lambda_layer:datadog-python313_8.120.0"
"dd_lambda_layer:<redacted from snapshot>"
],
"type": "distribution"
},
Expand All @@ -135,7 +90,7 @@
"forwarder_memorysize:3008",
"forwarder_version:<redacted from snapshot>",
"event_type:awslogs",
"dd_lambda_layer:datadog-python313_8.120.0"
"dd_lambda_layer:<redacted from snapshot>"
],
"type": "distribution"
},
Expand All @@ -150,7 +105,7 @@
"forwarder_memorysize:3008",
"forwarder_version:<redacted from snapshot>",
"event_type:awslogs",
"dd_lambda_layer:datadog-python313_8.120.0"
"dd_lambda_layer:<redacted from snapshot>"
],
"type": "distribution"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,51 +100,6 @@
{
"data": {
"series": [
{
"device": null,
"host": null,
"interval": 10,
"metric": "aws.dd_forwarder.loggroup_cache_fetch_failure",
"points": "<redacted from snapshot>",
"tags": [
"forwardername:test_function",
"forwarder_memorysize:3008",
"forwarder_version:<redacted from snapshot>",
"event_type:awslogs",
"dd_lambda_layer:datadog-python313_8.120.0"
],
"type": "distribution"
},
{
"device": null,
"host": null,
"interval": 10,
"metric": "aws.dd_forwarder.list_tags_log_group_api_call",
"points": "<redacted from snapshot>",
"tags": [
"forwardername:test_function",
"forwarder_memorysize:3008",
"forwarder_version:<redacted from snapshot>",
"event_type:awslogs",
"dd_lambda_layer:datadog-python313_8.120.0"
],
"type": "distribution"
},
{
"device": null,
"host": null,
"interval": 10,
"metric": "aws.dd_forwarder.loggroup_cache_write_failure",
"points": "<redacted from snapshot>",
"tags": [
"forwardername:test_function",
"forwarder_memorysize:3008",
"forwarder_version:<redacted from snapshot>",
"event_type:awslogs",
"dd_lambda_layer:datadog-python313_8.120.0"
],
"type": "distribution"
},
{
"device": null,
"host": null,
Expand All @@ -156,7 +111,7 @@
"forwarder_memorysize:3008",
"forwarder_version:<redacted from snapshot>",
"event_type:awslogs",
"dd_lambda_layer:datadog-python313_8.120.0"
"dd_lambda_layer:<redacted from snapshot>"
],
"type": "distribution"
},
Expand All @@ -171,7 +126,7 @@
"forwarder_memorysize:3008",
"forwarder_version:<redacted from snapshot>",
"event_type:awslogs",
"dd_lambda_layer:datadog-python313_8.120.0"
"dd_lambda_layer:<redacted from snapshot>"
],
"type": "distribution"
},
Expand All @@ -186,7 +141,7 @@
"forwarder_memorysize:3008",
"forwarder_version:<redacted from snapshot>",
"event_type:awslogs",
"dd_lambda_layer:datadog-python313_8.120.0"
"dd_lambda_layer:<redacted from snapshot>"
],
"type": "distribution"
}
Expand Down
Loading
Loading