opentelemetry-instrumentation-botocore 0.56b0__py3-none-any.whl → 0.58b0__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.
@@ -35,6 +35,7 @@ _KNOWN_EXTENSIONS = {
35
35
  "bedrock-runtime": _lazy_load(".bedrock", "_BedrockRuntimeExtension"),
36
36
  "dynamodb": _lazy_load(".dynamodb", "_DynamoDbExtension"),
37
37
  "lambda": _lazy_load(".lmbd", "_LambdaExtension"),
38
+ "stepfunctions": _lazy_load(".sfns", "_StepFunctionsExtension"),
38
39
  "sns": _lazy_load(".sns", "_SnsExtension"),
39
40
  "sqs": _lazy_load(".sqs", "_SqsExtension"),
40
41
  }
@@ -0,0 +1,58 @@
1
+ # Copyright The OpenTelemetry Authors
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+ from opentelemetry.instrumentation.botocore.extensions.types import (
15
+ _AttributeMapT,
16
+ _AwsSdkExtension,
17
+ _BotocoreInstrumentorContext,
18
+ _BotoResultT,
19
+ )
20
+ from opentelemetry.semconv._incubating.attributes.aws_attributes import (
21
+ AWS_STEP_FUNCTIONS_ACTIVITY_ARN,
22
+ AWS_STEP_FUNCTIONS_STATE_MACHINE_ARN,
23
+ )
24
+ from opentelemetry.trace.span import Span
25
+
26
+
27
+ class _StepFunctionsExtension(_AwsSdkExtension):
28
+ @staticmethod
29
+ def _set_arn_attributes(source, target, setter_func):
30
+ """Helper to set ARN attributes if they exist in source."""
31
+ activity_arn = source.get("activityArn")
32
+ if activity_arn:
33
+ setter_func(target, AWS_STEP_FUNCTIONS_ACTIVITY_ARN, activity_arn)
34
+
35
+ state_machine_arn = source.get("stateMachineArn")
36
+ if state_machine_arn:
37
+ setter_func(
38
+ target, AWS_STEP_FUNCTIONS_STATE_MACHINE_ARN, state_machine_arn
39
+ )
40
+
41
+ def extract_attributes(self, attributes: _AttributeMapT):
42
+ self._set_arn_attributes(
43
+ self._call_context.params,
44
+ attributes,
45
+ lambda target, key, value: target.__setitem__(key, value),
46
+ )
47
+
48
+ def on_success(
49
+ self,
50
+ span: Span,
51
+ result: _BotoResultT,
52
+ instrumentor_context: _BotocoreInstrumentorContext,
53
+ ):
54
+ self._set_arn_attributes(
55
+ result,
56
+ span,
57
+ lambda target, key, value: target.set_attribute(key, value),
58
+ )
@@ -24,6 +24,10 @@ from opentelemetry.instrumentation.botocore.extensions.types import (
24
24
  _AwsSdkCallContext,
25
25
  _AwsSdkExtension,
26
26
  _BotocoreInstrumentorContext,
27
+ _BotoResultT,
28
+ )
29
+ from opentelemetry.semconv._incubating.attributes.aws_attributes import (
30
+ AWS_SNS_TOPIC_ARN,
27
31
  )
28
32
  from opentelemetry.semconv.trace import (
29
33
  MessagingDestinationKindValues,
@@ -161,6 +165,9 @@ class _SnsExtension(_AwsSdkExtension):
161
165
 
162
166
  def extract_attributes(self, attributes: _AttributeMapT):
163
167
  attributes[SpanAttributes.MESSAGING_SYSTEM] = "aws.sns"
168
+ topic_arn = self._call_context.params.get("TopicArn")
169
+ if topic_arn:
170
+ attributes[AWS_SNS_TOPIC_ARN] = topic_arn
164
171
 
165
172
  if self._op:
166
173
  self._op.extract_attributes(self._call_context, attributes)
@@ -170,3 +177,16 @@ class _SnsExtension(_AwsSdkExtension):
170
177
  ):
171
178
  if self._op:
172
179
  self._op.before_service_call(self._call_context, span)
180
+
181
+ def on_success(
182
+ self,
183
+ span: Span,
184
+ result: _BotoResultT,
185
+ instrumentor_context: _BotocoreInstrumentorContext,
186
+ ):
187
+ if not span.is_recording():
188
+ return
189
+
190
+ topic_arn = result.get("TopicArn")
191
+ if topic_arn:
192
+ span.set_attribute(AWS_SNS_TOPIC_ARN, topic_arn)
@@ -12,4 +12,4 @@
12
12
  # See the License for the specific language governing permissions and
13
13
  # limitations under the License.
14
14
 
15
- __version__ = "0.56b0"
15
+ __version__ = "0.58b0"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: opentelemetry-instrumentation-botocore
3
- Version: 0.56b0
3
+ Version: 0.58b0
4
4
  Summary: OpenTelemetry Botocore instrumentation
5
5
  Project-URL: Homepage, https://github.com/open-telemetry/opentelemetry-python-contrib/tree/main/instrumentation/opentelemetry-instrumentation-botocore
6
6
  Project-URL: Repository, https://github.com/open-telemetry/opentelemetry-python-contrib
@@ -19,9 +19,9 @@ Classifier: Programming Language :: Python :: 3.12
19
19
  Classifier: Programming Language :: Python :: 3.13
20
20
  Requires-Python: >=3.9
21
21
  Requires-Dist: opentelemetry-api~=1.30
