-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
tracing: add baggage methods to Tracing::Span #12260
tracing: add baggage methods to Tracing::Span #12260
Conversation
Signed-off-by: Matthew Grossman <[email protected]>
Signed-off-by: Matthew Grossman <[email protected]>
Signed-off-by: Matthew Grossman <[email protected]>
…th-baggage Signed-off-by: Matthew Grossman <[email protected]>
Signed-off-by: Matthew Grossman <[email protected]>
Signed-off-by: Matthew Grossman <[email protected]>
include/envoy/tracing/http_tracer.h
Outdated
* @param key baggage key | ||
* @param key baggage value | ||
*/ | ||
virtual void setBaggage(const std::string& key, const std::string& value) PURE; |
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.
What's the difference with setTag?
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.
baggage is persisted in the SpanContext
, which means that any subsequent spans can access data in the baggage (it gets injected/extracted across process boundaries). This is useful when you need to embed information that is available for the entirety of the request
more reading: https://opentracing.io/docs/overview/tags-logs-baggage/, https://github.com/opentracing/specification/blob/master/specification.md#set-a-baggage-item
Signed-off-by: Matthew Grossman <[email protected]>
Signed-off-by: Matthew Grossman <[email protected]>
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 so far, pending unit tests for the tracers and adding/updating documentation (it should be clear where baggage is/isn't supported)
void Span::setBaggage(const std::string&, const std::string&) {} | ||
|
||
std::string Span::getBaggage(const std::string&) { return std::string(); } |
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.
consider logging a warning here that this tracer doesn't support baggage (and likewise for the other tracers that do not support it)
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.
you could even log an error saying baggage isn't supported similar to
ENVOY_LOG(error, "RateLimitingSampler is not supported."); |
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.
A warning isn't safe in the data path. I would either do nothing and leave a TODO or have a stat for dropped baggage. Same elsewhere.
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 left comments for the spans that don't support baggage (opencensus, xray) and a TODO for zipkin
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.
Thanks for working on this! I will defer to @LisaLudique for initial review.
/wait
void Span::setBaggage(const std::string&, const std::string&) {} | ||
|
||
std::string Span::getBaggage(const std::string&) { return std::string(); } |
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.
A warning isn't safe in the data path. I would either do nothing and leave a TODO or have a stat for dropped baggage. Same elsewhere.
Signed-off-by: Matthew Grossman <[email protected]>
Signed-off-by: Matthew Grossman <[email protected]>
Signed-off-by: Matthew Grossman <[email protected]>
Signed-off-by: Matthew Grossman <[email protected]>
Signed-off-by: Matthew Grossman <[email protected]>
Signed-off-by: Matthew Grossman <[email protected]>
Signed-off-by: Matthew Grossman <[email protected]>
Signed-off-by: Matthew Grossman <[email protected]>
tuned up the PR with tests/comments/todos, tried to get the description to match the template as well. Might be worth reading that again since it's likely changed since last review. Do we need to express anywhere else that not all implementations of |
tests look good! I would suggest adding a section on baggage and delineating the level of support for each tracer in https://www.envoyproxy.io/docs/envoy/latest/intro/arch_overview/observability/tracing |
Signed-off-by: Matthew Grossman <[email protected]>
Signed-off-by: Matthew Grossman <[email protected]>
Signed-off-by: Matthew Grossman <[email protected]>
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.
LGTM with small comment. Thank you!
/wait
void Span::setBaggage(absl::string_view, absl::string_view) {} | ||
|
||
std::string Span::getBaggage(absl::string_view) { return std::string(); } |
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.
nit: just inline this above.
fadce22
to
adcf01e
Compare
Signed-off-by: Jake Kaufman <[email protected]>
adcf01e
to
a277e37
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.
Thanks!
thanks for the help in review! |
Commit Message: tracing: add baggage methods to Tracing::Span
Additional Description: references #11622: We want an envoy filter to be able to read information off of the OT baggage to guide some routing decisions. First step is exposing the functionality of the existing spans/tracers so we can access this baggage dict within the filters. Once this functionality is added to the
Tracing::Span
, we can access with the baggage info inside a filterRisk Level: Low: Small optional feature
Testing: Unit testing is added for all derived classes of
Tracing::Span
. All of the classes are noops exceptOpenTracingSpan
(test) and LightStep (test)Docs Changes: N/A for now, should something about baggage be added to tracing.rst?
Release Notes: think we need a note here?