Skip to content
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

Kristjan/container #196

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

kristjanvalur
Copy link
Contributor

@kristjanvalur kristjanvalur commented Mar 31, 2025

Description

Add support for the DD_EXTERNAL_ENV, DD_ENTITY_ID and DD_CONTAINER_ID configurables

Motivation

Other implementations, such as dd-trace-py, already support these, which help with running tracing from containerized
environments. The Datadog Admission Controller sets DD_EXTERNAL_ENV and DD_ENTITY_ID, and the DD_CONTAINER_ID can be provided by the user if he has previously discovered the ID using an external script.

Additional Notes

  • See issue [FEATURE]: Support origin discovery via entity-id or container-id #193
  • No attempt is made at automatic discovery of container id, such as is done in the python version, due to the relative complexity of performing grep and such analysis from C, when simpler solutions exists in the form of Bash.
  • An example container-id.sh is added to examples/container showing how to populate DD_CONTAINER_ID, based on existing code from other Datadog libraries in Python.
  • This is based on analyzing dd-trace-py and some cursory glancing at datadog-agent. I may have got things wrong. For instance, dd-trace-py sets a Datadog-Entity-ID header (in addtion to the tag) while the agent does not parse any such header, so we skip setting that header in this implementation.
  • The capitalization of the header fields follows what was found in dd-trace-py, not any official internal specifications
  • I have not been able to fully run the test suite, so the Unit tests provided may or may not work :)

Jira ticket: [PROJ-IDENT]

@kristjanvalur kristjanvalur marked this pull request as ready for review March 31, 2025 17:38
@kristjanvalur kristjanvalur requested a review from a team as a code owner March 31, 2025 17:38
@kristjanvalur kristjanvalur requested review from Anilm3 and removed request for a team March 31, 2025 17:38
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.

1 participant