datadog_lambda 8.121.0__tar.gz → 8.123.0__tar.gz

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.
Files changed (33) hide show
  1. datadog_lambda-8.123.0/PKG-INFO +111 -0
  2. datadog_lambda-8.123.0/README.md +77 -0
  3. {datadog_lambda-8.121.0 → datadog_lambda-8.123.0}/datadog_lambda/cold_start.py +17 -0
  4. {datadog_lambda-8.121.0 → datadog_lambda-8.123.0}/datadog_lambda/config.py +1 -0
  5. datadog_lambda-8.123.0/datadog_lambda/durable.py +49 -0
  6. {datadog_lambda-8.121.0 → datadog_lambda-8.123.0}/datadog_lambda/tracing.py +3 -0
  7. datadog_lambda-8.123.0/datadog_lambda/version.py +1 -0
  8. {datadog_lambda-8.121.0 → datadog_lambda-8.123.0}/datadog_lambda/wrapper.py +12 -2
  9. {datadog_lambda-8.121.0 → datadog_lambda-8.123.0}/pyproject.toml +5 -25
  10. datadog_lambda-8.121.0/PKG-INFO +0 -24
  11. datadog_lambda-8.121.0/datadog_lambda/version.py +0 -1
  12. {datadog_lambda-8.121.0 → datadog_lambda-8.123.0}/LICENSE +0 -0
  13. {datadog_lambda-8.121.0 → datadog_lambda-8.123.0}/LICENSE-3rdparty.csv +0 -0
  14. {datadog_lambda-8.121.0 → datadog_lambda-8.123.0}/NOTICE +0 -0
  15. {datadog_lambda-8.121.0 → datadog_lambda-8.123.0}/datadog_lambda/__init__.py +0 -0
  16. {datadog_lambda-8.121.0 → datadog_lambda-8.123.0}/datadog_lambda/api.py +0 -0
  17. {datadog_lambda-8.121.0 → datadog_lambda-8.123.0}/datadog_lambda/asm.py +0 -0
  18. {datadog_lambda-8.121.0 → datadog_lambda-8.123.0}/datadog_lambda/constants.py +0 -0
  19. {datadog_lambda-8.121.0 → datadog_lambda-8.123.0}/datadog_lambda/dogstatsd.py +0 -0
  20. {datadog_lambda-8.121.0 → datadog_lambda-8.123.0}/datadog_lambda/extension.py +0 -0
  21. {datadog_lambda-8.121.0 → datadog_lambda-8.123.0}/datadog_lambda/handler.py +0 -0
  22. {datadog_lambda-8.121.0 → datadog_lambda-8.123.0}/datadog_lambda/logger.py +0 -0
  23. {datadog_lambda-8.121.0 → datadog_lambda-8.123.0}/datadog_lambda/metric.py +0 -0
  24. {datadog_lambda-8.121.0 → datadog_lambda-8.123.0}/datadog_lambda/module_name.py +0 -0
  25. {datadog_lambda-8.121.0 → datadog_lambda-8.123.0}/datadog_lambda/patch.py +0 -0
  26. {datadog_lambda-8.121.0 → datadog_lambda-8.123.0}/datadog_lambda/span_pointers.py +0 -0
  27. {datadog_lambda-8.121.0 → datadog_lambda-8.123.0}/datadog_lambda/stats_writer.py +0 -0
  28. {datadog_lambda-8.121.0 → datadog_lambda-8.123.0}/datadog_lambda/statsd_writer.py +0 -0
  29. {datadog_lambda-8.121.0 → datadog_lambda-8.123.0}/datadog_lambda/tag_object.py +0 -0
  30. {datadog_lambda-8.121.0 → datadog_lambda-8.123.0}/datadog_lambda/tags.py +0 -0
  31. {datadog_lambda-8.121.0 → datadog_lambda-8.123.0}/datadog_lambda/thread_stats_writer.py +0 -0
  32. {datadog_lambda-8.121.0 → datadog_lambda-8.123.0}/datadog_lambda/trigger.py +0 -0
  33. {datadog_lambda-8.121.0 → datadog_lambda-8.123.0}/datadog_lambda/xray.py +0 -0
@@ -0,0 +1,111 @@
1
+ Metadata-Version: 2.1
2
+ Name: datadog_lambda
3
+ Version: 8.123.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.19.1,<4) ; python_version >= "3.8" and python_version < "3.10"
24
+ Requires-Dist: ddtrace (>=4.1.1,<5) ; python_version >= "3.10"
25
+ Requires-Dist: flake8 (>=5.0.4,<6.0.0) ; extra == "dev"
26
+ Requires-Dist: pytest (>=8.0.0,<9.0.0) ; extra == "dev"
27
+ Requires-Dist: pytest-benchmark (>=4.0,<5.0) ; extra == "dev"
28
+ Requires-Dist: requests (>=2.22.0,<3.0.0) ; extra == "dev"
29
+ Requires-Dist: ujson (>=5.9.0)
30
+ Requires-Dist: wrapt (>=1.11.2,<2.0.0)
31
+ Project-URL: Repository, https://github.com/DataDog/datadog-lambda-python
32
+ Description-Content-Type: text/markdown
33
+
34
+ # datadog-lambda-python
35
+
36
+ ![build](https://github.com/DataDog/datadog-lambda-python/workflows/build/badge.svg)
37
+ [![PyPI](https://img.shields.io/pypi/v/datadog-lambda)](https://pypi.org/project/datadog-lambda/)
38
+ ![PyPI - Python Version](https://img.shields.io/pypi/pyversions/datadog-lambda)
39
+ [![Slack](https://chat.datadoghq.com/badge.svg?bg=632CA6)](https://chat.datadoghq.com/)
40
+ [![License](https://img.shields.io/badge/license-Apache--2.0-blue)](https://github.com/DataDog/datadog-lambda-python/blob/main/LICENSE)
41
+
42
+ 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.
43
+
44
+ ## Installation
45
+
46
+ Follow the [installation instructions](https://docs.datadoghq.com/serverless/installation/python/), and view your function's enhanced metrics, traces and logs in Datadog.
47
+
48
+ ## Configuration
49
+
50
+ 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.
51
+
52
+ For additional tracing configuration options, check out the [official documentation for Datadog trace client](https://ddtrace.readthedocs.io/en/stable/configuration.html).
53
+
54
+ Besides the environment variables supported by dd-trace-py, the datadog-lambda-python library added following environment variables.
55
+
56
+ | Environment Variables | Description | Default Value |
57
+ | -------------------- | ------------ | ------------- |
58
+ | 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` |
59
+ | 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` |
60
+ | 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` |
61
+ | 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` |
62
+ | 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` |
63
+ | DD_CAPTURE_LAMBDA_PAYLOAD | [Captures incoming and outgoing AWS Lambda payloads][1] in the Datadog APM spans for Lambda invocations. | `false` |
64
+ | 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` |
65
+ | DD_EXCEPTION_REPLAY_ENABLED | When set to `true`, the Lambda will run with Error Tracking Exception Replay enabled, capturing local variables. | `false` |
66
+
67
+
68
+ ## Opening Issues
69
+
70
+ 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.
71
+
72
+ 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.
73
+
74
+ You can also open an issue for a feature request.
75
+
76
+ ## Lambda Profiling Beta
77
+
78
+ 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.
79
+
80
+ 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`.
81
+
82
+ ## Major Version Notes
83
+
84
+ ### 6.x / Layer version 95+
85
+ - 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.
86
+
87
+ ### 5.x / Layer version 86+
88
+ - 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.
89
+
90
+ ### 4.x / Layer version 61+
91
+
92
+ - 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.
93
+ - `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)
94
+ - `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`.
95
+
96
+ ## Contributing
97
+
98
+ 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).
99
+
100
+ ## Community
101
+
102
+ For product feedback and questions, join the `#serverless` channel in the [Datadog community on Slack](https://chat.datadoghq.com/).
103
+
104
+ ## License
105
+
106
+ Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.
107
+
108
+ This product includes software developed at Datadog (https://www.datadoghq.com/). Copyright 2019 Datadog, Inc.
109
+
110
+ [1]: https://www.datadoghq.com/blog/troubleshoot-lambda-function-request-response-payloads/
111
+
@@ -0,0 +1,77 @@
1
+ # datadog-lambda-python
2
+
3
+ ![build](https://github.com/DataDog/datadog-lambda-python/workflows/build/badge.svg)
4
+ [![PyPI](https://img.shields.io/pypi/v/datadog-lambda)](https://pypi.org/project/datadog-lambda/)
5
+ ![PyPI - Python Version](https://img.shields.io/pypi/pyversions/datadog-lambda)
6
+ [![Slack](https://chat.datadoghq.com/badge.svg?bg=632CA6)](https://chat.datadoghq.com/)
7
+ [![License](https://img.shields.io/badge/license-Apache--2.0-blue)](https://github.com/DataDog/datadog-lambda-python/blob/main/LICENSE)
8
+
9
+ 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.
10
+
11
+ ## Installation
12
+
13
+ Follow the [installation instructions](https://docs.datadoghq.com/serverless/installation/python/), and view your function's enhanced metrics, traces and logs in Datadog.
14
+
15
+ ## Configuration
16
+
17
+ 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.
18
+
19
+ For additional tracing configuration options, check out the [official documentation for Datadog trace client](https://ddtrace.readthedocs.io/en/stable/configuration.html).
20
+
21
+ Besides the environment variables supported by dd-trace-py, the datadog-lambda-python library added following environment variables.
22
+
23
+ | Environment Variables | Description | Default Value |
24
+ | -------------------- | ------------ | ------------- |
25
+ | 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` |
26
+ | 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` |
27
+ | 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` |
28
+ | 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` |
29
+ | 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` |
30
+ | DD_CAPTURE_LAMBDA_PAYLOAD | [Captures incoming and outgoing AWS Lambda payloads][1] in the Datadog APM spans for Lambda invocations. | `false` |
31
+ | 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` |
32
+ | DD_EXCEPTION_REPLAY_ENABLED | When set to `true`, the Lambda will run with Error Tracking Exception Replay enabled, capturing local variables. | `false` |
33
+
34
+
35
+ ## Opening Issues
36
+
37
+ 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.
38
+
39
+ 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.
40
+
41
+ You can also open an issue for a feature request.
42
+
43
+ ## Lambda Profiling Beta
44
+
45
+ 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.
46
+
47
+ 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`.
48
+
49
+ ## Major Version Notes
50
+
51
+ ### 6.x / Layer version 95+
52
+ - 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.
53
+
54
+ ### 5.x / Layer version 86+
55
+ - 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.
56
+
57
+ ### 4.x / Layer version 61+
58
+
59
+ - 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.
60
+ - `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)
61
+ - `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`.
62
+
63
+ ## Contributing
64
+
65
+ 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).
66
+
67
+ ## Community
68
+
69
+ For product feedback and questions, join the `#serverless` channel in the [Datadog community on Slack](https://chat.datadoghq.com/).
70
+
71
+ ## License
72
+
73
+ Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.
74
+
75
+ This product includes software developed at Datadog (https://www.datadoghq.com/). Copyright 2019 Datadog, Inc.
76
+
77
+ [1]: https://www.datadoghq.com/blog/troubleshoot-lambda-function-request-response-payloads/
@@ -63,6 +63,19 @@ def get_proactive_init_tag():
63
63
  )
64
64
 
65
65
 
66
+ def is_managed_instances_mode():
67
+ """
68
+ Checks if the Lambda function is running in managed instances mode.
69
+ In managed instances mode, we should not create cold start tracing spans
70
+ as the gap between the sandbox initialization and the first
71
+ invocation might not be be a great experience.
72
+
73
+ Returns:
74
+ bool: True if running in managed instances mode, False otherwise
75
+ """
76
+ return config.aws_lambda_initialization_type == "lambda-managed-instances"
77
+
78
+
66
79
  class ImportNode(object):
67
80
  def __init__(self, module_name, full_file_path, start_time_ns, end_time_ns=None):
68
81
  self.module_name = module_name
@@ -145,6 +158,10 @@ def wrap_find_spec(original_find_spec):
145
158
 
146
159
 
147
160
  def initialize_cold_start_tracing():
161
+ # Skip cold start tracing initialization in managed instances mode
162
+ if is_managed_instances_mode():
163
+ return
164
+
148
165
  if is_new_sandbox() and config.cold_start_tracing:
149
166
  from sys import meta_path
150
167
 
@@ -98,6 +98,7 @@ class Config:
98
98
  integration_test = _get_env("DD_INTEGRATION_TEST", "false", as_bool)
99
99
 
100
100
  aws_lambda_function_name = _get_env("AWS_LAMBDA_FUNCTION_NAME")
101
+ aws_lambda_initialization_type = _get_env("AWS_LAMBDA_INITIALIZATION_TYPE")
101
102
 
102
103
  @property
103
104
  def function_name(self):
@@ -0,0 +1,49 @@
1
+ # Unless explicitly stated otherwise all files in this repository are licensed
2
+ # under the Apache License Version 2.0.
3
+ # This product includes software developed at Datadog (https://www.datadoghq.com/).
4
+ # Copyright 2019 Datadog, Inc.
5
+ import logging
6
+ import re
7
+
8
+ logger = logging.getLogger(__name__)
9
+
10
+
11
+ def _parse_durable_execution_arn(arn):
12
+ """
13
+ Parses a DurableExecutionArn to extract execution name and ID.
14
+ ARN format:
15
+ arn:aws:lambda:{region}:{account}:function:{func}:{version}/durable-execution/{name}/{id}
16
+ Returns (execution_name, execution_id) or None if parsing fails.
17
+ """
18
+ match = re.search(r"/durable-execution/([^/]+)/([^/]+)$", arn)
19
+ if not match:
20
+ return None
21
+ execution_name, execution_id = match.group(1), match.group(2)
22
+ if not execution_name or not execution_id:
23
+ return None
24
+ return execution_name, execution_id
25
+
26
+
27
+ def extract_durable_function_tags(event):
28
+ """
29
+ Extracts durable function tags from the Lambda event payload.
30
+ Returns a dict with durable function tags, or an empty dict if the event
31
+ is not a durable function invocation.
32
+ """
33
+ if not isinstance(event, dict):
34
+ return {}
35
+
36
+ durable_execution_arn = event.get("DurableExecutionArn")
37
+ if not isinstance(durable_execution_arn, str):
38
+ return {}
39
+
40
+ parsed = _parse_durable_execution_arn(durable_execution_arn)
41
+ if not parsed:
42
+ logger.error("Failed to parse DurableExecutionArn: %s", durable_execution_arn)
43
+ return {}
44
+
45
+ execution_name, execution_id = parsed
46
+ return {
47
+ "durable_function_execution_name": execution_name,
48
+ "durable_function_execution_id": execution_id,
49
+ }
@@ -1449,6 +1449,7 @@ def create_function_execution_span(
1449
1449
  trace_context_source,
1450
1450
  merge_xray_traces,
1451
1451
  trigger_tags,
1452
+ durable_function_tags=None,
1452
1453
  parent_span=None,
1453
1454
  span_pointers=None,
1454
1455
  ):
@@ -1477,6 +1478,8 @@ def create_function_execution_span(
1477
1478
  if trace_context_source == TraceContextSource.XRAY and merge_xray_traces:
1478
1479
  tags["_dd.parent_source"] = trace_context_source
1479
1480
  tags.update(trigger_tags)
1481
+ if durable_function_tags:
1482
+ tags.update(durable_function_tags)
1480
1483
  tracer.set_tags(_dd_origin)
1481
1484
  # Determine service name based on config and env var
1482
1485
  if config.service:
@@ -0,0 +1 @@
1
+ __version__ = "8.123.0"
@@ -16,6 +16,7 @@ from datadog_lambda.cold_start import (
16
16
  is_cold_start,
17
17
  is_proactive_init,
18
18
  is_new_sandbox,
19
+ is_managed_instances_mode,
19
20
  ColdStartTracer,
20
21
  )
21
22
  from datadog_lambda.config import config
@@ -41,6 +42,7 @@ from datadog_lambda.tracing import (
41
42
  tracer,
42
43
  propagator,
43
44
  )
45
+ from datadog_lambda.durable import extract_durable_function_tags
44
46
  from datadog_lambda.trigger import (
45
47
  extract_trigger_tags,
46
48
  extract_http_status_code_tag,
@@ -242,6 +244,7 @@ class _LambdaDecorator(object):
242
244
  submit_invocations_metric(context)
243
245
 
244
246
  self.trigger_tags = extract_trigger_tags(event, context)
247
+ self.durable_function_tags = extract_durable_function_tags(event)
245
248
  # Extract Datadog trace context and source from incoming requests
246
249
  dd_context, trace_context_source, event_source = extract_dd_trace_context(
247
250
  event,
@@ -279,6 +282,7 @@ class _LambdaDecorator(object):
279
282
  trace_context_source=trace_context_source,
280
283
  merge_xray_traces=config.merge_xray_traces,
281
284
  trigger_tags=self.trigger_tags,
285
+ durable_function_tags=self.durable_function_tags,
282
286
  parent_span=self.inferred_span,
283
287
  span_pointers=calculate_span_pointers(event_source, event),
284
288
  )
@@ -288,7 +292,7 @@ class _LambdaDecorator(object):
288
292
  else:
289
293
  set_correlation_ids()
290
294
  if config.profiling_enabled and profiler and is_new_sandbox():
291
- self.prof.start(stop_on_exit=False, profile_children=True)
295
+ self.prof.start()
292
296
  logger.debug("datadog_lambda_wrapper _before() done")
293
297
  except Exception as e:
294
298
  logger.error(format_err_with_traceback(e))
@@ -338,7 +342,13 @@ class _LambdaDecorator(object):
338
342
  create_dd_dummy_metadata_subsegment(
339
343
  self.trigger_tags, XraySubsegment.LAMBDA_FUNCTION_TAGS_KEY
340
344
  )
341
- should_trace_cold_start = config.cold_start_tracing and is_new_sandbox()
345
+ # Skip creating cold start spans in managed instances mode
346
+ # In managed instances, the tracer library handles cold start independently
347
+ should_trace_cold_start = (
348
+ config.cold_start_tracing
349
+ and is_new_sandbox()
350
+ and not is_managed_instances_mode()
351
+ )
342
352
  if should_trace_cold_start:
343
353
  trace_ctx = tracer.current_trace_context()
344
354
 
@@ -1,14 +1,10 @@
1
1
  [tool.poetry]
2
2
  name = "datadog_lambda"
3
- version = "8.121.0"
3
+ version = "8.123.0"
4
4
  description = "The Datadog AWS Lambda Library"
5
5
  authors = ["Datadog, Inc. <dev@datadoghq.com>"]
6
-
7
- [project]
8
- name = "datadog_lambda"
9
6
  license = "Apache-2.0"
10
7
  readme = "README.md"
11
- requires-python = ">=3.8.0,<4"
12
8
  repository = "https://github.com/DataDog/datadog-lambda-python"
13
9
  keywords = [
14
10
  "datadog",
@@ -16,18 +12,10 @@ keywords = [
16
12
  "lambda",
17
13
  "layer",
18
14
  ]
19
- dependencies = [
20
- "datadog>=0.51.0,<1.0.0",
21
- "wrapt>=1.11.2,<2",
22
- "ddtrace>=3.19.1,<4; python_version>='3.9.0' and python_version < '3.10'",
23
- "ddtrace>=4.1.1,<5; python_version>='3.10.0'",
24
- "ujson>=5.9.0",
25
- ]
26
15
  packages = [
27
16
  { include = "datadog_lambda" }
28
17
  ]
29
18
  classifiers = [
30
- "Programming Language :: Python :: 3 :: Only",
31
19
  "Programming Language :: Python :: 3.8",
32
20
  "Programming Language :: Python :: 3.9",
33
21
  "Programming Language :: Python :: 3.10",
@@ -37,13 +25,14 @@ classifiers = [
37
25
  "Programming Language :: Python :: 3.14",
38
26
  ]
39
27
 
40
- # can remove tool.poetry.depencies and tool.poetry.extras
41
- # after deprecation of Python 3.8
42
28
  [tool.poetry.dependencies]
43
29
  python = ">=3.8.0,<4"
44
30
  datadog = ">=0.51.0,<1.0.0"
45
31
  wrapt = "^1.11.2"
46
- ddtrace = ">=3.19.1,<4"
32
+ ddtrace = [
33
+ {version = ">=3.19.1,<4", python = ">=3.8,<3.10"},
34
+ {version = ">=4.1.1,<5", python = ">=3.10"}
35
+ ]
47
36
  ujson = ">=5.9.0"
48
37
  botocore = { version = "^1.34.0", optional = true }
49
38
  requests = { version ="^2.22.0", optional = true }
@@ -60,15 +49,6 @@ dev = [
60
49
  "requests",
61
50
  ]
62
51
 
63
- [project.optional-dependencies]
64
- dev = [
65
- "botocore>=1.34.0,<2",
66
- "requests>=2.22.0,<3",
67
- "pytest>=8.0.0,<9",
68
- "pytest-benchmark>=4.0,<5",
69
- "flake8>=5.0.4,<6",
70
- ]
71
-
72
52
  [build-system]
73
53
  requires = ["poetry-core>=1.0.0"]
74
54
  build-backend = "poetry.core.masonry.api"
@@ -1,24 +0,0 @@
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 +0,0 @@
1
- __version__ = "8.121.0"