datadog-agent
datadog-agent copied to clipboard
Read `DD_GIT_REPOSITORY_URL` and `DD_GIT_COMMIT_SHA` env vars
What does this PR do?
Make the agent read the containers DD_GIT_REPOSITORY_URL
and DD_GIT_COMMIT_SHA
environment variables to populate the git.repository_url
and git.commit.sha
tags.
Motivation
Those git.repository_url
and git.commit.sha
tags are currently filled from the values of the org.opencontainers.image.source
and org.opencontainers.image.revision
docker labels.
But those labels are not used by the APM tracer libraries.
In order to ease the setup for the customers, it would be simpler to have one way to configure the repository URL and the commit sha that would work for both the agent and the APM tracer libraries.
Additional Notes
Possible Drawbacks / Trade-offs
This works only for the env vars set at the container level. If the env var is set by a script running inside the container, it won’t be seen by the agent.
Describe how to test/QA your changes
Start a container with the repository URL and commit sha set as docker labels DD_GIT_REPOSITORY_URL
and DD_GIT_COMMIT_SHA
.
Check that all the data coming from this container are properly tagged with git.repository_url
and git.commit.sha
.