Skip to content

Add OpenTelemetry instrumentation package with DynamoDB EF Core tracing #196

Description

@j-d-ha

Problem

The provider now has EF-style diagnostics for DynamoDB request lifecycle events, but generic OpenTelemetry.Instrumentation.EntityFrameworkCore is relational/IDbCommand-oriented and does not cover this provider.

Applications can use AWS SDK instrumentation for low-level AWS/HTTP spans, but that does not expose EF/provider concepts such as PartiQL request shape, page fetches, consumed capacity, scan-like diagnostics, or batch statement errors.

Goal

Add a separate NuGet package, similar in shape to OpenTelemetry.Instrumentation.EntityFrameworkCore, that converts DynamoDB EF Core provider diagnostics into OpenTelemetry traces.

Package name candidates:

  • OpenTelemetry.Instrumentation.EntityFrameworkCore.DynamoDb
  • EntityFrameworkCore.DynamoDb.OpenTelemetry

Scope

  • Create a new instrumentation package project.
  • Add tracing registration extensions for OpenTelemetry.
  • Subscribe to provider DiagnosticSource events emitted by EntityFrameworkCore.DynamoDb.
  • Create Activity spans for DynamoDB provider operations.
  • Add tests using ActivityListener and/or OpenTelemetry test exporters.
  • Document application setup and how this differs from generic EF Core instrumentation and AWS SDK instrumentation.

Expected API Shape

services.AddOpenTelemetry()
    .WithTracing(builder => builder
        .AddDynamoDbEntityFrameworkCoreInstrumentation());

Tracing Behavior

Create client spans for provider-level DynamoDB operations:

  • ExecuteStatement
  • ExecuteTransaction
  • BatchExecuteStatement

Span data should include stable, low-cardinality DynamoDB/EF context when available:

  • db.system.name = "aws.dynamodb"
  • db.operation.name
  • table name when known
  • index name when known
  • statement count
  • limit
  • next-token presence
  • seed-token presence
  • AWS request id
  • consumed capacity when returned
  • item count / page count where applicable
  • batch statement error count
  • DbContext type

Do not record parameter values or key values by default.

Relationship To Existing Diagnostics

This package should consume provider DiagnosticSource payloads rather than pretending the provider emits relational DbCommand events.

Relevant provider payloads include:

  • DynamoExecuteStatementEventData
  • DynamoExecuteStatementExecutedEventData
  • DynamoExecuteStatementFailedEventData
  • DynamoPartiQlWriteRequestEventData
  • DynamoPartiQlWriteRequestExecutedEventData
  • DynamoPartiQlWriteRequestFailedEventData
  • DynamoBatchStatementErrorsEventData

Acceptance Criteria

  • New instrumentation NuGet package project exists.
  • Package exposes tracing registration extension methods.
  • Provider diagnostic events produce OpenTelemetry activities.
  • Successful requests end spans with success status.
  • Failed requests record exception and set error status.
  • Span names and tags are stable and low-cardinality.
  • Sensitive values are not recorded by default.
  • Tests verify span names, kind, tags, status, and exception behavior.
  • Docs show app setup and clarify difference from generic EF Core OTEL instrumentation and AWS SDK instrumentation.

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions