-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Implement W3C Correlation Context propagator #179
Implement W3C Correlation Context propagator #179
Conversation
What decides and when what keys/values need to be propagated ? Reading the linked doc I don't get a great feel beyond "user-defined baggage associated with the trace". Is that type of data likely to be different for each trace? Or is it something meant to be setup once or modified only irregularly? |
You could do something like this: https://github.com/sjkaris/opentelemetry-go/compare/feature/sk/w3s-correlation-ctx-prop...heroku:feature/sk/w3s-correlation-ctx-prop?expand=1 ^ ends up conforming the new propagator to the propagation.TextFormatPropagator interface. To do so, I needed to expand core.SpanContext to also contain a []core.KeyValue. This has a side effect of making core.SpanContext not comparable, which can be dealt with in most cases, but not all. One example of a place that change affects is that the experimental streamer uses span contexts as a map key, which the new core.SpanContext can't be used as (adding a Hash() string function to spanContext or equivalent can get around that. Thoughts? |
@sjkaris @freeformz Am I understanding the issue, at least? Also, @sjkaris I couldn't find what you mean by "doesn't allow for multiple same-valued keys"? @freeformz About the experimental SDK. Distributed context can't be "forgotten" by the streaming SDK the way all other state can. I believe we should maintain a |
@jmacd, yep I think you understand the issue. Just to re-state, from what I gathered at the SIG meeting, this PR should be changed such that we return both the Its poorly worded, but what I meant by "doesn't allow for multiple same-valued keys", is basically that the |
I would be interested to hear @freeformz thoughts on this as well though |
I don't know what happened at the SIG meeting unfortunately. I'd prefer to not to add another interface like the original PR did, but make an interface that works for all of these types of headers, possibly with optional secondary interfaces as needed. I am a bit worried about the question of needing to support multiple values for the same key. If that is a requirement then dctx.Map will need to be changed or can't be used for this. |
Separation of correlation context from observability is discussed here. As part of this discussion, the interface for propagators will change as well. May I suggest that we finish this PR with a single propagator that handles both, trace-context and distributed-context with following signature? inject(ctx context.Context, supplier Supplier)
extract(ctx, contex.Context, supplier Supplier) (SpanContext, dctx.Map) Regarding multiple values correlation context - As per the DistributedContext spec, a key can only have one value. So for now, if there are duplicate keys during extraction we either take the last or the first entry. Open an issue to resolve the multiple value support in the spec. |
Separation discussion URL: open-telemetry/oteps#42 |
thanks for posting the correct link. |
Sounds good, ill update this today. |
eadbb28
to
b99e571
Compare
correlationCtx.Foreach(func(kv core.KeyValue) bool { | ||
attrs = append(attrs, kv) | ||
return true | ||
}) |
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.
should this be appended to attributes or returned second argument. I believe 'Context Entries' refer to DistributedContext here. @jmacd , can you please confirm?
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.
Ah, I suspect you are right, this should be returned as the second arg.
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 open to improvements on this API.)
correlationCtx.Foreach(func(kv core.KeyValue) bool { | ||
attrs = append(attrs, kv) | ||
return true | ||
}) |
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 open to improvements on this API.)
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.
@sjkaris, LGTM. Can you please rebase?
f3728c5
to
bc37f3d
Compare
1eaf812
to
c138077
Compare
…/github.com/Shopify/sarama (#179) * Bump google.golang.org/grpc Bumps [google.golang.org/grpc](https://github.com/grpc/grpc-go) from 1.30.0 to 1.31.0. - [Release notes](https://github.com/grpc/grpc-go/releases) - [Commits](grpc/grpc-go@v1.30.0...v1.31.0) Signed-off-by: dependabot[bot] <[email protected]> * Auto-fix go.sum changes in dependent modules Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: dependabot[bot] <dependabot[bot]@users.noreply.github.com> Co-authored-by: Tyler Yahn <[email protected]>
#124
A couple open items on this PR.
I feel that the interface shouldn't take/return
[]core.KeyValue
, but was unsure what structure should be used in its place.tag.Map
(soon to be renamed todctx.Map
/distrubtedcontext.Map
) is a candidate, but doesn't allow for multiple same-valued keys as https://w3c.github.io/correlation-context/ states should be allowed.Properties defined in https://w3c.github.io/correlation-context/ are not handled very well, and its unclear to me what should be done with them.
Do we want a separate interface for Correlation Context propagation vs SpanContext propagation