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

Can I set the environment setting via an environment variable? #98

Open
keattang opened this issue Jun 27, 2019 · 16 comments
Open

Can I set the environment setting via an environment variable? #98

keattang opened this issue Jun 27, 2019 · 16 comments

Comments

@keattang
Copy link
Contributor

This is inherently environment related and not something I'd like to bake into my docker images.

@cgilmour
Copy link
Contributor

cgilmour commented Jul 8, 2019

Which setting(s) does this refer to?

@keattang
Copy link
Contributor Author

keattang commented Jul 8, 2019

This one

// "environment": A string, defaults to "". The environment this trace belongs to.

@cgilmour
Copy link
Contributor

cgilmour commented Jul 8, 2019

It's usually set on the agent instead of the application that submits traces to the agent.
Either set apm_config.env in the config file, or if running datadog-agent as a container, use the DD_APM_ENV variable.

@keattang
Copy link
Contributor Author

keattang commented Jul 8, 2019

Ah I see. Unfortunately our agent services multiple different environments so that would not work for us. Can I request this as a feature?

I'm not too familiar with C++ but I could attempt to make a PR. Would there be much more to it that adding a block like this

auto agent_host = std::getenv("DD_AGENT_HOST");
?

@cgilmour
Copy link
Contributor

cgilmour commented Jul 8, 2019

It'd be a few small changes

  • choosing the right name for the env variable
  • a block like you linked to
  • a small change to an existing test
    {"DD_PROPAGATION_STYLE_INJECT", "Datadog B3"}},
    TracerOptions{"host",
    420,
    "",
    "web",
    "",
  • updating the comment to say "Can also be set by ..."

@muenchdo
Copy link

muenchdo commented Jul 8, 2019

We have a similar setup (agent servicing multiple environments), so we would also be very happy to get this feature! :)

@keattang
Copy link
Contributor Author

I've created this PR #103

@keattang
Copy link
Contributor Author

@cgilmour Thanks for merging my PR! When do you think it will make it into a release?

@palazzem
Copy link

Thanks @keattang for the contribution! we're doing some work around the release process, so that we can target a 1.0. The goal is in having this ready in roughly 2 weeks. In the meantime, @cgilmour can give you extra details to let you use your contribution! Hope it helps!

@keattang
Copy link
Contributor Author

Cool thanks @palazzem!

@cgilmour
Copy link
Contributor

Hi @keattang, let me know what help you need here.
Right now, if you're checking out v0.4.3 and want to use an unreleased version with your contribution, you can check out the commit instead: 113b7c143bc7b557d75ed790437f1b8f618cc9bb.
Once 1.0.0 is released, then you can switch back to using tags.

Does that work for you?

@keattang
Copy link
Contributor Author

Thanks @cgilmour sounds good. Do I then just follow the build instructions in the readme?

@cgilmour
Copy link
Contributor

Yes.

Are you currently using one of the pre-built binaries from a release?
If so, there might be extra details - let me know!

@keattang
Copy link
Contributor Author

Yes, currently using the latest pre-built binary.

@cgilmour
Copy link
Contributor

OK.

If you're using libdd_opentracing.so, then that's built by default.
If you're using libdd_opentracing_plugin.so, then it needs an extra detail: run cmake -DBUILD_PLUGIN=ON .. before running make.

@keattang
Copy link
Contributor Author

Great, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants