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

Environment configuration not being picked up #1032

Closed
kelvin-acosta opened this issue May 7, 2020 · 8 comments · Fixed by #1034
Closed

Environment configuration not being picked up #1032

kelvin-acosta opened this issue May 7, 2020 · 8 comments · Fixed by #1034
Assignees
Labels
bug Involves a bug community Was opened by a community member integrations Involves tracing integrations
Milestone

Comments

@kelvin-acosta
Copy link

We recently updated our dd-trace-rb to 0.35.1 and were using this configuration before

Datadog.configure do |c|
    c.use :rails, service_name: Runtime.app_name,
                  distributed_tracing: true,
                  trace_agent_hostname: ENV.fetch('DD_AGENT_HOST', 'localhost'),
                  trace_agent_port: ENV.fetch('DD_TRACE_AGENT_PORT', 8126)

    # sets env for APM services
    c.tracer.set_tags(env: 'stage')
end

once we updated we found that set_tags was erroring since the method has been removed

After looking at the changelog for 0.34.0 we then updated our configuration to

Datadog.configure do |c|
    c.use :rails, service_name: Runtime.app_name,
                  distributed_tracing: true,
                  trace_agent_hostname: ENV.fetch('DD_AGENT_HOST', 'localhost'),
                  trace_agent_port: ENV.fetch('DD_TRACE_AGENT_PORT', 8126)

    # sets env for APM services
    c.env = 'stage'
end

But this doesn't seem to work. All of our traces show up with env:none in datadog. Wondering if we misconfigured something or if this is simply a bug.

Please let me know if I can provide anything else to help. Thanks!

@mattmcf
Copy link

mattmcf commented May 8, 2020

+1

Also seeing an issue since updating to 0.35.1 from 0.34.2.

We had the following configuration line

c.tracer tags: { "env" => ENV["STACK_NAME"] }

I'm trying multiple iterations to get env to stick.

c.env = ENV["STACK_NAME"]

wasn't working for me either.

@delner
Copy link
Contributor

delner commented May 8, 2020

@kelvin-acosta @mattmcf I was able to reproduce this issue. If you put c.env near the bottom of your file (after integrations are activated) it won't set properly. Workaround is to put it at the top of the Datadog.configure block.

We're working on a bugfix for this now.

@delner delner self-assigned this May 8, 2020
@delner delner added bug Involves a bug community Was opened by a community member integrations Involves tracing integrations labels May 8, 2020
@mattmcf
Copy link

mattmcf commented May 8, 2020

Thanks @delner. I'll try that now.

@mattmcf
Copy link

mattmcf commented May 8, 2020

@delner That also worked for me locally. I'll ship a fix for us. Thank you!

@delner
Copy link
Contributor

delner commented May 8, 2020

@kelvin-acosta Also for your configuration, trace_agent_hostname and trace_agent_port are invalid options, those should be configured on the tracer option instead. I'd recommend your configuration be:

Datadog.configure do |c|
  c.service = Runtime.app_name
  c.env = 'stage'

  c.tracer.hostname = 'my-host'
  c.tracer.port = 1234

  c.use :rails
end

@delner
Copy link
Contributor

delner commented May 8, 2020

We identified a cause for this and have a bug fix #1034 in progress; will keep you posted.

@marcotc marcotc added this to the 0.35.2 milestone May 11, 2020
@marcotc
Copy link
Member

marcotc commented May 11, 2020

@kelvin-acosta @mattmcf thank you again for this issue report!
We've just released 0.35.2, which includes a fix for this issue.
Please give it a try and let us know if the problem still persists.

@kelvin-acosta
Copy link
Author

Confirmed that this fixes my issue. Thank you for the prompt fix!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Involves a bug community Was opened by a community member integrations Involves tracing integrations
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants