Skip to content
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

Pass through Datadog environment variables to Nginx when EnableOpentracing+DatadogCollectorHost set #4372

Closed
ellieayla opened this issue Jul 29, 2019 · 7 comments
Labels
lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed.

Comments

@ellieayla
Copy link
Contributor

ellieayla commented Jul 29, 2019

Is this a request for help? (If yes, you should use our troubleshooting guide and community support channels, see https://kubernetes.io/docs/tasks/debug-application-cluster/troubleshooting/.):

What keywords did you search in NGINX Ingress controller issues before filing this one? (If you have found any duplicates, you should instead reply there.):


Is this a BUG REPORT or FEATURE REQUEST? (choose one): Feature

NGINX Ingress controller version: 0.26.0

Kubernetes version (use kubectl version):

Environment:

  • Cloud provider or hardware configuration:
  • OS (e.g. from /etc/os-release):
  • Kernel (e.g. uname -a):
  • Install tools:
  • Others:

What happened:

After #4371 merged, the dd-opentracing-cpp module detects several environment variables and configures tracer behaviour based on their values.

Setting those environment variables in the dd-opentracing-cpp requires setting them in the ingress-nginx pod (very reasonable) and requires whitelisting them for passthrough in a custom nginx template or main-snippet like

main-snippet: |
    env DD_ENV;
    env DD_TRACE_ANALYTICS_ENABLED;

What you expected to happen:

Generate nginx.conf correctly without repeating config in multiple places.

How to reproduce it (as minimally and precisely as possible):

Build ingress-nginx from master after #4371 merged, set environment variable DD_TRACE_ANALYTICS_ENABLED=true on the ingress-nginx Pod, don't see trace-analytics enabled in dd-opentracing-cpp because nginx doesn't pass it through by default. Read http://nginx.org/en/docs/ngx_core_module.html#env and define a custom main-snippet as above. Be happier.

Anything else we need to know:

I'm going to make a PR for this, unless someone beats me to it.

@ellieayla
Copy link
Contributor Author

ellieayla commented Jul 29, 2019

On further investigation, it looks like all of these configuration options can also be set in /etc/nginx/opentracing.json, read by https://github.com/DataDog/dd-opentracing-cpp/blob/11311abc9160ceee63cfdb2e027e82f48a5348a0/src/tracer_factory.cpp#L14-L86

Some of those options are exposed by the existing

const datadogTmpl = `{
"service": "{{ .DatadogServiceName }}",
"agent_host": "{{ .DatadogCollectorHost }}",
"agent_port": {{ .DatadogCollectorPort }},
"operation_name_override": "{{ .DatadogOperationNameOverride }}"
}`

The correct approach is probably to populate the remaining options here, and not deal in environment variables.

@ellieayla
Copy link
Contributor Author

Hang on, is DD_TRACE_ANALYTICS_ENABLED configurable via json file at all, or only by environment variable? Sure looks like the latter. That's unexpected.

@cgilmour
Copy link
Contributor

cgilmour commented Jul 29, 2019

Correct. In some cases, it's only via environment variable instead of config file or tracer options (code that initializes a tracer). No strong reason for it, but the intention was to make things easier for users and projects consuming the tracer. Eg. avoiding the need to add new code.

In this case though, it's making things harder.

@fejta-bot
Copy link

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Oct 27, 2019
@fejta-bot
Copy link

Stale issues rot after 30d of inactivity.
Mark the issue as fresh with /remove-lifecycle rotten.
Rotten issues close after an additional 30d of inactivity.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle rotten

@k8s-ci-robot k8s-ci-robot added lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels Nov 26, 2019
@fejta-bot
Copy link

Rotten issues close after 30d of inactivity.
Reopen the issue with /reopen.
Mark the issue as fresh with /remove-lifecycle rotten.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/close

@k8s-ci-robot
Copy link
Contributor

@fejta-bot: Closing this issue.

In response to this:

Rotten issues close after 30d of inactivity.
Reopen the issue with /reopen.
Mark the issue as fresh with /remove-lifecycle rotten.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/close

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants