Skip to content

otel spans not flushed in _after? #682

Open

Description

@vin

Expected Behavior

Spans from uncaught exceptions should still reliably reach datadog.

Actual Behavior

Many spans from uncaught errors are lost before they can be sent.

This needs further investigation, but I suspect it's because datadog_wrapper's _after method specifically flushes ddtrace-generated spans but not opentelemetry-api ones? Maybe it needs to also call TracerProvider.force_flush if applicable?

Specifications

  • Datadog Lambda Layer version: 86
  • Python version: 3.11.14

Stacktrace

Paste here

Activity

  1. purple4reina commented on Dec 29, 2025

    @purple4reina
    Contributor

    Hey @vin, thanks for alerting us to this issue. I'd love to take a closer look at it. Can you provide more details, and ideally a code example, about "spans from uncaught exceptions"? How are you creating these otel spans? How exactly are you instrumenting the app to initialize both datadog and otel tracers? Did you follow our recommended setup?

    With the information I have and the testing I've done to try to reproduce this, my first guess is that the problem is that you're trying to mix both the datadog python tracer and the otel python tracer. Does the issue still exist when you remove the datadog tracer?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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