tracing: add baggage methods to Tracing::Span#12260
tracing: add baggage methods to Tracing::Span#12260mattklein123 merged 20 commits intoenvoyproxy:masterfrom
Conversation
Signed-off-by: Matthew Grossman <matthewryangrossman@gmail.com>
Signed-off-by: Matthew Grossman <matthewryangrossman@gmail.com>
Signed-off-by: Matthew Grossman <matthewryangrossman@gmail.com>
…th-baggage Signed-off-by: Matthew Grossman <matthewryangrossman@gmail.com>
Signed-off-by: Matthew Grossman <matthewryangrossman@gmail.com>
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.
What's the difference with setTag?
There was a problem hiding this comment.
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 <matthewryangrossman@gmail.com>
Signed-off-by: Matthew Grossman <matthewryangrossman@gmail.com>
LisaLudique
left a comment
There was a problem hiding this comment.
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.
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.
you could even log an error saying baggage isn't supported similar to
There was a problem hiding this comment.
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.
I left comments for the spans that don't support baggage (opencensus, xray) and a TODO for zipkin
mattklein123
left a comment
There was a problem hiding this comment.
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.
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 <matthewryangrossman@gmail.com>
Signed-off-by: Matthew Grossman <matthewryangrossman@gmail.com>
Signed-off-by: Matthew Grossman <matthewryangrossman@gmail.com>
Signed-off-by: Matthew Grossman <matthewryangrossman@gmail.com>
Signed-off-by: Matthew Grossman <matthewryangrossman@gmail.com>
Signed-off-by: Matthew Grossman <matthewryangrossman@gmail.com>
Signed-off-by: Matthew Grossman <matthewryangrossman@gmail.com>
Signed-off-by: Matthew Grossman <matthewryangrossman@gmail.com>
|
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 <matthewryangrossman@gmail.com>
Signed-off-by: Matthew Grossman <matthewryangrossman@gmail.com>
Signed-off-by: Matthew Grossman <matthewryangrossman@gmail.com>
mattklein123
left a comment
There was a problem hiding this comment.
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.
nit: just inline this above.
fadce22 to
adcf01e
Compare
Signed-off-by: Jake Kaufman <jkaufman@lyft.com>
adcf01e to
a277e37
Compare
|
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?