Resource
This file tracks compliance for cross-cutting OpenTelemetry resource SDK requirements in this repository.
resource/sdk.md checklist
| Area | Requirement | Status | Evidence | Notes |
|---|---|---|---|---|
| Logs resource association | Provider resource applies to produced telemetry | Compliant | SdkLoggerProvider.scala, SdkLoggerProvider.scala, LogsProtoEncoder.scala | Provider defaults to SDK resource and attaches it to log records exported as ResourceLogs. |
| Metrics resource association | Provider resource applies to produced telemetry | Compliant | SdkMeterProvider.scala, SdkMeterProvider.scala, MetricsProtoEncoder.scala | Provider defaults to SDK resource and merges/propagates it into exported ResourceMetrics. |
| Trace resource association | Provider resource applies to produced telemetry | Compliant | SdkTracerProvider.scala, SdkTracerProvider.scala, SpansProtoEncoder.scala | Provider defaults to SDK resource, supports resource merge, and exports grouped ResourceSpans. |
| SDK-provided default resource | SDK MUST provide default resource attributes and use them when no explicit resource is provided | Compliant | TelemetryResource.scala, TelemetryResourceAutoConfigure.scala, TelemetryResourceAutoConfigureSuite.scala | SDK default resource includes service.name and telemetry.sdk.*, and autoconfigure falls back to this default resource. |
Resource creation (Create) |
SDK MUST support creating a resource from attributes with optional schema URL | Compliant | TelemetryResource.scala | Constructors support both TelemetryResource(attributes) and TelemetryResource(attributes, schemaUrl). |
| Resource merge attributes precedence | Merge MUST include keys from both resources and prefer updating resource values | Compliant | TelemetryResource.scala, TelemetryResourceSuite.scala, TelemetryResourceProps.scala | Merge is implemented with `attributes |
| Resource merge schema URL rules | Merge schema URL selection and mismatch behavior | Compliant | TelemetryResource.scala, TelemetryResourceSuite.scala | Empty/non-empty and equal-schema cases follow spec; different non-empty schema URLs produce SchemaUrlConflict, which is acceptable for undefined-result merge errors. |
| Empty resource operation | SDK SHOULD provide a way to quickly create an empty resource | Compliant | TelemetryResource.scala, TelemetryResource.scala | TelemetryResource.empty provides a fast empty resource singleton. |
| Detector packages and registration | Custom detectors for platform/vendor environments MUST be separate from the SDK package and return resources | Compliant | AwsEc2Detector.scala, TelemetryResourceDetector.scala, TelemetryResourceAutoConfigure.scala | Vendor detectors live in sdk-contrib and integrate via the TelemetryResourceDetector API as extra detectors. |
| Detector merge and error handling | Detection failures MUST NOT be treated as resource absence errors; detector errors SHOULD be reported | Compliant | TelemetryResourceAutoConfigure.scala, TelemetryResourceAutoConfigure.scala | Individual detector failures are logged and ignored (None), while successful detector results are merged into one resource. |
| Detector schema URL semantics | Detectors that populate semantic-convention attributes MUST set matching schema URL; conflicting non-empty schema URLs MUST error | Compliant | TelemetryResource.scala, TelemetryResourceAutoConfigure.scala, TelemetryResourceDetectorSuite.scala | Built-in detectors produce semconv attributes with SchemaUrls.Current; merge conflict on different non-empty schema URLs fails fast via mergeUnsafe. |
| Resource detector names | Detectors SHOULD have unique snake_case names; SDK SHOULD report duplicate names | Compliant | HostDetector.scala, ProcessRuntimeDetector.scala, TelemetryResourceAutoConfigure.scala, TelemetryResourceAutoConfigure.scala, TelemetryResourceAutoConfigureSuite.scala | Built-in detectors keep stable snake_case names, and auto-configuration now validates detector-name uniqueness and fails fast with a configuration error when duplicates are registered (including custom collisions). |
| Env resource attributes | Load resource from environment variables | Compliant | TelemetryResourceAutoConfigure.scala, TelemetryResourceAutoConfigure.scala, TelemetryResourceAutoConfigureSuite.scala | Supports OTEL_RESOURCE_ATTRIBUTES and OTEL_SERVICE_NAME with precedence and decoding. |
| Resource operations: retrieve attributes | SDK SHOULD provide a way to retrieve a read-only collection of resource attributes | Compliant | TelemetryResource.scala, TelemetryResourceProps.scala | TelemetryResource exposes attributes as immutable data and supports enumeration-centric access in tests and SDK logic. |