attach additional tags as defined in DATADOG_TAGS environment variable#114
attach additional tags as defined in DATADOG_TAGS environment variable#114yannmh merged 4 commits intoDataDog:masterfrom
Conversation
|
Nice feature, thanks a lot @ewdurbin. We'll review and consider your changes for an upcoming release. On a side note, I am quite confused by the use case you are describing. It sounds like you are looking for a convenient way to set constant tagging on Datadog Agent metrics (including metrics received from |
|
@yannmh there's a bit of finesse. Example: Assume we have two docker hosts Currently, running dd-agent as a docker container on each docker host, we may configure it to have the following tags:
Unfortunately this leaves the owners of the application to manually add the This feature allows us to inject
without needing to either manually add them in code (passing |
|
It completely makes sense. Thanks for the further explanations @ewdurbin ! |
datadog/dogstatsd/base.py
Outdated
| self._send = self._send_to_server | ||
| self.encoding = 'utf-8' | ||
| self.constant_tags = constant_tags | ||
| self.env_tags = [tag for tag in os.environ.get('DOGSTATSD_TAGS', '').split(',') if tag] |
There was a problem hiding this comment.
Can we limit env_tags scope to the function only ? i.e.
env_tags = ...
# Instead of
self.env_tags = ...|
It looks great, thanks again @ewdurbin. I simply added a few nitpicks. Please let me know your thoughts about it, so we can merge your contribution. |
|
Thanks for the quick update @ewdurbin ! Let's merge it |
|
I am thinking about adding the same feature to |
|
This PR already includes the addition to ThreadStats. I'm fine with renaming it to a more general |
|
Thanks @ewdurbin. Let's merge it 🚢 |
[dogstatsd][threadstats] constant tags from `DATADOG_TAGS` environment variable
creates an additional technique for adding tags to all metrics by defining a comma separated list of tags in the
DOGSTATSD_TAGSenvironment variable.use case:
currently we add a plethora of global tags by adding them to our dd-agent configuration on each node. as we progress towards using container technologies, it would be swell if we could seamlessly inject some of these tags on a container by container basis (app name, version, build) rather than adding them to the dd-agent which will be configured with tags for instance id, region, availability-zone etc.