-
Notifications
You must be signed in to change notification settings - Fork 41
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 setting trace analytics via environment variables. #104
Conversation
I'd like to get this working for the Ingress Nginx controller. |
3211ec6
to
b40c145
Compare
Made some changes to this implementation so that the metric is added to only the local-root span, after a trace is completed and had not been set directly. This required some refactoring (cleanup) of the Tests have been added that execute the behavior via mocks (unit) and by setting the environment variable, creating new tracers and generating spans (integration). |
@alanjcastonguay from testing this before shipping our release, it's not as easy as hoped. I'd expected it to be simple - just add the variables to the ingress-controller deployment. A short term hack would be users providing a custom nginx template. |
@alanjcastonguay I've submitted kubernetes/ingress-nginx#4371 to update to 1.0.1 so this should be in their next release. To make it work, it requires two things:
I suppose they could be set directly in |
The template is already tweakable based on the tracer being enabled. Maybe go code in the Ingress-nginx controller should always set |
This PR makes it possible to set the trace analytics metric on traces via an environment variable.
Users of this tracer are generally not directly writing C++ code, but using it indirectly via another application (eg: nginx, envoy, istio).
Under those circumstances, the most practical way of controlling a feature like this is via environment variables.
The variables used are:
DD_TRACE_ANALYTICS_ENABLED
: can betrue
(rate=1.0),false
(rate=0.0) or unset (no rate)DD_GLOBAL_ANALYTICS_SAMPLE_RATE
: a valid value between 0.0 and 1.0 inclusive.