datadog_lambda 8.114.0__py3-none-any.whl → 8.116.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- datadog_lambda/asm.py +2 -2
- datadog_lambda/metric.py +27 -0
- datadog_lambda/tracing.py +18 -0
- datadog_lambda/trigger.py +2 -1
- datadog_lambda/version.py +1 -1
- datadog_lambda/wrapper.py +14 -2
- {datadog_lambda-8.114.0.dist-info → datadog_lambda-8.116.0.dist-info}/METADATA +2 -2
- {datadog_lambda-8.114.0.dist-info → datadog_lambda-8.116.0.dist-info}/RECORD +12 -12
- {datadog_lambda-8.114.0.dist-info → datadog_lambda-8.116.0.dist-info}/LICENSE +0 -0
- {datadog_lambda-8.114.0.dist-info → datadog_lambda-8.116.0.dist-info}/LICENSE-3rdparty.csv +0 -0
- {datadog_lambda-8.114.0.dist-info → datadog_lambda-8.116.0.dist-info}/NOTICE +0 -0
- {datadog_lambda-8.114.0.dist-info → datadog_lambda-8.116.0.dist-info}/WHEEL +0 -0
datadog_lambda/asm.py
CHANGED
|
@@ -126,8 +126,8 @@ def asm_start_request(
|
|
|
126
126
|
|
|
127
127
|
request_ip = _get_request_header_client_ip(request_headers, peer_ip, True)
|
|
128
128
|
if request_ip is not None:
|
|
129
|
-
span.
|
|
130
|
-
span.
|
|
129
|
+
span.set_tag("http.client_ip", request_ip)
|
|
130
|
+
span.set_tag("network.client.ip", request_ip)
|
|
131
131
|
|
|
132
132
|
# Encode the parsed query and append it to reconstruct the original raw URI expected by AppSec.
|
|
133
133
|
if parsed_query:
|
datadog_lambda/metric.py
CHANGED
|
@@ -214,6 +214,33 @@ def submit_errors_metric(lambda_context):
|
|
|
214
214
|
submit_enhanced_metric("errors", lambda_context)
|
|
215
215
|
|
|
216
216
|
|
|
217
|
+
def submit_batch_item_failures_metric(response, lambda_context):
|
|
218
|
+
"""Submit aws.lambda.enhanced.batch_item_failures metric with the count of batch item failures
|
|
219
|
+
|
|
220
|
+
Args:
|
|
221
|
+
response (dict): Lambda function response object
|
|
222
|
+
lambda_context (object): Lambda context dict passed to the function by AWS
|
|
223
|
+
"""
|
|
224
|
+
if not config.enhanced_metrics_enabled:
|
|
225
|
+
logger.debug(
|
|
226
|
+
"Not submitting batch_item_failures metric because enhanced metrics are disabled"
|
|
227
|
+
)
|
|
228
|
+
return
|
|
229
|
+
|
|
230
|
+
if not isinstance(response, dict):
|
|
231
|
+
return
|
|
232
|
+
|
|
233
|
+
batch_item_failures = response.get("batchItemFailures")
|
|
234
|
+
if batch_item_failures is not None and isinstance(batch_item_failures, list):
|
|
235
|
+
lambda_metric(
|
|
236
|
+
"aws.lambda.enhanced.batch_item_failures",
|
|
237
|
+
len(batch_item_failures),
|
|
238
|
+
timestamp=None,
|
|
239
|
+
tags=get_enhanced_metrics_tags(lambda_context),
|
|
240
|
+
force_async=True,
|
|
241
|
+
)
|
|
242
|
+
|
|
243
|
+
|
|
217
244
|
def submit_dynamodb_stream_type_metric(event):
|
|
218
245
|
stream_view_type = (
|
|
219
246
|
event.get("Records", [{}])[0].get("dynamodb", {}).get("StreamViewType")
|
datadog_lambda/tracing.py
CHANGED
|
@@ -209,6 +209,20 @@ def extract_context_from_http_event_or_context(
|
|
|
209
209
|
return context
|
|
210
210
|
|
|
211
211
|
|
|
212
|
+
def extract_context_from_request_header_or_context(event, lambda_context, event_source):
|
|
213
|
+
request = event.get("request")
|
|
214
|
+
if isinstance(request, (set, dict)) and "headers" in request:
|
|
215
|
+
context = extract_context_from_http_event_or_context(
|
|
216
|
+
request,
|
|
217
|
+
lambda_context,
|
|
218
|
+
event_source,
|
|
219
|
+
decode_authorizer_context=False,
|
|
220
|
+
)
|
|
221
|
+
else:
|
|
222
|
+
context = extract_context_from_lambda_context(lambda_context)
|
|
223
|
+
return context
|
|
224
|
+
|
|
225
|
+
|
|
212
226
|
def create_sns_event(message):
|
|
213
227
|
return {
|
|
214
228
|
"Records": [
|
|
@@ -627,6 +641,10 @@ def extract_dd_trace_context(
|
|
|
627
641
|
|
|
628
642
|
if extractor is not None:
|
|
629
643
|
context = extract_context_custom_extractor(extractor, event, lambda_context)
|
|
644
|
+
elif isinstance(event, (set, dict)) and "request" in event:
|
|
645
|
+
context = extract_context_from_request_header_or_context(
|
|
646
|
+
event, lambda_context, event_source
|
|
647
|
+
)
|
|
630
648
|
elif isinstance(event, (set, dict)) and "headers" in event:
|
|
631
649
|
context = extract_context_from_http_event_or_context(
|
|
632
650
|
event, lambda_context, event_source, decode_authorizer_context
|
datadog_lambda/trigger.py
CHANGED
|
@@ -325,7 +325,8 @@ def extract_http_tags(event):
|
|
|
325
325
|
method = apigateway_v2_http.get("method")
|
|
326
326
|
|
|
327
327
|
if path:
|
|
328
|
-
http_tags
|
|
328
|
+
if http_tags.get("http.url"):
|
|
329
|
+
http_tags["http.url"] += path
|
|
329
330
|
if method:
|
|
330
331
|
http_tags["http.method"] = method
|
|
331
332
|
|
datadog_lambda/version.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
__version__ = "8.
|
|
1
|
+
__version__ = "8.116.0"
|
datadog_lambda/wrapper.py
CHANGED
|
@@ -46,6 +46,10 @@ from datadog_lambda.trigger import (
|
|
|
46
46
|
extract_http_status_code_tag,
|
|
47
47
|
)
|
|
48
48
|
|
|
49
|
+
# ddtrace imports are also tested in
|
|
50
|
+
# dd-trace-py/tests/internal/test_serverless.py please update those tests when
|
|
51
|
+
# making changes to any ddtrace import.
|
|
52
|
+
|
|
49
53
|
if config.appsec_enabled:
|
|
50
54
|
from datadog_lambda.asm import (
|
|
51
55
|
asm_set_context,
|
|
@@ -65,7 +69,11 @@ if config.llmobs_enabled:
|
|
|
65
69
|
|
|
66
70
|
if config.exception_replay_enabled:
|
|
67
71
|
from ddtrace.debugging._exception.replay import SpanExceptionHandler
|
|
68
|
-
|
|
72
|
+
|
|
73
|
+
try:
|
|
74
|
+
from ddtrace.debugging._uploader import SignalUploader
|
|
75
|
+
except ImportError:
|
|
76
|
+
from ddtrace.debugging._uploader import LogsIntakeUploaderV1 as SignalUploader
|
|
69
77
|
|
|
70
78
|
logger = logging.getLogger(__name__)
|
|
71
79
|
|
|
@@ -283,6 +291,10 @@ class _LambdaDecorator(object):
|
|
|
283
291
|
|
|
284
292
|
def _after(self, event, context):
|
|
285
293
|
try:
|
|
294
|
+
from datadog_lambda.metric import submit_batch_item_failures_metric
|
|
295
|
+
|
|
296
|
+
submit_batch_item_failures_metric(self.response, context)
|
|
297
|
+
|
|
286
298
|
status_code = extract_http_status_code_tag(self.trigger_tags, self.response)
|
|
287
299
|
|
|
288
300
|
if self.span:
|
|
@@ -370,7 +382,7 @@ class _LambdaDecorator(object):
|
|
|
370
382
|
|
|
371
383
|
# Flush exception replay
|
|
372
384
|
if config.exception_replay_enabled:
|
|
373
|
-
|
|
385
|
+
SignalUploader._instance.periodic()
|
|
374
386
|
|
|
375
387
|
if config.encode_authorizer_context and is_authorizer_response(
|
|
376
388
|
self.response
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: datadog_lambda
|
|
3
|
-
Version: 8.
|
|
3
|
+
Version: 8.116.0
|
|
4
4
|
Summary: The Datadog AWS Lambda Library
|
|
5
5
|
Home-page: https://github.com/DataDog/datadog-lambda-python
|
|
6
6
|
License: Apache-2.0
|
|
@@ -19,7 +19,7 @@ Classifier: Programming Language :: Python :: 3.13
|
|
|
19
19
|
Provides-Extra: dev
|
|
20
20
|
Requires-Dist: botocore (>=1.34.0,<2.0.0) ; extra == "dev"
|
|
21
21
|
Requires-Dist: datadog (>=0.51.0,<1.0.0)
|
|
22
|
-
Requires-Dist: ddtrace (>=3.
|
|
22
|
+
Requires-Dist: ddtrace (>=3.16.2,<4)
|
|
23
23
|
Requires-Dist: flake8 (>=5.0.4,<6.0.0) ; extra == "dev"
|
|
24
24
|
Requires-Dist: pytest (>=8.0.0,<9.0.0) ; extra == "dev"
|
|
25
25
|
Requires-Dist: pytest-benchmark (>=4.0,<5.0) ; extra == "dev"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
datadog_lambda/__init__.py,sha256=rAQyhhjO-TzPu3_EtL111hr03gdeeQRmm1Zsz2dKKTw,816
|
|
2
2
|
datadog_lambda/api.py,sha256=FqQ9vjNSxD5BxjeHDDKbim_NIN08dshW-52wNzqw5yo,5249
|
|
3
|
-
datadog_lambda/asm.py,sha256=
|
|
3
|
+
datadog_lambda/asm.py,sha256=ZOX_rElpGF5uX-r-SoPnjFAv0vSd1y7YYfwz5m38xpc,8167
|
|
4
4
|
datadog_lambda/cold_start.py,sha256=NfE4EtRUHuc2ub26U8sAwMVEDNINbw1OTh2MAklQGyk,8032
|
|
5
5
|
datadog_lambda/config.py,sha256=QoEZrSL_zSHY5lV9RznAwPONEZe0i3mCWp2jPoO8aEw,5260
|
|
6
6
|
datadog_lambda/constants.py,sha256=0y6O9s_8RLflYR507SDMQjKmYY16tr1yi2KQuuF1GaY,1696
|
|
@@ -8,7 +8,7 @@ datadog_lambda/dogstatsd.py,sha256=-2HiU3xvV_beXh8rI9oIXxSUmVcamI0KqAl7gc9LkYA,5
|
|
|
8
8
|
datadog_lambda/extension.py,sha256=ZU64QpA2K9K9C0jfqusBgpiWQe0QA2dcJCNk7UgjVfw,621
|
|
9
9
|
datadog_lambda/handler.py,sha256=VhdNUb_lpPRJ73h-fdDxxqSm0Ic_lkt4x_9Rt0amVV4,1312
|
|
10
10
|
datadog_lambda/logger.py,sha256=nGxNMouF7wcjmoPsgivzzjNLvSy3WbGtKElxOvITZDg,766
|
|
11
|
-
datadog_lambda/metric.py,sha256=
|
|
11
|
+
datadog_lambda/metric.py,sha256=vRg0E9-nn4aXhzgu08NC58AnTBKm2anvdvHoDzyllOQ,8636
|
|
12
12
|
datadog_lambda/module_name.py,sha256=5FmOCjjgjq78b6a83QePZZFmqahAoy9XHdUNWdq2D1Q,139
|
|
13
13
|
datadog_lambda/patch.py,sha256=veoZyepRCY2OlH2m_TJ9mRC-weDuzMZD6BkipHC3n3U,4639
|
|
14
14
|
datadog_lambda/span_pointers.py,sha256=le8dcZqyrWHf6I1ELZ4Ym3Xd4QNUuE5PoBctuYw5Ij0,6245
|
|
@@ -17,14 +17,14 @@ datadog_lambda/statsd_writer.py,sha256=wUNG8phIreNOGCc5VjYZV-FNogvKfiz9kN33QldqZ
|
|
|
17
17
|
datadog_lambda/tag_object.py,sha256=NNvMVi07kNYRBMPpB7Lk7_-z5ccmxo2UmTWnvWVPhiM,2089
|
|
18
18
|
datadog_lambda/tags.py,sha256=wy6uH8eAGMn7cfZEdHpL9uEGoM85bVyyXhYwSQtfHHc,2532
|
|
19
19
|
datadog_lambda/thread_stats_writer.py,sha256=VfD6G65zNHDA0nABhGOO0it7yqvn-p6ereQ329DA7r8,2894
|
|
20
|
-
datadog_lambda/tracing.py,sha256=
|
|
21
|
-
datadog_lambda/trigger.py,sha256=
|
|
22
|
-
datadog_lambda/version.py,sha256=
|
|
23
|
-
datadog_lambda/wrapper.py,sha256=
|
|
20
|
+
datadog_lambda/tracing.py,sha256=CbfEE3zf5wh7csIJCurYAT-UVTB4rzlm6iF9vVN-RTE,58067
|
|
21
|
+
datadog_lambda/trigger.py,sha256=bkNe77eOVuYc8kyH7KKYlsvHZfC-NXyl9GLqJ8Qaky8,14628
|
|
22
|
+
datadog_lambda/version.py,sha256=0MQjkZh_IgQU9fynjjB791-Iay3ACO64V30roqZmgyw,24
|
|
23
|
+
datadog_lambda/wrapper.py,sha256=6Q9A2xPlv1UWdsS3bvL8fo7NwBPETyusthiOvhGlM5c,15160
|
|
24
24
|
datadog_lambda/xray.py,sha256=jvA4Fk76PLMgsjUoUZ7gp2otv53hFt39Nvso1ZNaivg,3749
|
|
25
|
-
datadog_lambda-8.
|
|
26
|
-
datadog_lambda-8.
|
|
27
|
-
datadog_lambda-8.
|
|
28
|
-
datadog_lambda-8.
|
|
29
|
-
datadog_lambda-8.
|
|
30
|
-
datadog_lambda-8.
|
|
25
|
+
datadog_lambda-8.116.0.dist-info/LICENSE,sha256=4yQmjpKp1MKL7DdRDPVHkKYc2W0aezm5SIDske8oAdM,11379
|
|
26
|
+
datadog_lambda-8.116.0.dist-info/LICENSE-3rdparty.csv,sha256=9CDAR1GKawwTbZkqt1RP0uwEcaRM3RhOeTB5tWXr8Ts,1381
|
|
27
|
+
datadog_lambda-8.116.0.dist-info/METADATA,sha256=KuESyqTSoJavVi7iG4EIhSC6gFy9qSox2UBxSwvUSzI,7727
|
|
28
|
+
datadog_lambda-8.116.0.dist-info/NOTICE,sha256=Jue-d8mQ1ENIHDZdYc2-X8mVYtScXb8pzF1pTLN-kRc,141
|
|
29
|
+
datadog_lambda-8.116.0.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
|
|
30
|
+
datadog_lambda-8.116.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|