datadog_lambda 8.116.0__tar.gz → 8.120.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 (31) hide show
  1. {datadog_lambda-8.116.0 → datadog_lambda-8.120.0}/PKG-INFO +4 -3
  2. {datadog_lambda-8.116.0 → datadog_lambda-8.120.0}/README.md +1 -1
  3. {datadog_lambda-8.116.0 → datadog_lambda-8.120.0}/datadog_lambda/__init__.py +1 -8
  4. {datadog_lambda-8.116.0 → datadog_lambda-8.120.0}/datadog_lambda/api.py +20 -5
  5. {datadog_lambda-8.116.0 → datadog_lambda-8.120.0}/datadog_lambda/config.py +9 -6
  6. {datadog_lambda-8.116.0 → datadog_lambda-8.120.0}/datadog_lambda/tag_object.py +1 -1
  7. {datadog_lambda-8.116.0 → datadog_lambda-8.120.0}/datadog_lambda/tracing.py +0 -5
  8. datadog_lambda-8.120.0/datadog_lambda/version.py +1 -0
  9. {datadog_lambda-8.116.0 → datadog_lambda-8.120.0}/datadog_lambda/wrapper.py +9 -5
  10. {datadog_lambda-8.116.0 → datadog_lambda-8.120.0}/pyproject.toml +3 -2
  11. datadog_lambda-8.116.0/datadog_lambda/version.py +0 -1
  12. {datadog_lambda-8.116.0 → datadog_lambda-8.120.0}/LICENSE +0 -0
  13. {datadog_lambda-8.116.0 → datadog_lambda-8.120.0}/LICENSE-3rdparty.csv +0 -0
  14. {datadog_lambda-8.116.0 → datadog_lambda-8.120.0}/NOTICE +0 -0
  15. {datadog_lambda-8.116.0 → datadog_lambda-8.120.0}/datadog_lambda/asm.py +0 -0
  16. {datadog_lambda-8.116.0 → datadog_lambda-8.120.0}/datadog_lambda/cold_start.py +0 -0
  17. {datadog_lambda-8.116.0 → datadog_lambda-8.120.0}/datadog_lambda/constants.py +0 -0
  18. {datadog_lambda-8.116.0 → datadog_lambda-8.120.0}/datadog_lambda/dogstatsd.py +0 -0
  19. {datadog_lambda-8.116.0 → datadog_lambda-8.120.0}/datadog_lambda/extension.py +0 -0
  20. {datadog_lambda-8.116.0 → datadog_lambda-8.120.0}/datadog_lambda/handler.py +0 -0
  21. {datadog_lambda-8.116.0 → datadog_lambda-8.120.0}/datadog_lambda/logger.py +0 -0
  22. {datadog_lambda-8.116.0 → datadog_lambda-8.120.0}/datadog_lambda/metric.py +0 -0
  23. {datadog_lambda-8.116.0 → datadog_lambda-8.120.0}/datadog_lambda/module_name.py +0 -0
  24. {datadog_lambda-8.116.0 → datadog_lambda-8.120.0}/datadog_lambda/patch.py +0 -0
  25. {datadog_lambda-8.116.0 → datadog_lambda-8.120.0}/datadog_lambda/span_pointers.py +0 -0
  26. {datadog_lambda-8.116.0 → datadog_lambda-8.120.0}/datadog_lambda/stats_writer.py +0 -0
  27. {datadog_lambda-8.116.0 → datadog_lambda-8.120.0}/datadog_lambda/statsd_writer.py +0 -0
  28. {datadog_lambda-8.116.0 → datadog_lambda-8.120.0}/datadog_lambda/tags.py +0 -0
  29. {datadog_lambda-8.116.0 → datadog_lambda-8.120.0}/datadog_lambda/thread_stats_writer.py +0 -0
  30. {datadog_lambda-8.116.0 → datadog_lambda-8.120.0}/datadog_lambda/trigger.py +0 -0
  31. {datadog_lambda-8.116.0 → datadog_lambda-8.120.0}/datadog_lambda/xray.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: datadog_lambda
3
- Version: 8.116.0
3
+ Version: 8.120.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
@@ -16,10 +16,11 @@ Classifier: Programming Language :: Python :: 3.10
16
16
  Classifier: Programming Language :: Python :: 3.11
17
17
  Classifier: Programming Language :: Python :: 3.12
18
18
  Classifier: Programming Language :: Python :: 3.13
19
+ Classifier: Programming Language :: Python :: 3.14
19
20
  Provides-Extra: dev
20
21
  Requires-Dist: botocore (>=1.34.0,<2.0.0) ; extra == "dev"
21
22
  Requires-Dist: datadog (>=0.51.0,<1.0.0)
22
- Requires-Dist: ddtrace (>=3.16.2,<4)
23
+ Requires-Dist: ddtrace (>=3.16.2,<3.19.0)
23
24
  Requires-Dist: flake8 (>=5.0.4,<6.0.0) ; extra == "dev"
24
25
  Requires-Dist: pytest (>=8.0.0,<9.0.0) ; extra == "dev"
25
26
  Requires-Dist: pytest-benchmark (>=4.0,<5.0) ; extra == "dev"
@@ -37,7 +38,7 @@ Description-Content-Type: text/markdown
37
38
  [![Slack](https://chat.datadoghq.com/badge.svg?bg=632CA6)](https://chat.datadoghq.com/)
38
39
  [![License](https://img.shields.io/badge/license-Apache--2.0-blue)](https://github.com/DataDog/datadog-lambda-python/blob/main/LICENSE)
39
40
 
40
- Datadog Lambda Library for Python (3.8, 3.9, 3.10, 3.11, 3.12, and 3.13) 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.
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.
41
42
 
42
43
  ## Installation
43
44
 
@@ -6,7 +6,7 @@
6
6
  [![Slack](https://chat.datadoghq.com/badge.svg?bg=632CA6)](https://chat.datadoghq.com/)
7
7
  [![License](https://img.shields.io/badge/license-Apache--2.0-blue)](https://github.com/DataDog/datadog-lambda-python/blob/main/LICENSE)
8
8
 
9
- Datadog Lambda Library for Python (3.8, 3.9, 3.10, 3.11, 3.12, and 3.13) 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.
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
10
 
11
11
  ## Installation
12
12
 
@@ -1,12 +1,5 @@
1
+ import datadog_lambda.config # noqa: F401 needs to be imported before `ddtrace`
1
2
  from datadog_lambda.cold_start import initialize_cold_start_tracing
2
- import os
3
-
4
-
5
- if os.environ.get("DD_INSTRUMENTATION_TELEMETRY_ENABLED") is None:
6
- # Telemetry is required for Appsec Software Composition Analysis
7
- os.environ["DD_INSTRUMENTATION_TELEMETRY_ENABLED"] = os.environ.get(
8
- "DD_APPSEC_ENABLED", "false"
9
- )
10
3
 
11
4
 
12
5
  initialize_cold_start_tracing()
@@ -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
@@ -82,12 +82,6 @@ class Config:
82
82
  logs_injection = _get_env("DD_LOGS_INJECTION", "true", as_bool)
83
83
  merge_xray_traces = _get_env("DD_MERGE_XRAY_TRACES", "false", as_bool)
84
84
 
85
- telemetry_enabled = _get_env(
86
- "DD_INSTRUMENTATION_TELEMETRY_ENABLED",
87
- "false",
88
- as_bool,
89
- depends_on_tracing=True,
90
- )
91
85
  otel_enabled = _get_env("DD_TRACE_OTEL_ENABLED", "false", as_bool)
92
86
  profiling_enabled = _get_env("DD_PROFILING_ENABLED", "false", as_bool)
93
87
  llmobs_enabled = _get_env("DD_LLMOBS_ENABLED", "false", as_bool)
@@ -96,6 +90,7 @@ class Config:
96
90
  "DD_DATA_STREAMS_ENABLED", "false", as_bool, depends_on_tracing=True
97
91
  )
98
92
  appsec_enabled = _get_env("DD_APPSEC_ENABLED", "false", as_bool)
93
+ sca_enabled = _get_env("DD_APPSEC_SCA_ENABLED", "false", as_bool)
99
94
 
100
95
  is_gov_region = _get_env("AWS_REGION", "", lambda x: x.startswith("us-gov-"))
101
96
 
@@ -144,3 +139,11 @@ if config.is_gov_region or config.fips_mode_enabled:
144
139
  "Python Lambda Layer FIPS mode is %s.",
145
140
  "enabled" if config.fips_mode_enabled else "not enabled",
146
141
  )
142
+
143
+
144
+ if (
145
+ "DD_INSTRUMENTATION_TELEMETRY_ENABLED" not in os.environ
146
+ and not config.sca_enabled
147
+ and not config.appsec_enabled
148
+ ):
149
+ os.environ["DD_INSTRUMENTATION_TELEMETRY_ENABLED"] = "false"
@@ -62,6 +62,6 @@ def _should_try_string(obj):
62
62
 
63
63
  def _redact_val(k, v):
64
64
  split_key = k.split(".").pop() or k
65
- if split_key in redactable_keys:
65
+ if split_key.lower() in redactable_keys:
66
66
  return "redacted"
67
67
  return v
@@ -55,11 +55,6 @@ if config.otel_enabled:
55
55
  logger = logging.getLogger(__name__)
56
56
 
57
57
  dd_trace_context = None
58
- if config.telemetry_enabled:
59
- # Enable the telemetry client if the user has opted in
60
- from ddtrace.internal.telemetry import telemetry_writer
61
-
62
- telemetry_writer.enable()
63
58
 
64
59
  propagator = HTTPPropagator()
65
60
 
@@ -0,0 +1 @@
1
+ __version__ = "8.120.0"
@@ -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:
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "datadog_lambda"
3
- version = "8.116.0"
3
+ version = "8.120.0"
4
4
  description = "The Datadog AWS Lambda Library"
5
5
  authors = ["Datadog, Inc. <dev@datadoghq.com>"]
6
6
  license = "Apache-2.0"
@@ -22,13 +22,14 @@ classifiers = [
22
22
  "Programming Language :: Python :: 3.11",
23
23
  "Programming Language :: Python :: 3.12",
24
24
  "Programming Language :: Python :: 3.13",
25
+ "Programming Language :: Python :: 3.14",
25
26
  ]
26
27
 
27
28
  [tool.poetry.dependencies]
28
29
  python = ">=3.8.0,<4"
29
30
  datadog = ">=0.51.0,<1.0.0"
30
31
  wrapt = "^1.11.2"
31
- ddtrace = ">=3.16.2,<4"
32
+ ddtrace = ">=3.16.2,<3.19.0"
32
33
  ujson = ">=5.9.0"
33
34
  botocore = { version = "^1.34.0", optional = true }
34
35
  requests = { version ="^2.22.0", optional = true }
@@ -1 +0,0 @@
1
- __version__ = "8.116.0"