Skip to content

Commit

Permalink
botocore: Add DynamoDB extension (open-telemetry#735)
Browse files Browse the repository at this point in the history
* 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 <ocelotl@users.noreply.github.com>
  • Loading branch information
2 people authored and nicholasgribanov committed Oct 29, 2021
1 parent 8792ec7 commit f8181f5
Show file tree
Hide file tree
Showing 8 changed files with 975 additions and 52 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ automatically by the auto instrumentor.
([#745](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/745))
- `opentelemetry-instrumentation-pika` Bugfix use properties.headers. It will prevent the header injection from raising.
([#740](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/740))
- `opentelemetry-instrumentation-botocore` Add extension for DynamoDB
([#735](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/735))

## [1.6.0-0.25b0](https://github.com/open-telemetry/opentelemetry-python/releases/tag/v1.6.0-0.25b0) - 2021-10-13
### Added
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,6 @@ def _patched_api_call(self, original_func, instance, args, kwargs):
if BotocoreInstrumentor._is_lambda_invoke(call_context):
BotocoreInstrumentor._patch_lambda_invoke(call_context.params)

_set_api_call_attributes(span, call_context)
_safe_invoke(extension.before_service_call, span)
self._call_request_hook(span, call_context)

Expand Down Expand Up @@ -261,14 +260,6 @@ def _call_response_hook(
)


def _set_api_call_attributes(span, call_context: _AwsSdkCallContext):
if not span.is_recording():
return

if "TableName" in call_context.params:
span.set_attribute("aws.table_name", call_context.params["TableName"])


def _apply_response_attributes(span: Span, result):
if result is None or not span.is_recording():
return
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
# Copyright The OpenTelemetry Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import importlib
import logging

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


_KNOWN_EXTENSIONS = {
"dynamodb": _lazy_load(".dynamodb", "_DynamoDbExtension"),
"sqs": _lazy_load(".sqs", "_SqsExtension"),
}

Expand Down
Loading

0 comments on commit f8181f5

Please sign in to comment.