Skip to content

feat(datadog): add environment variable configuration#836

Merged
codeboten merged 3 commits intoopen-telemetry:masterfrom
DataDog:majorgreys/datadog-unified-service-tagging
Jun 18, 2020
Merged

feat(datadog): add environment variable configuration#836
codeboten merged 3 commits intoopen-telemetry:masterfrom
DataDog:majorgreys/datadog-unified-service-tagging

Conversation

@majorgreys
Copy link
Copy Markdown
Contributor

Resolves #824

Adds support for unified service tagging with environment variables DD_SERVICE, DD_ENV, DD_VERSION as well global tags with environment variable DD_TAGS.

https://docs.datadoghq.com/tracing/setup/python/#configuration
https://docs.datadoghq.com/getting_started/tagging/unified_service_tagging

@majorgreys majorgreys requested a review from a team June 17, 2020 04:53
Copy link
Copy Markdown
Member

@toumorokoshi toumorokoshi left a 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.

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")
Copy link
Copy Markdown
Member

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)

Copy link
Copy Markdown
Member

@aabmass aabmass left a 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",
Copy link
Copy Markdown
Member

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

Copy link
Copy Markdown
Contributor Author

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!

Copy link
Copy Markdown
Contributor

@codeboten codeboten left a comment

Choose a reason for hiding this comment

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

lgtm

@codeboten codeboten merged commit 99cb046 into open-telemetry:master Jun 18, 2020
srikanthccv pushed a commit to srikanthccv/opentelemetry-python that referenced this pull request Nov 1, 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.

datadog: honor DD environment variables

4 participants