-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
statsd-emitter: support constant DogStatsD tags #6791
statsd-emitter: support constant DogStatsD tags #6791
Conversation
I realize I didn't add a test for this feature. The other tests in StatsDEmitterTest mock out the StatsDClient, and this change is primarily a change to the construction of that object. |
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.
1 minor nit, generally LGTM, 👍
@@ -65,6 +71,7 @@ public StatsDEmitterConfig( | |||
this.dimensionMapPath = dimensionMapPath; | |||
this.blankHolder = blankHolder != null ? blankHolder : "-"; | |||
this.dogstatsd = dogstatsd != null ? dogstatsd : false; | |||
this.dogstatsdConstantTags = dogstatsdConstantTags != null ? dogstatsdConstantTags : new ArrayList<>(0); |
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.
nit: use Collections.emptyList()
@@ -46,6 +46,7 @@ All the configuration parameters for the StatsD emitter are under `druid.emitter | |||
|`druid.emitter.statsd.dimensionMapPath`|JSON file defining the StatsD type, and desired dimensions for every Druid metric|no|Default mapping provided. See below.| | |||
|`druid.emitter.statsd.blankHolder`|The blank character replacement as statsD does not support path with blank character|no|"-"| | |||
|`druid.emitter.statsd.dogstatsd`|Flag to enable [DogStatsD](https://docs.datadoghq.com/developers/dogstatsd/) support. Causes dimensions to be included as tags, not as a part of the metric name. `convertRange` fields will be ignored.|no|false| | |||
|`druid.emitter.statsd.dogstatsdConstantFlags`|If `druid.emitter.statsd.dogstatsd` is true, the tags in the JSON list of strings will be sent with every event.|no|[]| |
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.
typo: s/Flags/Tags
Thanks, addressed both comments. |
@@ -53,7 +53,7 @@ static StatsDEmitter of(StatsDEmitterConfig config, ObjectMapper mapper) | |||
config.getPrefix(), | |||
config.getHostname(), | |||
config.getPort(), | |||
EMPTY_ARRAY, | |||
config.getDogstatsd() ? config.getDogstatsdConstantTags().toArray(new String[0]) : EMPTY_ARRAY, |
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.
For boolean field, I prefer it's Getter
method like isXXX
, so change the StatsDEmitterConfig#getDogstatsd
to StatsDEmitterConfig#isDogstatsd
would be better.
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.
Thanks! This was a preexisting field but I changed it now. I changed hashCode to use Objects.hash too.
PR #6605 added support to the statsd emitter for DogStatsD tags. This commit lets you specify "constant tags" in the config file which are included with every event. This is helpful if you are running in an environment where you cannot configure your datadog-agent with tags like "cluster name" --- eg, a Kubernetes cluster with a datadog-agent on each node and different Druid deployments in different namespaces but sharing the same datadog-agent daemonset. Also fix the name of an existing boolean getter to start with 'is'.
PR #6605 added support to the statsd emitter for DogStatsD tags. This commit
lets you specify "constant tags" in the config file which are included with
every event. This is helpful if you are running in an environment where you
cannot configure your datadog-agent with tags like "cluster name" --- eg, a
Kubernetes cluster with a datadog-agent on each node and different Druid
deployments in different namespaces but sharing the same datadog-agent
daemonset.