-
Notifications
You must be signed in to change notification settings - Fork 74
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
Add support for grpc tracing header. #503
Conversation
@bogdandrutu could you fix the code format Checking coding styles. You can run script/robot-style to check it. We are using clang-3.8.0 |
tc[kTraceIdFieldIdPos] = 0; | ||
uint64_t tid_hi, tid_lo; | ||
sscanf(trace_->trace_id().c_str(), "%016lx%016lx", &tid_hi, &tid_lo); | ||
tid_hi = __builtin_bswap64(tid_hi); |
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.
Do we assume always running in big endian. probably it is better not to do that.
Beside, I don't like to use builtin functions, not sure if it will break when you upgrade compiler.
private: | ||
std::unique_ptr<google::devtools::cloudtrace::v1::Trace> trace_; | ||
google::devtools::cloudtrace::v1::TraceSpan *root_span_; | ||
std::string options_; | ||
std::string original_trace_context_; |
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 don't see this is used.
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.
Removed. Thanks.
} else { | ||
// Set grpc trace context header to backend. | ||
Status status = | ||
request()->AddHeaderToBackend(kGRpcTraceContextHeader, trace_context); |
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.
Can we combine two AddHeaderToBackend() calls into one?
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.
Done.
Made progress on being able to build and run clang-format in a docker image, I cannot run the nginx tests (I will spend some time on that). I have some questions:
|
|
@qiwzhang @bogdandrutu
If the backend is gRPC, I would expect the |
@bogdandrutu this is the feature: auto detect backend protocol use grpc-trace-bin or x-cloud-trace-context properly. I remember you were about to finish this task. What is your plan? |
I used a separate issue to track it: #627 |
The encoding is defined here:
https://github.com/census-instrumentation/opencensus-specs/blob/master/encodings/BinaryEncoding.md#trace-context