-
Notifications
You must be signed in to change notification settings - Fork 663
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
feat(datadog): add environment variable configuration #836
feat(datadog): add environment variable configuration #836
Conversation
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.
Awesome! Thanks for getting to this so quick.
self.agent_url = ( | ||
agent_url | ||
if agent_url | ||
else os.environ.get("DD_TRACE_AGENT_URL", DEFAULT_AGENT_URL) | ||
) | ||
self.service = service if service else os.environ.get("DD_SERVICE") | ||
self.env = env if env else os.environ.get("DD_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.
an empty string evaluates to false, so you may find that you cannot set that as a value (although I'm not sure what an empty string would do with regards to tag values anyway. It may not be valid).
also a shorthand for this is:
self.env = env or os.environ.get("DD_ENV")
(evaluates to first non-falsey value)
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.
LGTM!
"DD_SERVICE": "test-service", | ||
"DD_ENV": "test", | ||
"DD_VERSION": "0.0.1", | ||
"DD_TAGS": "team:testers", |
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.
Doesn't look like there's any test coverage for multiple tags with ,
separators
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 for the heads up, added it to one of the tests!
…g-unified-service-tagging
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.
lgtm
Resolves #824
Adds support for unified service tagging with environment variables
DD_SERVICE
,DD_ENV
,DD_VERSION
as well global tags with environment variableDD_TAGS
.https://docs.datadoghq.com/tracing/setup/python/#configuration
https://docs.datadoghq.com/getting_started/tagging/unified_service_tagging