Skip to content

Commit 3058281

Browse files
mariojonkeocelotl
andauthored
botocore: Add DynamoDB extension (open-telemetry#735)
* botocore: Add dynamodb extension * extract addtional DynamoDB specific attributes according to the spec * move DynamoDB tests to separate test module * changelog * add license info Co-authored-by: Diego Hurtado <[email protected]>
1 parent bf41b2e commit 3058281

File tree

8 files changed

+975
-52
lines changed

8 files changed

+975
-52
lines changed

CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ automatically by the auto instrumentor.
1313
([#745](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/745))
1414
- `opentelemetry-instrumentation-pika` Bugfix use properties.headers. It will prevent the header injection from raising.
1515
([#740](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/740))
16+
- `opentelemetry-instrumentation-botocore` Add extension for DynamoDB
17+
([#735](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/735))
1618

1719
## [1.6.0-0.25b0](https://github.com/open-telemetry/opentelemetry-python/releases/tag/v1.6.0-0.25b0) - 2021-10-13
1820
### Added

instrumentation/opentelemetry-instrumentation-botocore/src/opentelemetry/instrumentation/botocore/__init__.py

-9
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,6 @@ def _patched_api_call(self, original_func, instance, args, kwargs):
214214
if BotocoreInstrumentor._is_lambda_invoke(call_context):
215215
BotocoreInstrumentor._patch_lambda_invoke(call_context.params)
216216

217-
_set_api_call_attributes(span, call_context)
218217
_safe_invoke(extension.before_service_call, span)
219218
self._call_request_hook(span, call_context)
220219

@@ -261,14 +260,6 @@ def _call_response_hook(
261260
)
262261

263262

264-
def _set_api_call_attributes(span, call_context: _AwsSdkCallContext):
265-
if not span.is_recording():
266-
return
267-
268-
if "TableName" in call_context.params:
269-
span.set_attribute("aws.table_name", call_context.params["TableName"])
270-
271-
272263
def _apply_response_attributes(span: Span, result):
273264
if result is None or not span.is_recording():
274265
return

instrumentation/opentelemetry-instrumentation-botocore/src/opentelemetry/instrumentation/botocore/extensions/__init__.py

+15
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
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+
115
import importlib
216
import logging
317

@@ -18,6 +32,7 @@ def loader():
1832

1933

2034
_KNOWN_EXTENSIONS = {
35+
"dynamodb": _lazy_load(".dynamodb", "_DynamoDbExtension"),
2136
"sqs": _lazy_load(".sqs", "_SqsExtension"),
2237
}
2338

0 commit comments

Comments
 (0)