-
Notifications
You must be signed in to change notification settings - Fork 375
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
[rails] provide tags setting to include global tags from Rails settings #101
Conversation
@@ -65,7 +65,8 @@ of the Datadog tracer, you can override the following defaults: | |||
debug: false, | |||
trace_agent_hostname: 'localhost', | |||
trace_agent_port: 8126, | |||
env: Rails.env | |||
env: Rails.env, | |||
tags: {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ufoot I don't like having both, it seems we provide two different paths to do the same thing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As I said in #100 this is fine with me, providing what is the final value (if both are defined and different) needs be explicit in the docs.
8c37afc
to
63d42b7
Compare
@@ -47,6 +48,10 @@ def self.configure(config) | |||
port: datadog_config[:trace_agent_port] | |||
) | |||
|
|||
# set default tracer tags | |||
datadog_config[:tracer].set_tags('env' => datadog_config[:env]) | |||
datadog_config[:tracer].set_tags(datadog_config[:tags]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wondering about the order here, as I understand it, what is in env:
would be overridden by the contents of tags:
? I, intuitively, would think it the other way around, but won't enforce it, just curious to know why you chose that order.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that was a temporary order before choosing if env
should be removed or not. In that case we can enforce the env
tag so that it takes precedence among global tags.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's keep on discussing on that env matter a bit, you're right, we should sort this out, but otherwise looks good, yes.
63d42b7
to
08e2d4e
Compare
@@ -47,6 +48,10 @@ def self.configure(config) | |||
port: datadog_config[:trace_agent_port] | |||
) | |||
|
|||
# set default tracer tags | |||
datadog_config[:tracer].set_tags(datadog_config[:tags]) | |||
datadog_config[:tracer].set_tags('env' => datadog_config[:env]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In think we're almost there, but what happens here if :env
is not defined it the conf at all? Could this happen and override a legit :tags
value?
For the record, this broke our configuration. We were happily relying on our Agent to send the information about the env (we were using the |
Changes to the dd-trace-rb library have deprecated the DD_SERVICE_ENV variable. See DataDog/dd-trace-rb#101 for more info.
Changes to the dd-trace-rb library have deprecated the DD_SERVICE_ENV variable. See DataDog/dd-trace-rb#101 for more info.
What it does
Users can set tracer global tags using Rails settings like:
All created spans will have both
component
andanother
tags.Follow-up of #100.