Repository navigation
Description
The OpenTelemetry specification now contains a new primitive, Entities.
Entities are still under active development and the associated infrastructure is not yet stable, although some specific entity definitions in the Entity registry are stable at the time of writing: service and telemetry.
Some evidence of entities can already be seen in the OTLP proto file for resources:
opentelemetry-dotnet/src/Shared/Proto/opentelemetry/proto/resource/v1/resource.proto
Lines 39 to 44 in b2cb8c3
| // Set of entities that participate in this Resource. | |
| // | |
| // Note: keys in the references MUST exist in attributes of this message. | |
| // | |
| // Status: [Development] | |
| repeated opentelemetry.proto.common.v1.EntityRef entity_refs = 3; |
While still in development, entities are something we could potentially add experimental support for, rather than waiting for the specification to stabilise fully.
To support entities based on the current state of the specification would involve work similar to the following:
-
Add the entity data model to
Resource:- Add support for associating [0..n] entities with a resource.
Resource.Merge()needs to be updated to be aware of entities when merging.
-
Add an API to detect entities:
- Add a new interface similar to
IResourceDetector(IEntityDetector?) concept which constructs/detects entities based on the registered implementations (similar toResourceBuilder). - Add detectors for any relevant entities (
service,telemetry,environment?) based on the stability and which entities map to resources we already detect in the SDK. For instance,processwould be out of scope as the resource detector for that would be in the opentelemetry-dotnet-contrib repo, which would need this infrastructure to depend on to implement. A similar situation would apply for thecloudresources for AWS, Azure and GCP and forhost, etc..
- Add a new interface similar to
-
Add support for entity propagation (
OTEL_ENTITIES):- Add a detector that automatically registers entities specified by and parsed from environment variables.
-
Add support for entity events:
- Emit the relevant events (
entity.state,entity.delete) as log records. - To support periodic-reporting, we could consider adding a hosted service to emit the events on a schedule.
- Emit the relevant events (
-
Add support for entities to any relevant exporters
- Populate
entity_refsfor resources in the OTLP exporter - Print details about entities in the console exporter
- Populate
The intent of this issue is to be a high-level tracking issue for the work required to realise implementing this in the .NET SDK. Any leveraging of this support in open-telemetry/opentelemetry-dotnet-contrib is out-of-scope (at least for now).
Metadata
Metadata
Assignees
Labels
Type
Fields
Priority
Start date
Target date
Effort
Activity
martincostello commentedon Sep 8, 2026
I had Claude Code write a proof-of-concept implementation of the above to help guide further discussion around adding support for entities. The commit for the PoC which adds support for service and telemetry entities with console and OTLP export can be found here: martincostello@7f0d6d6
The public API additions that fall out of that prototype are shown below:
The PoC wired entity detection into resource detection (e.g. extending
ResourceandResourceBuilder), but I'm not 100% convinced that's right approach. As they're in a different section of the spec, it seems to me that they should be their own "thing", but I'm open to being persuaded otherwise.stevejgordon commentedon Oct 21, 2026
FYI, there is now a Resource Provider (Development) in the Resource SDK spec. It runs the configured detectors, merges their results in configured order using the entity-aware merge algorithm, and is responsible for building a new
Resourceas async entity attributes resolve.That seems relevant to the open question in the PoC about whether entity detection belongs in
ResourceBuilderor somewhere separate. The spec now points to the Resource Provider as the component that combines entity detection with resource detection and merging.Java has a first step in open-telemetry/opentelemetry-java#8865: an internal
SdkResourceProviderthat the tracer/meter/logger providers can share. It only handles constant resources for now. Refresh and async detection are deferred.For .NET, most of the static part is already covered by
ResourceBuilderandGetResource(), so perhaps we should track the Resource Provider as part of this issue rather than separately?