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

New spanids should always be created for server spans. #367

Conversation

toumorokoshi
Copy link
Member

Fixes #359. Standardizing the behavior of the creation of server span
ids helps ensure server behavior on several areas including exporters, samplers, and backend ingestion systems will be the same regardless of the language used.

In practice, the negative consequences of SpanID being different for
client and server in storage systems that expect it are minimal,
at worst appearing as separate spans.

Fixes open-telemetry#359. Standardizing the behavior of the creation of server span
ids helps ensure server behavior will be the same regardless of the
language used.

In practice, the negative consequences of SpanID being different for
client and server in storage systems that expect it are minimal,
at worst appearing as separate spans.
@@ -196,6 +196,10 @@ For example, `http.server_name` has shown great value in practice, as bogus HTTP

It is strongly recommended to set `http.server_name` to allow associating requests with some logical server entity.

### New span ids should be generated for server spans

Some span propagation specifications such as B3 dictate that the client and server spans share a span id. OpenTelemetry SDKs should create new span ids for all server spans, regardless of format.
Copy link
Member

Choose a reason for hiding this comment

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

As this will primarily affect users of Zipkin backend, we should get opinions from its maintainers. A more compatible approach would be along the lines of "SDKs should support an opt-in configuration to allow sharing of client and server span IDs. When not opted-in, the SDK should create a new span ID when creating a child of a remote parent".

Also notice "a child of a remote parent" wording, which is more general than "server spans".

cc @adriancole (not sure how to mention all maintainers)

Copy link
Member Author

Choose a reason for hiding this comment

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

Thank you! I wasn't sure about the right way to get them involved. Thanks.

Good not on the wording, will fix depending on how that conversation goes.

Copy link
Member

Choose a reason for hiding this comment

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

I think Zipkin added support to the backend to support different Span id between client and server.

Copy link
Member

Choose a reason for hiding this comment

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

Agreed with @yurishkuro.

As a precursor to enabling Zipkin, we may need to allow spans to be created with either a user-provided SpanContext or a split trace ID / span ID (i.e., set the trace ID as normal but use a provided span ID, or vice versa).

Copy link
Member Author

Choose a reason for hiding this comment

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

I think it's fine to change this to require (or "should") and opt-in configuration. I feel like it would be best to get weigh-in from a zipkin maintainer, but if I don't hear back in a day or so I'll change my PR.

Copy link
Member

Choose a reason for hiding this comment

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

@yurishkuro @toumorokoshi @iredelmeier I think here we should follow what the w3c standard says which is to create a new spanID.

I would not add a requirement right now to the SDK to support the opt-in mode unless someone asks for it, as I mentioned already Zipkin made the change to support a different span ID for the server more than 1y ago, so I am not sure we need to support that behavior at this point.

@Oberon00
Copy link
Member

Oberon00 commented Dec 3, 2019

I think as it currently stands, there is no technically no need for this PR. Reading the spec, it clearly says:

Spans encapsulate:

  • An immutable SpanContext that uniquely identifies the Span

(https://github.com/open-telemetry/opentelemetry-specification/blob/e6cd52d034c981ca4fcf896ccd7464e783589c0f/specification/api-tracing.md#span, bold added by me)

And then it goes on to state ways how spans are created. If we wanted to share span IDs, given the uniqueness-requirement, I think we would not be "creating new spans with a shared span ID" but rather "adopting/continuing an existing (remote) span specified by a span context".

@toumorokoshi
Copy link
Member Author

I think as it currently stands, there is no technically no need for this PR. Reading the spec, it clearly says:

Spans encapsulate:

  • An immutable SpanContext that uniquely identifies the Span

(https://github.com/open-telemetry/opentelemetry-specification/blob/e6cd52d034c981ca4fcf896ccd7464e783589c0f/specification/api-tracing.md#span, bold added by me)

Thanks, I had trouble finding that section! Reading through it, I understand there is an implicit requirement for SpanID to be unique by virtue of a SpanContext, that uniquely represents a Span, but I think it would be preferable to explicitly call this out. Especially since it's an implementation detail that differs between propagation formats.

How about I revise my PR and add a qualifying line there?

@tedsuo
Copy link
Contributor

tedsuo commented Dec 18, 2019

@toumorokoshi just reviewing this now, sorry for the delay.

My suggestion is that this is actually an implementation detail - if an SDK is configured to run in B3/Zipkin mode, it could choose to reuse the client SpanID and set the ParentSpanID according to the rules laid out in the B3 protocol.

If that configuration is incorrect for particular system, then that system should not be configured to use B3 in this manner. Instead it should use a different protocol, or use the alternate protocol suggested in B3 here: https://github.com/openzipkin/b3-propagation#why-is-parentspanid-propagated

Does that make sense? I'm not sure the spec needs to mandate how this works.

@tedsuo
Copy link
Contributor

tedsuo commented Dec 18, 2019

BTW, this guidance could get rolled into this PR: #380

@tedsuo tedsuo mentioned this pull request Dec 18, 2019
@jmacd
Copy link
Contributor

jmacd commented Jan 22, 2020

This PR states that we support the W3C specification, and is probably unnecessary. Can we close this without merging?

@toumorokoshi
Copy link
Member Author

I'll close this, for a couple good reasons:

  1. as everyone has mentioned the w3c spec calls for creating a new spanid serverside, and potentially zipkin may adjust on their side.
  2. I personally have no value for this feature, so probably not the right person to try to follow up on this.

@codefromthecrypt
Copy link

codefromthecrypt commented Jan 31, 2020 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make creating new spanids for server spans optional
8 participants