22
- Requires-Dist: opentelemetry-instrumentation==0.56b0
22
+ Requires-Dist: opentelemetry-instrumentation==0.58b0
23
23
  Requires-Dist: opentelemetry-propagator-aws-xray~=1.0
24
- Requires-Dist: opentelemetry-semantic-conventions==0.56b0
24
+ Requires-Dist: opentelemetry-semantic-conventions==0.58b0
25
25
  Provides-Extra: instruments
26
26
  Requires-Dist: botocore~=1.0; extra == 'instruments'
27
27
  Description-Content-Type: text/x-rst
@@ -2,18 +2,19 @@ opentelemetry/instrumentation/botocore/__init__.py,sha256=6GGOoQveHmR8n748grJWEw
2
2
  opentelemetry/instrumentation/botocore/environment_variables.py,sha256=c1lrIEj5wwxZwLd5ppJsfGADBfQLnb_HuxXDLv7ul6s,114
3
3
  opentelemetry/instrumentation/botocore/package.py,sha256=6xvfRpU_C3wlSO6pto7MhGtkPoCHDEiRO_Fh4DiC_50,622
4
4
  opentelemetry/instrumentation/botocore/utils.py,sha256=dM5LW5PjIdErBFESyxh6b8oBvbmQ7dPyYOn1YLOUFaQ,1191
5
- opentelemetry/instrumentation/botocore/version.py,sha256=Lt3ez1q5jzk4LG8aTMzoNp4bUxxWBqofY7vWXcRBByA,608
6
- opentelemetry/instrumentation/botocore/extensions/__init__.py,sha256=IqMWsCI0HL8gvL8-0Svn9Rp7dz2HKMcIuhRRM0twmCU,1857
5
+ opentelemetry/instrumentation/botocore/version.py,sha256=ffP-oEEHLyxQqazhPgp7CuNbVtp_sjb1Mo2_zNZb-QU,608
6
+ opentelemetry/instrumentation/botocore/extensions/__init__.py,sha256=ryeO-_5Oe9tEP-EFHgBdicYN94ySdm8leUnLjyj63Kg,1926
7
7
  opentelemetry/instrumentation/botocore/extensions/_messaging.py,sha256=ca2Uwyb1vxWu5qUkKTlfn9KJFN6k8HOTrrBYvwX4WzA,1636
8
8
  opentelemetry/instrumentation/botocore/extensions/bedrock.py,sha256=6voYLFeecQwyCyBJIC6n78a6jKVevs28YK-2EjNG9-c,37899
9
9
  opentelemetry/instrumentation/botocore/extensions/bedrock_utils.py,sha256=Hn7i2aUJ9WhypYdn5sD8uwbrNObyMDS-6rvtYrJBYwQ,23717
10
10
  opentelemetry/instrumentation/botocore/extensions/dynamodb.py,sha256=cmTzHnLCO731v8L5wN-rPRyVgQHmRvH3tuG5wrFhqyA,13745
11
11
  opentelemetry/instrumentation/botocore/extensions/lmbd.py,sha256=mqPbgwDFy3XYg-pLo6A6eNu0iKSGa2-tPLwroJDuavY,4253
12
- opentelemetry/instrumentation/botocore/extensions/sns.py,sha256=MfppfL91tAbAjp6CIiqvYIuXQRq-PeIYbB1ZKWO5kW4,5334
12
+ opentelemetry/instrumentation/botocore/extensions/sfns.py,sha256=z0bQ-CRZpZTfT2d7OXifs3RdYeBA7bzNCFNWFvWVl1E,2051
13
+ opentelemetry/instrumentation/botocore/extensions/sns.py,sha256=JVzS8D7T7XmaR5TSgLczm7Y2cQfahzM_wmN8MMMo6EM,5923
13
14
  opentelemetry/instrumentation/botocore/extensions/sqs.py,sha256=9_LjlzQ0Sg92hgaL8P31cbpq_C71qCTucjj0SX1Ct5o,2916
14
15
  opentelemetry/instrumentation/botocore/extensions/types.py,sha256=jCIJXt0Zvdn2qVwX6bLUaCLgBPy6XyJ-nYEwurxAZo8,6681
15
- opentelemetry_instrumentation_botocore-0.56b0.dist-info/METADATA,sha256=1RIQDU_NWL0qnm52hT1uGnYtgh7fPOj9X07dVoEKgR0,3051
16
- opentelemetry_instrumentation_botocore-0.56b0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
17
- opentelemetry_instrumentation_botocore-0.56b0.dist-info/entry_points.txt,sha256=v5hzQbZMJ61JuhBNq5jHYAapvv3C_486h9CTqxlkUTM,100
18
- opentelemetry_instrumentation_botocore-0.56b0.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
19
- opentelemetry_instrumentation_botocore-0.56b0.dist-info/RECORD,,
16
+ opentelemetry_instrumentation_botocore-0.58b0.dist-info/METADATA,sha256=AwoD8-juEnwEZPKTWzRDbz84A6nAEDfV8wVCwEFTurw,3051
17
+ opentelemetry_instrumentation_botocore-0.58b0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
18
+ opentelemetry_instrumentation_botocore-0.58b0.dist-info/entry_points.txt,sha256=v5hzQbZMJ61JuhBNq5jHYAapvv3C_486h9CTqxlkUTM,100
19
+ opentelemetry_instrumentation_botocore-0.58b0.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
20
+ opentelemetry_instrumentation_botocore-0.58b0.dist-info/RECORD,,