-
Notifications
You must be signed in to change notification settings - Fork 3
Config for spans and opentracing_propagate_context #3
Comments
Let's say it is supposed to do that. I could not find a standard for HTTP headers at the time of writing the package so it propagates(and reads) context through the X-TRACE header. There seems to be some movement towards a standard header here: https://github.com/opentracing/specification/blob/master/rfc/trace_identifiers.md but I would appreciate an example trace header from your setup to see where nginx places the trace context |
I'm still relatively new to tracing and jaeger, is there a way to find this out somewhere in the Jaeger UI? I had followed this doc by nginx, https://www.nginx.com/blog/opentracing-with-nginx-ingress-controller-for-kubernetes/ only difference is that my nginx-ingress controller wasn't self compiled, it supports opentracing/jaeger. Edit: Should note that I did do a |
No you would check this in your php application. As for no X-TRACE header being present:
|
I've attached a sanitized set of headers as json. Doesn't look to be any X-TRACE header present. Perhaps my nginx.conf for Laravel doesn't forward that on to php-fpm/the app. |
Indeed there is nothing there. Did you add the location-snippet as mentioned in the tutorial? apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: opentracing-ingress
annotations:
nginx.org/location-snippets: |
opentracing_propagate_context;
spec:
rules:
- host: example.com
http:
paths:
- path: /
backend:
serviceName: app1-svc
servicePort: 80 According to the tutorial that line should pass the tracing context to the application(well, it's nginx but it should just pass through that) |
Yeah that is there in my ingress yml. I found this reference to OpenTracing directives: https://github.com/opentracing-contrib/nginx-opentracing/blob/master/doc/Reference.md I see that there is a Headers-with-opentracing_fastcgi_propagate_context.txt
|
That should be what we're looking for. I'll have to do some digging to find out how to pass only that Id to my jaeger lib - the context there requires some other parameters to be set. |
If you need any more info or to test I'm happy to help where I can. |
I have created a branch uber_trace_id where I'm trying to get this to work but as of right now it is completly untested, pretty much just 'this might work that way' I'll try to set up a minikube test env sometimes tomorrow |
Testing with that branch I'm getting exception: |
I'm trying to build a test setup in minikube that works similar to yours. So far I have the standalone working and sending traces from laravel but not the part about sending traces from the nginx ingress. |
Thank the addLog error is fixed. Jaeger is still showing the nginx/ingress and Laravel traces as different spans. |
I finally got it working on my end. It looks to me like the tutorial you posted above is using a somewhat out of date version of the nginx-ingress. The current config file directives to start opentracing with jager are here:
The current annotation to add a snippet to the location is here: For reference here is the ConfigMap which enabled jaeger traces from the nginx-ingress for me: kind: ConfigMap
apiVersion: v1
metadata:
name: nginx-load-balancer-conf
namespace: kube-system
data:
hsts: "false"
map-hash-bucket-size: "128"
enable-opentracing: "True"
jaeger-collector-host: "agent.spacebattle.svc.cluster.local"
jaeger-service-name: "nginx-ingress"
opentracing: "True" And the ingress: ---
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: spacebattle
namespace: default
annotations:
kubernetes.io/ingress.class: nginx
nginx.ingress.kubernetes.io/configuration-snippet: |
opentracing_propagate_context;
spec:
rules:
- host: spacebattle.cluster.test
http:
paths:
- path: /
backend:
serviceName: spacebattle-asterkeks-de-http
servicePort: web The UBER-TRACE-ID sent by the ingress looks like this: I see the nginx-ingress and laravel spans as part of a single trace now. |
Looking at the location entry you posted earlier I think you configured your laravel application nginx to post the trace instead of the ingress controller - I'm seeing 2 spans from the ingress controller alone as well - and for some reason, probably a version difference, your application nginx sends a shortened version of the uber-trace-id which my backend lib can't deal with |
I've used your annotations for the actual ingress and now it seems to work. Before I was enabling opentracing on just the ingress instead of globally, so now with it globally enabled I need to figure out how to disable tracing on certain ingresses (i.e. I don't need to trace prometheus). Now I'm able to trace through the call, however when spanning the trace from nginx-ingress > nginx > Laravel, it lists only Also as a suggestion, would it be possible to override the service name used? It looks to use the app name, but when we have multiple apps (dev/staging/prod) with the same env app name, it would be good to be able to differentiate in Jaeger UI. |
If you've been able to enable tracing on certain ingresses only then it should also be possible to set it so it sends the full uber-trace-id from there. I'll try to find out some more but it might be faster to just dig around the nginx-ingress and what it does with the values given in the config map. I don't have a have an idea right now how to make the ingress span more informative but I have some advice that might make it unnecessary:
That said I don't think different service names are useful but they are certainly easy to implement |
Disabling TracingI did some digging and the annotations:
nginx.ingress.kubernetes.io/configuration-snippet: |
opentracing off; Since it can be turned off here it also can be turned on of course. I have not been able to do this properly tho because the More information in the nginx spanhttps://github.com/opentracing-contrib/nginx-opentracing/blob/master/doc/Reference.md lists some more directives which can be used in the ingress to customize the span created by nginx. Notably This example will show the location and query parameters but not the hostname: annotations:
nginx.ingress.kubernetes.io/configuration-snippet: |
opentracing_operation_name $request_uri; |
Update: you can enable tracing on a per-ingress basis if your nginx-ingress version is v0.27.0+ nginx-ingress config: config:
enable-opentracing: "False"
jaeger-collector-host: "agent.jaeger.svc.cluster.local"
jaeger-service-name: "nginx-ingress" ingress annotations: annotations:
nginx.ingress.kubernetes.io/enable-opentracing: "true"
nginx.ingress.kubernetes.io/configuration-snippet: |
opentracing_propagate_context;
# optional:
opentracing_operation_name $request_uri; |
Thank you, I was able to set up the tracing on only one ingress. I had found the opentracing_operation_name annotation, which is definitely helpful. The tagging of environment will be helpful for sure, still would be awesome to be configure the service name manually so we can add to other services tracing data by service name. Have yet to figure out how to specify tag filtering there. |
@svensp any chance this can be merged into master/tagged version? |
I've been meaning to for a while but the branch currently only reads the standard header, no longer the custom header my packages used until then thus making it a breaking change. I could slap a 2.0.0 tag on it tho, making it a harder upgrade path but you'll have a tagged version to work with |
@svensp thanks, for now not to worry. We've managed to set something else up. Thank you for your work! |
Does this package support spans of traces as they pass through the services?
i.e.
Currently I'm seeing 1 & 2 as a span of the same trace, but all subsequent requests in the actual app are showing as individual traces.
The text was updated successfully, but these errors were encountered: