datadog_lambda 8.118.0__py3-none-any.whl → 8.121.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/api.py CHANGED
@@ -5,6 +5,14 @@ from datadog_lambda.config import config
5
5
 
6
6
  logger = logging.getLogger(__name__)
7
7
  KMS_ENCRYPTION_CONTEXT_KEY = "LambdaFunctionName"
8
+ SSM_FIPS_SUPPORTED_REGIONS = {
9
+ "us-east-1",
10
+ "us-east-2",
11
+ "us-west-1",
12
+ "us-west-2",
13
+ "ca-central-1",
14
+ "ca-west-1",
15
+ }
8
16
  api_key = None
9
17
 
10
18
 
@@ -92,11 +100,18 @@ def get_api_key() -> str:
92
100
  )["SecretString"]
93
101
  elif DD_API_KEY_SSM_NAME:
94
102
  # SSM endpoints: https://docs.aws.amazon.com/general/latest/gr/ssm.html
95
- fips_endpoint = (
96
- f"https://ssm-fips.{LAMBDA_REGION}.amazonaws.com"
97
- if config.fips_mode_enabled
98
- else None
99
- )
103
+ fips_endpoint = None
104
+ if config.fips_mode_enabled:
105
+ if LAMBDA_REGION in SSM_FIPS_SUPPORTED_REGIONS:
106
+ fips_endpoint = f"https://ssm-fips.{LAMBDA_REGION}.amazonaws.com"
107
+ else:
108
+ # Log warning if SSM FIPS endpoint is not supported for commercial region
109
+ if not config.is_gov_region:
110
+ logger.warning(
111
+ "FIPS mode is enabled, but '%s' does not support SSM FIPS endpoints. "
112
+ "Using standard SSM endpoint.",
113
+ LAMBDA_REGION,
114
+ )
100
115
  ssm_client = _boto3_client("ssm", endpoint_url=fips_endpoint)
101
116
  api_key = ssm_client.get_parameter(
102
117
  Name=DD_API_KEY_SSM_NAME, WithDecryption=True
datadog_lambda/asm.py CHANGED
@@ -223,7 +223,9 @@ def get_asm_blocked_response(
223
223
  content = ""
224
224
  else:
225
225
  content_type = blocked.get("content-type", "application/json")
226
- content = http_utils._get_blocked_template(content_type)
226
+ content = http_utils._get_blocked_template(
227
+ content_type, blocked.get("block_id", "default")
228
+ )
227
229
 
228
230
  response = {
229
231
  "statusCode": blocked.get("status_code", 403),
datadog_lambda/tracing.py CHANGED
@@ -927,6 +927,7 @@ def create_inferred_span_from_lambda_function_url_event(event, context):
927
927
  InferredSpanInfo.set_tags(tags, tag_source="self", synchronicity="sync")
928
928
  if span:
929
929
  span.set_tags(tags)
930
+ span.set_metric(InferredSpanInfo.METRIC, 1.0)
930
931
  span.start_ns = int(request_time_epoch * 1e6)
931
932
  return span
932
933
 
@@ -1047,6 +1048,7 @@ def create_inferred_span_from_api_gateway_websocket_event(
1047
1048
  span = tracer.trace("aws.apigateway.websocket", **args)
1048
1049
  if span:
1049
1050
  span.set_tags(tags)
1051
+ span.set_metric(InferredSpanInfo.METRIC, 1.0)
1050
1052
  span.start_ns = int(
1051
1053
  finish_time_ns
1052
1054
  if finish_time_ns is not None
@@ -1061,6 +1063,8 @@ def create_inferred_span_from_api_gateway_event(
1061
1063
  event, context, decode_authorizer_context: bool = True
1062
1064
  ):
1063
1065
  request_context = event.get("requestContext")
1066
+ identity = request_context.get("identity")
1067
+
1064
1068
  domain = request_context.get("domainName", "")
1065
1069
  api_id = request_context.get("apiId")
1066
1070
  service_name = determine_service_name(
@@ -1072,11 +1076,11 @@ def create_inferred_span_from_api_gateway_event(
1072
1076
  resource_path = _get_resource_path(event, request_context)
1073
1077
  resource = f"{method} {resource_path}"
1074
1078
  tags = {
1075
- "operation_name": "aws.apigateway.rest",
1076
1079
  "http.url": http_url,
1077
1080
  "endpoint": path,
1078
1081
  "http.method": method,
1079
1082
  "resource_names": resource,
1083
+ "http.useragent": identity.get("userAgent"),
1080
1084
  "span.kind": "server",
1081
1085
  "apiid": api_id,
1082
1086
  "apiname": api_id,
@@ -1091,7 +1095,7 @@ def create_inferred_span_from_api_gateway_event(
1091
1095
  args = {
1092
1096
  "service": service_name,
1093
1097
  "resource": resource,
1094
- "span_type": "http",
1098
+ "span_type": "web",
1095
1099
  }
1096
1100
  tracer.set_tags(_dd_origin)
1097
1101
  upstream_authorizer_span = None
@@ -1103,6 +1107,7 @@ def create_inferred_span_from_api_gateway_event(
1103
1107
  span = tracer.trace("aws.apigateway", **args)
1104
1108
  if span:
1105
1109
  span.set_tags(tags)
1110
+ span.set_metric(InferredSpanInfo.METRIC, 1.0)
1106
1111
  # start time pushed by the inserted authorizer span
1107
1112
  span.start_ns = int(
1108
1113
  finish_time_ns
@@ -1140,13 +1145,12 @@ def create_inferred_span_from_http_api_event(
1140
1145
  resource_path = _get_resource_path(event, request_context)
1141
1146
  resource = f"{method} {resource_path}"
1142
1147
  tags = {
1143
- "operation_name": "aws.httpapi",
1144
1148
  "endpoint": path,
1145
1149
  "http.url": http_url,
1146
1150
  "http.method": http.get("method"),
1147
1151
  "http.protocol": http.get("protocol"),
1148
1152
  "http.source_ip": http.get("sourceIp"),
1149
- "http.user_agent": http.get("userAgent"),
1153
+ "http.useragent": http.get("userAgent"),
1150
1154
  "resource_names": resource,
1151
1155
  "request_id": context.aws_request_id,
1152
1156
  "apiid": api_id,
@@ -1167,10 +1171,11 @@ def create_inferred_span_from_http_api_event(
1167
1171
  Headers.Parent_Span_Finish_Time
1168
1172
  )
1169
1173
  span = tracer.trace(
1170
- "aws.httpapi", service=service_name, resource=resource, span_type="http"
1174
+ "aws.httpapi", service=service_name, resource=resource, span_type="web"
1171
1175
  )
1172
1176
  if span:
1173
1177
  span.set_tags(tags)
1178
+ span.set_metric(InferredSpanInfo.METRIC, 1.0)
1174
1179
  span.start_ns = int(inferred_span_start_ns)
1175
1180
  return span
1176
1181
 
@@ -1237,6 +1242,7 @@ def create_inferred_span_from_sqs_event(event, context):
1237
1242
  )
1238
1243
  if span:
1239
1244
  span.set_tags(tags)
1245
+ span.set_metric(InferredSpanInfo.METRIC, 1.0)
1240
1246
  span.start = start_time
1241
1247
  if upstream_span:
1242
1248
  span.parent_id = upstream_span.span_id
@@ -1278,6 +1284,7 @@ def create_inferred_span_from_sns_event(event, context):
1278
1284
  )
1279
1285
  if span:
1280
1286
  span.set_tags(tags)
1287
+ span.set_metric(InferredSpanInfo.METRIC, 1.0)
1281
1288
  span.start = dt.replace(tzinfo=timezone.utc).timestamp()
1282
1289
  return span
1283
1290
 
@@ -1313,6 +1320,7 @@ def create_inferred_span_from_kinesis_event(event, context):
1313
1320
  )
1314
1321
  if span:
1315
1322
  span.set_tags(tags)
1323
+ span.set_metric(InferredSpanInfo.METRIC, 1.0)
1316
1324
  span.start = request_time_epoch
1317
1325
  return span
1318
1326
 
@@ -1345,6 +1353,7 @@ def create_inferred_span_from_dynamodb_event(event, context):
1345
1353
  )
1346
1354
  if span:
1347
1355
  span.set_tags(tags)
1356
+ span.set_metric(InferredSpanInfo.METRIC, 1.0)
1348
1357
 
1349
1358
  span.start = int(request_time_epoch)
1350
1359
  return span
@@ -1381,6 +1390,7 @@ def create_inferred_span_from_s3_event(event, context):
1381
1390
  )
1382
1391
  if span:
1383
1392
  span.set_tags(tags)
1393
+ span.set_metric(InferredSpanInfo.METRIC, 1.0)
1384
1394
  span.start = dt.replace(tzinfo=timezone.utc).timestamp()
1385
1395
  return span
1386
1396
 
@@ -1421,10 +1431,11 @@ def create_inferred_span_from_eventbridge_event(event, context):
1421
1431
  )
1422
1432
  if span:
1423
1433
  span.set_tags(tags)
1434
+ span.set_metric(InferredSpanInfo.METRIC, 1.0)
1424
1435
  span.start = dt.replace(tzinfo=timezone.utc).timestamp()
1425
1436
 
1426
1437
  # Since inferred span will later parent Lambda, preserve Lambda's current parent
1427
- if dd_trace_context.span_id:
1438
+ if dd_trace_context and getattr(dd_trace_context, "span_id", None):
1428
1439
  span.parent_id = dd_trace_context.span_id
1429
1440
 
1430
1441
  return span
@@ -1512,6 +1523,7 @@ class InferredSpanInfo(object):
1512
1523
  BASE_NAME = "_inferred_span"
1513
1524
  SYNCHRONICITY = f"{BASE_NAME}.synchronicity"
1514
1525
  TAG_SOURCE = f"{BASE_NAME}.tag_source"
1526
+ METRIC = f"_dd.{BASE_NAME}"
1515
1527
 
1516
1528
  @staticmethod
1517
1529
  def set_tags(
datadog_lambda/version.py CHANGED
@@ -1 +1 @@
1
- __version__ = "8.118.0"
1
+ __version__ = "8.121.0"
datadog_lambda/wrapper.py CHANGED
@@ -46,6 +46,8 @@ from datadog_lambda.trigger import (
46
46
  extract_http_status_code_tag,
47
47
  )
48
48
 
49
+ logger = logging.getLogger(__name__)
50
+
49
51
  # ddtrace imports are also tested in
50
52
  # dd-trace-py/tests/internal/test_serverless.py please update those tests when
51
53
  # making changes to any ddtrace import.
@@ -61,8 +63,12 @@ if config.appsec_enabled:
61
63
 
62
64
  start()
63
65
 
66
+ profiler = None
64
67
  if config.profiling_enabled:
65
- from ddtrace.profiling import profiler
68
+ try:
69
+ from ddtrace.profiling import profiler
70
+ except Exception as e:
71
+ logger.error(f"Failed to initialize profiler: [{e.__class__.__name__})] {e}")
66
72
 
67
73
  if config.llmobs_enabled:
68
74
  from ddtrace.llmobs import LLMObs
@@ -75,8 +81,6 @@ if config.exception_replay_enabled:
75
81
  except ImportError:
76
82
  from ddtrace.debugging._uploader import LogsIntakeUploaderV1 as SignalUploader
77
83
 
78
- logger = logging.getLogger(__name__)
79
-
80
84
  DD_REQUESTS_SERVICE_NAME = "DD_REQUESTS_SERVICE_NAME"
81
85
  DD_SERVICE = "DD_SERVICE"
82
86
 
@@ -141,7 +145,7 @@ class _LambdaDecorator(object):
141
145
  self.response = None
142
146
  self.blocking_response = None
143
147
 
144
- if config.profiling_enabled:
148
+ if config.profiling_enabled and profiler:
145
149
  self.prof = profiler.Profiler(env=config.env, service=config.service)
146
150
 
147
151
  if config.trace_extractor:
@@ -283,7 +287,7 @@ class _LambdaDecorator(object):
283
287
  self.blocking_response = get_asm_blocked_response(self.event_source)
284
288
  else:
285
289
  set_correlation_ids()
286
- if config.profiling_enabled and is_new_sandbox():
290
+ if config.profiling_enabled and profiler and is_new_sandbox():
287
291
  self.prof.start(stop_on_exit=False, profile_children=True)
288
292
  logger.debug("datadog_lambda_wrapper _before() done")
289
293
  except Exception as e:
@@ -342,8 +346,16 @@ class _LambdaDecorator(object):
342
346
  if status_code:
343
347
  self.inferred_span.set_tag("http.status_code", status_code)
344
348
 
345
- if self.trigger_tags and (route := self.trigger_tags.get("http.route")):
346
- self.inferred_span.set_tag("http.route", route)
349
+ if self.trigger_tags:
350
+ route = self.trigger_tags.get("http.route")
351
+ if route:
352
+ self.inferred_span.set_tag("http.route", route)
353
+
354
+ event_source_arn = self.trigger_tags.get(
355
+ "function_trigger.event_source_arn"
356
+ )
357
+ if event_source_arn:
358
+ self.inferred_span.set_tag("dd_resource_key", event_source_arn)
347
359
 
348
360
  if config.service:
349
361
  self.inferred_span.set_tag("peer.service", config.service)
@@ -0,0 +1,24 @@
1
+ Metadata-Version: 2.1
2
+ Name: datadog_lambda
3
+ Version: 8.121.0
4
+ Summary: The Datadog AWS Lambda Library
5
+ Author: Datadog, Inc.
6
+ Author-email: dev@datadoghq.com
7
+ Requires-Python: >=3.8.0,<4
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: Programming Language :: Python :: 3.8
10
+ Classifier: Programming Language :: Python :: 3.9
11
+ Classifier: Programming Language :: Python :: 3.10
12
+ Classifier: Programming Language :: Python :: 3.11
13
+ Classifier: Programming Language :: Python :: 3.12
14
+ Classifier: Programming Language :: Python :: 3.13
15
+ Provides-Extra: dev
16
+ Requires-Dist: botocore (>=1.34.0,<2.0.0) ; extra == "dev"
17
+ Requires-Dist: datadog (>=0.51.0,<1.0.0)
18
+ Requires-Dist: ddtrace (>=3.19.1,<4)
19
+ Requires-Dist: flake8 (>=5.0.4,<6.0.0) ; extra == "dev"
20
+ Requires-Dist: pytest (>=8.0.0,<9.0.0) ; extra == "dev"
21
+ Requires-Dist: pytest-benchmark (>=4.0,<5.0) ; extra == "dev"
22
+ Requires-Dist: requests (>=2.22.0,<3.0.0) ; extra == "dev"
23
+ Requires-Dist: ujson (>=5.9.0)
24
+ Requires-Dist: wrapt (>=1.11.2,<2.0.0)
@@ -1,6 +1,6 @@
1
1
  datadog_lambda/__init__.py,sha256=9xx1R86jNFqIMYKqjkbu0RdA940zAu0L9rGJzPJm1vs,633
2
- datadog_lambda/api.py,sha256=FqQ9vjNSxD5BxjeHDDKbim_NIN08dshW-52wNzqw5yo,5249
3
- datadog_lambda/asm.py,sha256=ZOX_rElpGF5uX-r-SoPnjFAv0vSd1y7YYfwz5m38xpc,8167
2
+ datadog_lambda/api.py,sha256=aavYiMQ5z9NSUwyjBy4aDtfbfPCpoAXuA-xlMEPAy1o,5836
3
+ datadog_lambda/asm.py,sha256=aWxs3gf0Xz7ZCM3WGdK-OocSjlD7fCS_jJZu5sOeH4s,8225
4
4
  datadog_lambda/cold_start.py,sha256=NfE4EtRUHuc2ub26U8sAwMVEDNINbw1OTh2MAklQGyk,8032
5
5
  datadog_lambda/config.py,sha256=pvr5nrqLUErLMblB1vSAUWMIauju7kMsbZx7akO7AQM,5376
6
6
  datadog_lambda/constants.py,sha256=0y6O9s_8RLflYR507SDMQjKmYY16tr1yi2KQuuF1GaY,1696
@@ -17,14 +17,14 @@ datadog_lambda/statsd_writer.py,sha256=wUNG8phIreNOGCc5VjYZV-FNogvKfiz9kN33QldqZ
17
17
  datadog_lambda/tag_object.py,sha256=IwKXf9QNsxqP9Slt44SJPqbWQ-L6AuFptlN9Jtbh4Kg,2097
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=auPyokQ2wTcyYCpB7t00j5keGBN_7gbM4s78yqeURSY,57888
20
+ datadog_lambda/tracing.py,sha256=jAhhGBlDZTJb-jiwvwTeVQAEH0wENWakDlIfre3_cCo,58507
21
21
  datadog_lambda/trigger.py,sha256=bkNe77eOVuYc8kyH7KKYlsvHZfC-NXyl9GLqJ8Qaky8,14628
22
- datadog_lambda/version.py,sha256=mTjV41boWYftT2LHD_cRJ9wet1hXMmwQTnDwMyerr1o,24
23
- datadog_lambda/wrapper.py,sha256=6Q9A2xPlv1UWdsS3bvL8fo7NwBPETyusthiOvhGlM5c,15160
22
+ datadog_lambda/version.py,sha256=B_xVOhS32bp0A9fxp8_vn516Yjhj3K3lYaC2MKtyVnQ,24
23
+ datadog_lambda/wrapper.py,sha256=RO-Fk9izWTuP7H9QCXeHs9B0weDkPy1kvSZ5YsMLV-Y,15649
24
24
  datadog_lambda/xray.py,sha256=jvA4Fk76PLMgsjUoUZ7gp2otv53hFt39Nvso1ZNaivg,3749
25
- datadog_lambda-8.118.0.dist-info/LICENSE,sha256=4yQmjpKp1MKL7DdRDPVHkKYc2W0aezm5SIDske8oAdM,11379
26
- datadog_lambda-8.118.0.dist-info/LICENSE-3rdparty.csv,sha256=9CDAR1GKawwTbZkqt1RP0uwEcaRM3RhOeTB5tWXr8Ts,1381
27
- datadog_lambda-8.118.0.dist-info/METADATA,sha256=Pl_PNdAA-wXp0g7G2ZSY0dFAjHVOpCBPe1qcjk1Avpo,7789
28
- datadog_lambda-8.118.0.dist-info/NOTICE,sha256=Jue-d8mQ1ENIHDZdYc2-X8mVYtScXb8pzF1pTLN-kRc,141
29
- datadog_lambda-8.118.0.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
30
- datadog_lambda-8.118.0.dist-info/RECORD,,
25
+ datadog_lambda-8.121.0.dist-info/LICENSE,sha256=4yQmjpKp1MKL7DdRDPVHkKYc2W0aezm5SIDske8oAdM,11379
26
+ datadog_lambda-8.121.0.dist-info/LICENSE-3rdparty.csv,sha256=9CDAR1GKawwTbZkqt1RP0uwEcaRM3RhOeTB5tWXr8Ts,1381
27
+ datadog_lambda-8.121.0.dist-info/METADATA,sha256=eicMuG6GQ4FbSUWAvgKV3YRlqtpwTraRUrq1xS4CLnc,994
28
+ datadog_lambda-8.121.0.dist-info/NOTICE,sha256=Jue-d8mQ1ENIHDZdYc2-X8mVYtScXb8pzF1pTLN-kRc,141
29
+ datadog_lambda-8.121.0.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
30
+ datadog_lambda-8.121.0.dist-info/RECORD,,
@@ -1,110 +0,0 @@
1
- Metadata-Version: 2.1
2
- Name: datadog_lambda
3
- Version: 8.118.0
4
- Summary: The Datadog AWS Lambda Library
5
- Home-page: https://github.com/DataDog/datadog-lambda-python
6
- License: Apache-2.0
7
- Keywords: datadog,aws,lambda,layer
8
- Author: Datadog, Inc.
9
- Author-email: dev@datadoghq.com
10
- Requires-Python: >=3.8.0,<4
11
- Classifier: License :: OSI Approved :: Apache Software License
12
- Classifier: Programming Language :: Python :: 3
13
- Classifier: Programming Language :: Python :: 3.8
14
- Classifier: Programming Language :: Python :: 3.9
15
- Classifier: Programming Language :: Python :: 3.10
16
- Classifier: Programming Language :: Python :: 3.11
17
- Classifier: Programming Language :: Python :: 3.12
18
- Classifier: Programming Language :: Python :: 3.13
19
- Classifier: Programming Language :: Python :: 3.14
20
- Provides-Extra: dev
21
- Requires-Dist: botocore (>=1.34.0,<2.0.0) ; extra == "dev"
22
- Requires-Dist: datadog (>=0.51.0,<1.0.0)
23
- Requires-Dist: ddtrace (>=3.16.2,<3.19.0)
24
- Requires-Dist: flake8 (>=5.0.4,<6.0.0) ; extra == "dev"
25
- Requires-Dist: pytest (>=8.0.0,<9.0.0) ; extra == "dev"
26
- Requires-Dist: pytest-benchmark (>=4.0,<5.0) ; extra == "dev"
27
- Requires-Dist: requests (>=2.22.0,<3.0.0) ; extra == "dev"
28
- Requires-Dist: ujson (>=5.9.0)
29
- Requires-Dist: wrapt (>=1.11.2,<2.0.0)
30
- Project-URL: Repository, https://github.com/DataDog/datadog-lambda-python
31
- Description-Content-Type: text/markdown
32
-
33
- # datadog-lambda-python
34
-
35
- ![build](https://github.com/DataDog/datadog-lambda-python/workflows/build/badge.svg)
36
- [![PyPI](https://img.shields.io/pypi/v/datadog-lambda)](https://pypi.org/project/datadog-lambda/)
37
- ![PyPI - Python Version](https://img.shields.io/pypi/pyversions/datadog-lambda)
38
- [![Slack](https://chat.datadoghq.com/badge.svg?bg=632CA6)](https://chat.datadoghq.com/)
39
- [![License](https://img.shields.io/badge/license-Apache--2.0-blue)](https://github.com/DataDog/datadog-lambda-python/blob/main/LICENSE)
40
-
41
- Datadog Lambda Library for Python (3.8, 3.9, 3.10, 3.11, 3.12, 3.13, and 3.14) enables [enhanced Lambda metrics](https://docs.datadoghq.com/serverless/enhanced_lambda_metrics), [distributed tracing](https://docs.datadoghq.com/serverless/distributed_tracing), and [custom metric submission](https://docs.datadoghq.com/serverless/custom_metrics) from AWS Lambda functions.
42
-
43
- ## Installation
44
-
45
- Follow the [installation instructions](https://docs.datadoghq.com/serverless/installation/python/), and view your function's enhanced metrics, traces and logs in Datadog.
46
-
47
- ## Configuration
48
-
49
- Follow the [configuration instructions](https://docs.datadoghq.com/serverless/configuration) to tag your telemetry, capture request/response payloads, filter or scrub sensitive information from logs or traces, and more.
50
-
51
- For additional tracing configuration options, check out the [official documentation for Datadog trace client](https://ddtrace.readthedocs.io/en/stable/configuration.html).
52
-
53
- Besides the environment variables supported by dd-trace-py, the datadog-lambda-python library added following environment variables.
54
-
55
- | Environment Variables | Description | Default Value |
56
- | -------------------- | ------------ | ------------- |
57
- | DD_ENCODE_AUTHORIZER_CONTEXT | When set to `true` for Lambda authorizers, the tracing context will be encoded into the response for propagation. Supported for NodeJS and Python. | `true` |
58
- | DD_DECODE_AUTHORIZER_CONTEXT | When set to `true` for Lambdas that are authorized via Lambda authorizers, it will parse and use the encoded tracing context (if found). Supported for NodeJS and Python. | `true` |
59
- | DD_COLD_START_TRACING | When true (default), tracing occurs during cold start which creates many child spans. When false, only one cold start span is created. Used in NodeJS and Python. | `true` |
60
- | DD_MIN_COLD_START_DURATION | Sets the minimum duration (in milliseconds) for a module load event to be traced via Cold Start Tracing. Number. | `3` |
61
- | DD_COLD_START_TRACE_SKIP_LIB | optionally skip creating Cold Start Spans for a comma-separated list of libraries. Useful to limit depth or skip known libraries. | `ddtrace.internal.compat,ddtrace.filters` |
62
- | DD_CAPTURE_LAMBDA_PAYLOAD | [Captures incoming and outgoing AWS Lambda payloads][1] in the Datadog APM spans for Lambda invocations. | `false` |
63
- | DD_CAPTURE_LAMBDA_PAYLOAD_MAX_DEPTH | Determines the level of detail captured from AWS Lambda payloads, which are then assigned as tags for the `aws.lambda` span. It specifies the nesting depth of the JSON payload structure to process. Once the specified maximum depth is reached, the tag's value is set to the stringified value of any nested elements beyond this level. <br> For example, given the input payload: <pre>{<br> "lv1" : {<br> "lv2": {<br> "lv3": "val"<br> }<br> }<br>}</pre> If the depth is set to `2`, the resulting tag's key is set to `function.request.lv1.lv2` and the value is `{\"lv3\": \"val\"}`. <br> If the depth is set to `0`, the resulting tag's key is set to `function.request` and value is `{\"lv1\":{\"lv2\":{\"lv3\": \"val\"}}}` | `10` |
64
- | DD_EXCEPTION_REPLAY_ENABLED | When set to `true`, the Lambda will run with Error Tracking Exception Replay enabled, capturing local variables. | `false` |
65
-
66
-
67
- ## Opening Issues
68
-
69
- If you encounter a bug with this package, we want to hear about it. Before opening a new issue, search the existing issues to avoid duplicates.
70
-
71
- When opening an issue, include the Datadog Lambda Library version, Python version, and stack trace if available. In addition, include the steps to reproduce when appropriate.
72
-
73
- You can also open an issue for a feature request.
74
-
75
- ## Lambda Profiling Beta
76
-
77
- Datadog's [Continuous Profiler](https://www.datadoghq.com/product/code-profiling/) is now available in beta for Python in version 4.62.0 and layer version 62 and above. This optional feature is enabled by setting the `DD_PROFILING_ENABLED` environment variable to `true`. During the beta period, profiling is available at no additional cost.
78
-
79
- The Continuous Profiler works by spawning a thread which periodically wakes up and takes a snapshot of the CPU and Heap of all running python code. This can include the profiler itself. If you want the Profiler to ignore itself, set `DD_PROFILING_IGNORE_PROFILER` to `true`.
80
-
81
- ## Major Version Notes
82
-
83
- ### 6.x / Layer version 95+
84
- - The release changed how Lambda's traceID is hashed if the incoming payload contains Step Functions context object. This change only affects those who uses inject Step Functions context object into Lambda payload.
85
-
86
- ### 5.x / Layer version 86+
87
- - Python3.7 support has been [deprecated](https://docs.aws.amazon.com/lambda/latest/dg/lambda-runtimes.html) by AWS, and support removed from this library.
88
-
89
- ### 4.x / Layer version 61+
90
-
91
- - Python3.6 support has been [deprecated](https://docs.aws.amazon.com/lambda/latest/dg/lambda-runtimes.html) by AWS, and support removed from this library.
92
- - `dd-trace` upgraded from 0.61 to 1.4, full release notes are available [here](https://ddtrace.readthedocs.io/en/stable/release_notes.html#v1-0-0)
93
- - `get_correlation_ids()` has been changed to `get_log_correlation_context()`, which now returns a dictionary containing the active `span_id`, `trace_id`, as well as `service` and `env`.
94
-
95
- ## Contributing
96
-
97
- If you find an issue with this package and have a fix, please feel free to open a pull request following the [procedures](CONTRIBUTING.md).
98
-
99
- ## Community
100
-
101
- For product feedback and questions, join the `#serverless` channel in the [Datadog community on Slack](https://chat.datadoghq.com/).
102
-
103
- ## License
104
-
105
- Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.
106
-
107
- This product includes software developed at Datadog (https://www.datadoghq.com/). Copyright 2019 Datadog, Inc.
108
-
109
- [1]: https://www.datadoghq.com/blog/troubleshoot-lambda-function-request-response-payloads/
110
-