-
Notifications
You must be signed in to change notification settings - Fork 839
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
Add include_trace_context property to logger builder #5366
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,8 @@ | |
|
||
package io.opentelemetry.api.logs; | ||
|
||
import io.opentelemetry.context.Context; | ||
|
||
/** | ||
* Builder class for creating {@link Logger} instances. | ||
* | ||
|
@@ -32,6 +34,14 @@ public interface LoggerBuilder { | |
*/ | ||
LoggerBuilder setInstrumentationVersion(String instrumentationScopeVersion); | ||
|
||
/** | ||
* Specify that emitted log records SHOULD NOT automatically include trace context from the {@link | ||
* Context#current()}. | ||
* | ||
* @return this | ||
*/ | ||
LoggerBuilder excludeTraceContext(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the name of this seems weird to me... since it's only about the span context, not the trace as a whole. 🤔 Is this something that should be adjusted in the spec? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This one is a bit weird. SpanContext shows up in the trace API specification, and in our API, yet the spec log data model refers to these fields as "Trace Context Fields". I can argue both side of this: In favor of trace context:
In favor of span context:
Given that the log data model is stable, can we change the log data model to refer to "Span Context Fields" instead of trace context fields? If so, we could / should change this to @tigrannajaryan curious to get your thoughts on this. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we have been using Trace Context and Span Context interchangeably a lot. Span Context is probably a slightly more accurate term since it matters which span in a trace we are referring to from a log. I don't mind renaming this in the spec and in the data model and I don't think it is a breaking change, to me it is just a terminology clarification, we should be able to do it and there are no functional changes. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Actually, one thing that may prevent us from doing it is that we consider it to be valid for a Log Record to reference a trace_id but have no associated span_id. You won't encounter it in Otel-generated data but some weird external data sources like this may be possible so we allowed for it in the data model. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
That's been my experience as well. Here are usage of trace context, tracecontext, span context and spancontext in the specification. I don't feel strongly either way about this one. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If span context and trace context are used interchangeably, its probably not a big deal for otel java to name this There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. how about just "excludeContext" in case we might want to also start pulling in baggage or something later? |
||
|
||
/** | ||
* Gets or creates a {@link Logger} instance. | ||
* | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if we should say "span context" rather than "trace context" (since I don't think that's a thing outside of the W3C propagator). Also, should we include a link to the
SpanContext
class in the javadoc for completeness?