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

Remove warnings about Span.UpdateName #754

Merged
merged 3 commits into from
Aug 3, 2020
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 8 additions & 9 deletions specification/trace/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -415,6 +415,11 @@ clearing the previous value and dropping the attribute key from the set of attri
Note that the OpenTelemetry project documents certain ["standard
attributes"](semantic_conventions/README.md) that have prescribed semantic meanings.

Note that [samplers](sdk.md#sampler) can only consider information already
present during span creation. Any changes done later, including new or changed
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this is accurate, especially given open-telemetry/oteps#115

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This reflects current state of the spec:

Sampler interface allows users to create custom samplers which will return a sampling SamplingResult based on information that is typically available just before the Span was created.

I cannot propose a PR to spec based on not yet merged OTEP, can I?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then why remove the warning? Until that OTEP is implemented, samplers cannot react to changes in the span name, can they?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That was discussed at length in #506 . Span.updateName has legit use-cases and having this warning confuses people: "why have a method but discourage to use it?" We cannot remove the method, thus I propose to remove the warning.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For me, the discussion in OTEP 115 clarifies that there are two distinct kinds of sampling decision. There is a head sampling decision that is irrevocable, made when the span starts, but this is only a provisional decision to begin gathering a span. There is still a tail sampling decision to be made that can incorporate new information, and we shouldn't mix terms and call these both a sampling decision.

This conversation appears to relate to the first decision, which practically by definition can't be changed because it's history by the time any new information arrives. I would just be clear that when we say "Sampler" (capital "S") we are referring to an initial decision that can't be revoked, not a final decision.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with that. And link here to "samplers" as defined in SDK spec. I can change "sampler" to "Samplers" if that will make it clearer :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, @yurishkuro , I would like to point your attention that this PR solves issue #468 which is triaged for GA and assigned P1. If you disagree with this, that issue would be a better place to try and change this decision.

attributes, cannot change their decisions.


#### Add Events

A `Span` MUST have the ability to add events. Events have a time associated
Expand Down Expand Up @@ -464,15 +469,9 @@ The Span interface MUST provide:
Updates the `Span` name. Upon this update, any sampling behavior based on `Span`
name will depend on the implementation.

It is highly discouraged to update the name of a `Span` after its creation.
`Span` name is often used to group, filter and identify the logical groups of
spans. And often, filtering logic will be implemented before the `Span` creation
for performance reasons. Thus the name update may interfere with this logic.

The function name is called `UpdateName` to differentiate this function from the
regular property setter. It emphasizes that this operation signifies a major
change for a `Span` and may lead to re-calculation of sampling or filtering
decisions made previously depending on the implementation.
Note that [samplers](sdk.md#sampler) can only consider information already
iNikem marked this conversation as resolved.
Show resolved Hide resolved
present during span creation. Any changes done later, including updated span
name, cannot change their decisions.

Alternatives for the name update may be late `Span` creation, when Span is
started with the explicit timestamp from the past at the moment where the final
Expand Down