-
Notifications
You must be signed in to change notification settings - Fork 717
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Reads and writes gRPC trace and tags binary metadata #688
Conversation
I need to add an interop test to prove this actually works cc @bogdandrutu |
e4b4b58
to
7ef4a57
Compare
note this will be refactored to be optional behavior |
if (current != null) current.close(); | ||
} | ||
|
||
@Test public void readsPropagatedSpan() throws Exception { |
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.
here's the test that shows we are participating in the same trace
4d211ef
to
0712a35
Compare
added censusPropagationEnabled property and client+server tests |
going to add tags propagation as well, as we can lose it otherwise.. |
0712a35
to
d7b12c2
Compare
refactored to not drop tag context |
not-dropping is probably not good enough, as the last upstream part of the tag context should be replaced.. |
d7b12c2
to
870683a
Compare
ok rewrote everything. tags now works |
spanId = readLong(bytes, pos); | ||
pos += 8; | ||
} else { | ||
logger.fine("Invalid input: expected span ID at offset " + pos); |
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.
self-note: kill all these string cats as they shouldn't happen unless fine is enabled
6807937
to
b156ccb
Compare
4e24b36
to
bb000e1
Compare
|
||
To enable this feature, set `grpcPropagationFormatEnabled` which is off | ||
by default: | ||
```java |
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.
To give most flexibility I made this a feature flag similar to how tracing is still a flag in gRPC
going to release this tomorrow unless screams to the contrary |
This prefers the OpenCensus binary formatted trace header, falling back to Brave defaults if absent, upon server requests. On the client side, both are written. This allows interop with gRPC services that don't use B3 (for example, the default census module). This also acknowledges that the OpenCensus binary format is fairly contained within gRPC, so doesn't need to become a top-level propagation format, for example used with non-gRPC services as yet. Redundantly encoding this format has some cost to it, notable 14 character header name "grpc-trace-bin" and the 38 character base64 encoded binary context value. This also writes "grpc-tags-bin". Note that this only allows black-box interop with Census. It does not (yet) interop with census in the same process as Brave. However, this should be a helpful step to those especially currently using Brave, but trying out Census for non-java services.
bb000e1
to
ea69c49
Compare
gRPC Propagation Format (Census interop)
gRPC defines a binary encoded propagation format which is implemented
by OpenCensus instrumentation. When this is
the case, incoming requests will have two metadata keys "grpc-trace-bin"
and "grpc-tags-bin".
When enabled, this component can extract trace contexts from these
metadata and also write the same keys on outgoing calls. This allows
transparent interop when both census and brave report data to the same
tracing system.
To enable this feature, set
grpcPropagationFormatEnabled
which is offby default:
Warning: the format of both "grpc-trace-bin" and "grpc-tags-bin" are
version 0. As such, consider this feature experimental.
notes:
This allows interop with gRPC services that don't use B3 (for example,
the default census module). This also acknowledges that the OpenCensus
binary format is fairly contained within gRPC, so doesn't need to become
a top-level propagation format, for example used with non-gRPC services
as yet.
Redundantly encoding this format has some cost to it, notable 14
character header name "grpc-trace-bin" and the 38 character base64
encoded binary context value.
Note that this only allows black-box interop with Census. It does not
(yet) interop with census in the same process as Brave. However, this
should be a helpful step to those especially currently using Brave, but
trying out Census for non-java services.
See #626