AWS Instrumenting doesn't work when AWS DynamoDb Client is created in a DI class #1953
Labels
bug
Something isn't working
comp:instrumentation.aws
Things related to OpenTelemetry.Instrumentation.AWS
Component
OpenTelemetry.Instrumentation.AWS
Package Version
Runtime Version
net8.0
Description
I want to trace a call to DynamoDB in Xray via an OpenTelemetry collector. The Instrumentation did not recoginze it as an AWS SDK call, but as a HTTP Request. This only happens when creating the AmazonDBClient instance in a dedicated DependencyInjection class.
Steps to Reproduce
ProjectA starts the App and does the tracing with all of its instrumenting, and it calls a service method of Project B which for example sends a request to dynamo. Project B is a simple project reference, but has a DependencyInjection Extension to create a Service/Repository instance (to be called by ProjectA). When an AmazonDynamoDBClient is created in that Extension method (and registered as a Singleton to be injected in the repository class), any calls from this client are not registered by the aws instrumention library. In that case it is only registered as a HTTP request.
An example of a DI Extension method can look like this:
The repository/service class:
When I create the client directly in the Repository/Service class, everything works as expected.
Expected Result
Actual Result
Additional Context
I don't know if this is a bug tbh or if it's just how it is by design, but i wanted to share these findings with you:)
The text was updated successfully, but these errors were encountered: