Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow Adding Custom Span Attributes Before startSpan() #63

Open
tboonIV opened this issue Nov 1, 2023 · 2 comments
Open

Allow Adding Custom Span Attributes Before startSpan() #63

tboonIV opened this issue Nov 1, 2023 · 2 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@tboonIV
Copy link

tboonIV commented Nov 1, 2023

Describe the feature

In order to use OpenTelemetry Head Sampling based on specific data information, I can extract the data upfront and set into Span Attribute before startSpan() for Head Sampling working with my custom Attribute.

tracer.spanBuilder("my.class")
      .setAttribute("custom", "123")
      .startSpan();

But in Vertx OpenTelemetry Tracing, there is no way for me to configure or intercept how to insert my own Attributes into Span before startSpan().

Using Span.current() is not working for me as the Span only initialize in Vertx low level implementation when request is received.

For what I observe, the TagExtractor used for Attributes building and it's fixed from Vert.x core.
https://github.com/eclipse-vertx/vertx-tracing/blob/master/vertx-opentelemetry/src/main/java/io/vertx/tracing/opentelemetry/OpenTelemetryTracer.java#L148-L154
https://github.com/eclipse-vertx/vert.x/blob/3e9d5d151e0bb91825fb214d94e72f645c0d6e60/src/main/java/io/vertx/core/http/impl/HttpUtils.java#L69-L163

Will be greats if we can have some control the Span Attributes before it start, so Head Sampling can be much useful.

Use cases

We have the data before it sent out as request and wanted to use it to perform OpenTelemetry Trace filtering.

Contribution

I may try to contribute but need some insight which is best approach to implement this.

@tboonIV tboonIV added the enhancement New feature or request label Nov 1, 2023
@tsegismont
Copy link
Contributor

What kind of attributes do you need to add? Computed on startup or when a request/message is received?

@tsegismont tsegismont added the help wanted Extra attention is needed label Nov 3, 2023
@tboonIV
Copy link
Author

tboonIV commented Nov 3, 2023

What kind of attributes do you need to add? Computed on startup or when a request/message is received?

When a request/message is received.
String value for now I want to insert into, which will use for head sampling.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants