-
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
Fix context propagation #37
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cc @isaachier - this change means dropping the vendor modules for loading a tracer in favor of dynamic loading from a JSON specification of their configuration. You might consider adding some documentation for your configuration format to https://github.com/jaegertracing/jaeger-client-cpp and improving the error handling for misconfigurations to give a more helpful message. |
Merged
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary:
nginx-opentracing was propagating span context by modifying the headers of the active request. This isn't supported by NGINX. While it works most of the time, it can cause NGINX to crash kubernetes/ingress-nginx#2222 (comment).
Since there doesn't seem to be any way for a module to add arbitrary headers to upstream requests, this fix adds a directive
opentracing_propagate_context
that gets translated to severalproxy_set_header
that will set the headers for the active span context. Since these directives have to be set up when the configuration is loaded and the header keys have to be fixed, the module creates a dummy span at startup to try to determine what header keys a tracer uses for propagation.Any header keys a tracer might use later for propagation that weren't included in the dummy span will be dropped. (Note: this will break baggage propagation for LightStep and Jaeger since they don't use fixed keys).
Also, as part of the reorganization for the fix, I dropped the vendor-specific modules. Tracer's should now be specified with the
opentracing_load_tracer
directive. The vendor modules didn't work well with the order of operations that need to happen for the header keys to be determined at startup.For more background on the fix, see the discussion at
http://mailman.nginx.org/pipermail/nginx-devel/2018-March/010987.html
And since
opentracing_propagate_context
andproxy_set_header
are specific to NGINX's proxy module, I'll also need to add a directiveopentracing_fastcgi_propagate_context
to handle context propagate for the fastcgi module.