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

statsd-emitter: support constant DogStatsD tags #6791

Merged
merged 1 commit into from
Jan 4, 2019
Merged

statsd-emitter: support constant DogStatsD tags #6791

merged 1 commit into from
Jan 4, 2019

Conversation

glasser
Copy link
Contributor

@glasser glasser commented Dec 31, 2018

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.

@glasser
Copy link
Contributor Author

glasser commented Dec 31, 2018

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.

Copy link
Member

@nishantmonu51 nishantmonu51 left a 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);
Copy link
Member

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|[]|
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo: s/Flags/Tags

@glasser
Copy link
Contributor Author

glasser commented Jan 2, 2019

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,
Copy link
Member

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.

Copy link
Contributor Author

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'.
@QiuMM QiuMM merged commit c08f391 into apache:master Jan 4, 2019
@jon-wei jon-wei added this to the 0.14.0 milestone Feb 20, 2019
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

Successfully merging this pull request may close these issues.

5 participants