-
Notifications
You must be signed in to change notification settings - Fork 121
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 trace ids to nginx log #33
Comments
I've been logging the headers as per nginx norm: It would be nice have the ability to log out the full trace(s) - or at least have access to the variables that might make those up. Are those available? If there's a better way to do this, that'd be great to see. Currently strategy: (
|
Does anyone have an example for jaeger trace id for the $opentracing_context_ ? |
@Sund3 did you work it out in the end? So if I am looking to log the trace IDs and I don't pass in any trace header in the request then I would expect this plugin to generate one for me. In order to log that trace ID generated by the plugin, can I just do this in the usual way, such as For that to be true, then I would assume the plugin works by adding a request header, as opposed to adding a proxied header or something? Is that correct? |
If you're using the map $http_traceparent $my_trace_id {
default "00000000000000000000000000000000";
~^00-(?<trace_id>[^-]+)-(?<parent_id>[^-]+)-(?<trace_flags>[0-9]+)$ "$trace_id";
}
map $http_traceparent $my_parent_id {
default "0000000000000000";
~^00-(?<trace_id>[^-]+)-(?<parent_id>[^-]+)-(?<trace_flags>[0-9]+)$ "$parent_id";
}
map $opentracing_context_traceparent $my_span_id {
default "0000000000000000";
~^00-(?<trace_id>[^-]+)-(?<parent_id>[^-]+)-(?<trace_flags>[0-9]+)$ "$parent_id";
}
log_format tracing '{"trace_id": "$my_trace_id", "parent_id": "$my_parent_id", "span_id": "$my_span_id"}'; If anyone knows an easier workaround, I'm all ears, and of course I'd be even more happy if nginx-opentracing could provide standardized variables for the three IDs, independent of tracer implementation and propagation format. |
in your logs refer variable - $opentracing_context_uber_trace_id . where as traceContextHeaderName configured with 'uber_trace_id' as below { "service_name": "JAEGER-SERVICE-NAME", "sampler": { "type": "JAEGER-SAMPLER-TYPE", "param": JAEGER-SAMPLER-PARAM }, "reporter": { "localAgentHostPort": "JAEGER-REPORTER-LOCAL-AGENT-HOST-PORT" }, "headers": { "jaegerDebugHeader": "jaeger-debug-id", "jaegerBaggageHeader": "jaeger-baggage", "traceBaggageHeaderPrefix": "uberctx-", "traceContextHeaderName": "uber-trace-id" }, "baggage_restrictions": { "denyBaggageOnInitializationFailure": false, "hostPort": "" } } |
Based on @wosc's comment, am I wrong to think that this issue should be opened on https://github.com/jaegertracing/jaeger-client-cpp/ ? |
That results in the entire trace context header (which is 4 colon separated fields).
Additional note: we're doing this in the context of ingress-nginx; that |
Contribution are welcome. There are no active developers that would work on it as far I know. |
I had a quick look at how to do it; for whoever gets around to it:
|
Is it possible to add the trace ids to the nginx log file?
The text was updated successfully, but these errors were encountered: