Skip to content

Conversation

@Hasv07
Copy link

@Hasv07 Hasv07 commented Dec 19, 2025

Related #3652
Changes:

  • Add EnvEntityDetector class to parse OTEL_ENTITIES environment variable
  • Parse entity format: type{id_attrs}[desc_attrs]@schema_url
  • Support percent-encoding for reserved characters
  • Handle duplicate entities, conflicting attributes, and malformed input per spec
  • Include basic test coverage

Details:

  • EnvEntityDetector::Detect() reads OTEL_ENTITIES and returns Resource with parsed attributes
  • ParseEntities() splits input by semicolons and parses each entity definition
  • ParseSingleEntity() extracts type, id_attrs, desc_attrs, and schema_url from entity string
  • ParseKeyValueList() parses comma-separated key=value pairs
  • PercentDecode() decodes percent-encoded values
  • BuildEntityIdentityKey() creates stable key for duplicate detection
  • Error handling malformed entities skipped, duplicates use last occurrence, conflicts log warnings

Implements entity propagation spec:
https://opentelemetry.io/docs/specs/otel/entities/entity-propagation/

@Hasv07 Hasv07 requested a review from a team as a code owner December 19, 2025 18:50
@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Dec 19, 2025

CLA Signed

The committers listed above are authorized under a signed CLA.

@Hasv07 Hasv07 marked this pull request as draft December 19, 2025 21:18
@codecov
Copy link

codecov bot commented Dec 19, 2025

Codecov Report

❌ Patch coverage is 98.59155% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 90.08%. Comparing base (162246f) to head (81c6db3).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
sdk/src/resource/env_entity_detector.cc 98.60% 2 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #3795      +/-   ##
==========================================
+ Coverage   89.93%   90.08%   +0.16%     
==========================================
  Files         225      226       +1     
  Lines        7163     7305     +142     
==========================================
+ Hits         6441     6580     +139     
- Misses        722      725       +3     
Files with missing lines Coverage Δ
...ude/opentelemetry/sdk/resource/resource_detector.h 100.00% <ø> (ø)
sdk/src/resource/env_entity_detector.cc 98.60% <98.60%> (ø)

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Hasv07 Hasv07 force-pushed the sdk/implement-env-entity-detector branch from 1d75005 to f7a5844 Compare December 19, 2025 21:29
@Hasv07 Hasv07 marked this pull request as ready for review December 19, 2025 21:42
@Hasv07 Hasv07 force-pushed the sdk/implement-env-entity-detector branch 2 times, most recently from 4e42cbc to 296d576 Compare December 20, 2025 18:41
…emetry#3652)

Changes:

Add EnvEntityDetector class to parse OTEL_ENTITIES environment variable
Parse entity format: type{id_attrs}[desc_attrs]@schema_url
Support percent-encoding for reserved characters
Handle duplicate entities, conflicting attributes, and malformed input per spec
Include comprehensive test coverage
Fix schema URL handling to pass to Resource

Details:

EnvEntityDetector::Detect() reads OTEL_ENTITIES and returns Resource with parsed attributes
ParseEntities() splits input by semicolons and parses each entity definition
ParseSingleEntity() extracts type, id_attrs, desc_attrs, and schema_url from entity string
ParseKeyValueList() parses comma-separated key=value pairs
PercentDecode() decodes percent-encoded values
BuildEntityIdentityKey() creates stable key for duplicate detection
Error handling: malformed entities skipped, duplicates use last occurrence, conflicts log warnings
Implements entity propagation spec: https://opentelemetry.io/docs/specs/otel/entities/entity-propagation
@Hasv07 Hasv07 force-pushed the sdk/implement-env-entity-detector branch from 296d576 to aeec00f Compare December 21, 2025 17:33
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