-
Notifications
You must be signed in to change notification settings - Fork 897
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 Tracer operations specs. #105
Add Tracer operations specs. #105
Conversation
specification/tracing-api.md
Outdated
Note, the `SpanContext` object on the span population with | ||
the values that will allow correlation of telemetry is also a caller responsibility. | ||
|
||
#### `GetBinaryFormat`: returns the binary format of `Span`s. |
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.
Do we want this to be a Tracer method? It feels like a static method used by propagators.
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.
No because we want to allow different implementations for it. If no implementation is provided, API will provide a noop binary format for GetBinaryFormat
.
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.
Let's take a step back and consider the following questions:
- What is our definition of tracer? How do we decide if something belongs to a tracer or not? (e.g. do we think propagator belongs to the tracer? if we need two propagators, what shall we do?)
- If today we have
BinaryFormat
andHttpTextFormat
, tomorrow we discovered that we needMqttMetadataFormat
orYetAnotherFormat
, do we end up adding APIs toTracer
?
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 think this initially belongs to a Tracer
given that you are defining propagators for SpanContext
, which is tied to the tracing system - that being said, I'm curious about what to do if additional formats are needed (although I'm also curious about how common this is).
(Also, a related item: we had discussed the possibility of composite formats, in case you needed to use text-based formats, such as try B2
, then fallback to TraceContext
, then fallback to something else, etc).
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 think @reyang raised valid concerns. I wasn't in the previous discussions on propagators, but in OpenCensus we have an independent package trace.propagation
specifically for propagators. Also we allowed getting explicit formats via API calls, like getB3Format
vs. getTraceContextFormat
.
Anyway I filed #112 for further discussions.
|
||
Required parameters: | ||
|
||
- `SpanData` to be reported to all exporters. |
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.
Curious, if the purpose is to export the spandata, why not just call it "export"?
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.
My guess is the term export
is used elsewhere such as the exporter interfaces in SDK, and we don't want to overload it.
1ffa28b
to
320f63a
Compare
There should be no parameters. | ||
|
||
Returns the default `Span` that does nothing and has an invalid `SpanContext` if no | ||
`Span` is associated with the current context, otherwise the current `Span` from the context. |
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.
If there are more than one Tracer instantiated, potentially with different Resource definitions, can there be more than one current span? I would assume that there's a single current active span.
Therefore, I'm not sure why this should be a Tracer method. If there was an explicit Scope
type, as I think there should be, you'd be asking for Scope.Active()
.
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.
If there are more than one Tracer instantiated, potentially with different Resource definitions, can there be more than one current span? I would assume that there's a single current active span.
Agree having one active span makes more sense. Filed #108 for discussion about where the API should live.
|
||
The scope is exited when the returned object is closed. | ||
|
||
#### `SpanBuilder`: returns a `SpanBuilder` to create and start a new `Span`. |
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.
Looks like this (builder pattern) is not gonna applicable for all the languages (ex. NodeJS).
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.
This is being discussed at #37. Generally we're using builder pattern to specify which parameters are required when initializing and which can be set after initialization. IMO this doesn't mean all languages need to conform to the builder pattern.
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 have to say also in Python we won't be using the builder pattern - and given that enough languages won't be using this one, we maybe should probably change this so a builder is not mentioned here at all ;)
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'm good with replacing builder pattern in the specs and rephrasing it in a more language-agnostic way, as long as we make it clear which parameters are required/immutable vs. which can be mutated. I'd prefer to update it after we reach to an agreement on #37.
fc78453
to
37b4b24
Compare
specification/tracing-api.md
Outdated
|
||
Returns an object that defines a scope where the given `Span` will be set to the current context. | ||
|
||
The scope is exited when the returned object is closed. |
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.
Does it also restore the previous state after the scope is closed?
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.
That's correct, updated.
specification/tracing-api.md
Outdated
Returns the binary format for this implementation. If no implementation is provided | ||
then no-op implementation will be used. | ||
|
||
#### `GetHttpTextFormat`: returns the HTTP text format of `Span`s. |
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.
Does it return an object or an interface that injects/extracts span context? OR does it return the span context in that format?
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.
It returns the format interface. Updated to make it clear.
|
||
Required parameters: | ||
|
||
- The `Span` to be set to the current context. |
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.
If user passed in a span which has already been closed, what would happen? Unspecified behavior?
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 think so, yeah. This is responsibility of the user ;)
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 think SpanContext is available from completed Span. So the only effect would be that all subsequent spans and logs are associated with the Span. All attempts to add links and attributes to the current span will not succeed. But again, it may be legitimate use case to associate telemetry with the completed span
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.
This is responsibility of the user ;)
+1
17b60cd
to
6b774d3
Compare
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.
PTAL
|
||
Required parameters: | ||
|
||
- The `Span` to be set to the current context. |
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.
This is responsibility of the user ;)
+1
specification/tracing-api.md
Outdated
|
||
Returns an object that defines a scope where the given `Span` will be set to the current context. | ||
|
||
The scope is exited when the returned object is closed. |
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.
That's correct, updated.
specification/tracing-api.md
Outdated
Returns the binary format for this implementation. If no implementation is provided | ||
then no-op implementation will be used. | ||
|
||
#### `GetHttpTextFormat`: returns the HTTP text format of `Span`s. |
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.
It returns the format interface. Updated to make it clear.
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.
Looks good in general, we need to revisit the GetXyzFormat
, SpanBuilder
and GetActiveSpan
APIs later.
@SergeyKanzhelev Please help me merge this PR. Remaining issues will be discussed separately. |
Co-Authored-By: Mayur Kale <[email protected]>
* Add Tracer operations specs. Fixes open-telemetry#38. * recordSpanData should be async. * Fix typos. * Fix review comments. * Fix another typo. Co-Authored-By: Mayur Kale <[email protected]>
Signed-off-by: Bogdan Drutu <[email protected]> Co-authored-by: Carlos Alberto Cortez <[email protected]>
Signed-off-by: Bogdan Drutu <[email protected]> Co-authored-by: Carlos Alberto Cortez <[email protected]>
* Add Tracer operations specs. Fixes open-telemetry#38. * recordSpanData should be async. * Fix typos. * Fix review comments. * Fix another typo. Co-Authored-By: Mayur Kale <[email protected]>
Fixes #38.
Documents are based on Java API: https://github.com/open-telemetry/opentelemetry-java/blob/master/api/src/main/java/io/opentelemetry/trace/Tracer.java.