Adds c:<id> field holding the container ID so the agent can attach container tags.
Description of the Change
If DD_ENTITY_ID is set, we ignore the container field
If DD_ENTITY_ID is not set and DD_ORIGIN_DETECTION_ENABLED is not explicitly set to false and the origin_detection_enabled param is not explicitly disabled, we try to get the app container ID by parsing /proc/self/cgroup. In case of success, the container field in will be set.
Alternate Designs
Possible Drawbacks
Verification Process
Wrote a small app importing the lib and sending metrics to agent 7.35 with origin detection client enabled - the metrics were tagged with container tags.
Additional Notes
Users should explicitly enable container tagging in the agent otherwise the agent ignores the container field. So even if the client sends the field automatically, the tagging won't be done without explicitly enabling it in the agent.
Cgroup parsing logic is essentially the same as in dd-trace-py
What does this PR do?
Adds
c:<id>
field holding the container ID so the agent can attach container tags.Description of the Change
DD_ENTITY_ID
is set, we ignore the container fieldDD_ENTITY_ID
is not set andDD_ORIGIN_DETECTION_ENABLED
is not explicitly set to false and theorigin_detection_enabled
param is not explicitly disabled, we try to get the app container ID by parsing/proc/self/cgroup
. In case of success, the container field in will be set.Alternate Designs
Possible Drawbacks
Verification Process
Wrote a small app importing the lib and sending metrics to agent 7.35 with origin detection client enabled - the metrics were tagged with container tags.
Additional Notes
Release Notes
Support adding the container ID field for origin detection (dogstatsd 1.2)
Review checklist (to be filled by reviewers)
changelog/
label attached. If applicable it should have thebackward-incompatible
label attached.do-not-merge/
label attached.kind/
andseverity/
labels attached at least.