open-telemetry / open-telemetry/opentelemetry-java

TraceInterceptors functionality to the SDK

Open
#5,669 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Feature Request
Dominant language
Java
Stars
2.5k
Forks
1k
Avg merge
3d 17h
Merged PRs (30d)
58

Description

Is your feature request related to a problem? Please describe.
Hello :)

Currently, we are in the process of migrating from DD (DataDog) instrumentation to Opentelemetry. During this migration, we have encountered a specific case where we want to implement TraceInterceptors. In other words, we want to add custom functionality at the end of a specific trace.

Here's a simple example: we would like to have a TraceInterceptor that collects the number of spans for that particular trace and then adds this number as an attribute to the root span. This is just an example

Datadog Instrumentation, provides that feature with the TraceInterceptor interface (Ref)

Is there something similar to the sdk that we can use to achieve the same functionality ?

Describe the solution you'd like
The solution that we would like is to have an Interface that we could utilize to: add our custom implementation at the end of a trace, and have all the information (Spans, SpanData etc) for the trace.

Describe alternatives you've considered
The alternative that we have considered is using the SpanProcessor. However its not possible to know when the Trace has ended as it applies only to spans.

Thanks in advance for your help, comments

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the SDK tracing APIs and the SpanProcessor alternative linked in the issue, then compare them with DataDog's TraceInterceptor interface. Determine how trace completion and access to spans or SpanData should be defined. Done means a reviewed SDK design or implementation that supports custom functionality after a trace ends.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
observability-sre
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.