datadog_lambda 8.118.0__py3-none-any.whl → 8.120.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/version.py CHANGED
@@ -1 +1 @@
1
- __version__ = "8.118.0"
1
+ __version__ = "8.120.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:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: datadog_lambda
3
- Version: 8.118.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
@@ -1,5 +1,5 @@
1
1
  datadog_lambda/__init__.py,sha256=9xx1R86jNFqIMYKqjkbu0RdA940zAu0L9rGJzPJm1vs,633
2
- datadog_lambda/api.py,sha256=FqQ9vjNSxD5BxjeHDDKbim_NIN08dshW-52wNzqw5yo,5249
2
+ datadog_lambda/api.py,sha256=aavYiMQ5z9NSUwyjBy4aDtfbfPCpoAXuA-xlMEPAy1o,5836
3
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=pvr5nrqLUErLMblB1vSAUWMIauju7kMsbZx7akO7AQM,5376
@@ -19,12 +19,12 @@ datadog_lambda/tags.py,sha256=wy6uH8eAGMn7cfZEdHpL9uEGoM85bVyyXhYwSQtfHHc,2532
19
19
  datadog_lambda/thread_stats_writer.py,sha256=VfD6G65zNHDA0nABhGOO0it7yqvn-p6ereQ329DA7r8,2894
20
20
  datadog_lambda/tracing.py,sha256=auPyokQ2wTcyYCpB7t00j5keGBN_7gbM4s78yqeURSY,57888
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=29ZXnWNzuBuuqF7msNJiwoBnUKM_gQqQEcsRKwlERdM,24
23
+ datadog_lambda/wrapper.py,sha256=dQ9y2fWbiQjIqzZHfpKxwpCgcLmPufypQWFC1D9gJR8,15328
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.120.0.dist-info/LICENSE,sha256=4yQmjpKp1MKL7DdRDPVHkKYc2W0aezm5SIDske8oAdM,11379
26
+ datadog_lambda-8.120.0.dist-info/LICENSE-3rdparty.csv,sha256=9CDAR1GKawwTbZkqt1RP0uwEcaRM3RhOeTB5tWXr8Ts,1381
27
+ datadog_lambda-8.120.0.dist-info/METADATA,sha256=Y_mHVqpOunpxFOWdY63PojrcF6p7rSqyKb9LggP_6kw,7789
28
+ datadog_lambda-8.120.0.dist-info/NOTICE,sha256=Jue-d8mQ1ENIHDZdYc2-X8mVYtScXb8pzF1pTLN-kRc,141
29
+ datadog_lambda-8.120.0.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
30
+ datadog_lambda-8.120.0.dist-info/RECORD,,