Skip to content

Conversation

@marcotc
Copy link
Member

@marcotc marcotc commented Nov 7, 2025

What does this PR do?
Add two new HTTP headers to the trace agent transport: 'Datadog-Entity-ID' and 'Datadog-External-Env'.
These headers, alongside the existing 'Datadog-Container-ID', ensure the Datadog agent knows from what container traces are coming from.

Change log entry
Yes. Add support for Origin Detection.

How to test the change?
There are unit test and system-tests (1, 2, 3) for this change.

…d container modules

- Fix type checking errors in core environment and container modules
- Update RBS type signature files to match implementations
- Add comprehensive error handling test case for running_on_host?
- Improve type safety across configuration and transport modules
- Update supported configurations and dependencies
@marcotc marcotc added the tracing label Nov 7, 2025
@marcotc marcotc self-assigned this Nov 7, 2025
@github-actions github-actions bot added the core Involves Datadog core libraries label Nov 7, 2025
@marcotc marcotc changed the title Marcotc/origin Add origin detection Nov 7, 2025
@github-actions
Copy link

github-actions bot commented Nov 7, 2025

Typing analysis

Note: Ignored files are excluded from the next sections.

Untyped methods

This PR clears 5 untyped methods and 1 partially typed method. It increases the percentage of typed methods from 53.09% to 53.7% (+0.61%).

Untyped methods (+0-5)Cleared:
sig/datadog/core/environment/cgroup.rbs:11
└── def self?.parse: (untyped line) -> untyped
sig/datadog/core/environment/container.rbs:19
└── def self?.platform: () -> untyped
sig/datadog/core/environment/container.rbs:21
└── def self?.container_id: () -> untyped
sig/datadog/core/environment/container.rbs:23
└── def self?.task_uid: () -> untyped
sig/datadog/core/environment/container.rbs:25
└── def self?.descriptor: () -> untyped
Partially typed methods (+0-1)Cleared:
sig/datadog/core/environment/cgroup.rbs:9
└── def self?.descriptors: (?::String process) -> untyped

Untyped other declarations

This PR clears 9 untyped other declarations. It increases the percentage of typed other declarations from 66.92% to 67.87% (+0.95%).

Untyped other declarations (+0-9)Cleared:
sig/datadog/core/environment/cgroup.rbs:5
└── LINE_REGEX: untyped
sig/datadog/core/environment/cgroup.rbs:7
└── Descriptor: untyped
sig/datadog/core/environment/container.rbs:5
└── UUID_PATTERN: untyped
sig/datadog/core/environment/container.rbs:7
└── CONTAINER_PATTERN: untyped
sig/datadog/core/environment/container.rbs:9
└── PLATFORM_REGEX: untyped
sig/datadog/core/environment/container.rbs:11
└── POD_REGEX: untyped
sig/datadog/core/environment/container.rbs:13
└── CONTAINER_REGEX: untyped
sig/datadog/core/environment/container.rbs:15
└── FARGATE_14_CONTAINER_REGEX: untyped
sig/datadog/core/environment/container.rbs:17
└── Descriptor: untyped

@pr-commenter
Copy link

pr-commenter bot commented Nov 7, 2025

Benchmarks

Benchmark execution time: 2025-11-07 12:14:00

Comparing candidate commit 0bf5781 in PR branch marcotc/origin with baseline commit 20f7cba in branch master.

Found 0 performance improvements and 0 performance regressions! Performance is the same for 44 metrics, 2 unstable metrics.

…ath handling

This commit consolidates all improvements to the Ruby tracer's container
detection mechanism, removing unnecessary debug logging that was added
during the investigation of Entity-ID header generation issues.

Key Changes:
- Remove all debug logging from cgroup.rb and container.rb
  - Removed verbose info-level logging in entry() method
  - Removed debug logs from cgroup file reading operations
  - Replaced error logs with standard debug-level logging

- Improve code quality and clarity:
  - Change 'if !path' to 'unless path' in inode_for() for readability
  - Refactor entry() method for early returns instead of nested breaks
  - Improve comments explaining cgroup v1/v2 preference logic
  - Better variable naming (entry_obj vs entry for clarity)

- Fix root path handling for cgroup v2:
  - When cgroup path is root (/) but inode exists and not on host,
    use inode as fallback for container identification
  - Prevents losing valid container identification in cgroup v2

- Update tests:
  - Fix error logging test to expect debug level instead of error level
  - Update error message pattern to match implementation

All 360 existing tests pass successfully.
Linting checks pass (frozen_string_literal, standard).

Fixes the incomplete implementation of container detection, particularly
for cgroup v2 environments with root path fallback.
end
end

RSpec.shared_context 'Docker systemd environment' do
Copy link
Member Author

Choose a reason for hiding this comment

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

@marcotc double check the test changes.

@datadog-official
Copy link

✅ Tests

🎉 All green!

❄️ No new flaky tests detected
🧪 All tests passed

🎯 Code Coverage
Patch Coverage: 99.77%
Total Coverage: 98.53% (-0.01%)

View detailed report

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 0bf5781 | Docs | Datadog PR Page | Was this helpful? Give us feedback!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core Involves Datadog core libraries tracing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants