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

Add support for more environment variables #140

Merged
merged 7 commits into from
Apr 14, 2020

Conversation

delner
Copy link
Contributor

@delner delner commented Apr 1, 2020

This pull request adds global tags for:

  • DD_TAGS (acts as base set of global tags, overridden by other tags)
  • DD_ENV --> env:<env name>
  • DD_SERVICE --> service:<service name>
  • DD_VERSION --> version:<version string>

Precedence in order from most to least preferred is manually defined global tags (via #initialize), DD_ENV/DD_SERVICE/DD_VERSION, then finally DD_TAGS.

Copy link
Contributor

@remeh remeh left a comment

Choose a reason for hiding this comment

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

LGTM 👍
@kbogtob will probably want to give it a look before merging though.

@delner
Copy link
Contributor Author

delner commented Apr 2, 2020

@remeh Okay, there's one more question I had... if we set these global tags (say env:staging), and the user passes statsd.count('hits', 1, tags: ['env:staging']), will this produce duplicate env:staging tags? If so would we want to remove this kind of duplication?

Just thinking of the trade-off between saving on packet size vs saving on memory/CPU it would take to de-dup this.

@kbogtob
Copy link
Contributor

kbogtob commented Apr 9, 2020

Thanks @delner for your contribution!
I've just fixed some nits to homogenise the code with the existing one and added some tests.

It's true that we don't deduplicate the tags and I think we should be able to override specific tags in this order: ENV < Global tags < Call tags. I will discuss it internally and create an issue.

PS: Thanks for ClimateControl, didn't know that gem before :). It's nice.

@delner
Copy link
Contributor Author

delner commented Apr 9, 2020

@kbogtob Changes seem fine to me. Also just added a minor fix for a warning that was blowing up our test suite (when we'd close Statsd without using it.)

Copy link
Contributor

@kbogtob kbogtob left a comment

Choose a reason for hiding this comment

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

LGTM. Just left a small nit.

lib/datadog/statsd/serialization/tag_serializer.rb Outdated Show resolved Hide resolved
@kbogtob kbogtob merged commit f81533a into DataDog:master Apr 14, 2020
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.

3 participants