Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
779ad60
Add typed collector resource attributes based on declarative config
iblancasa Feb 27, 2026
5342460
Apply changes requested in code review
iblancasa Mar 5, 2026
9e4288c
Merge branch 'main' of github.com:open-telemetry/opentelemetry-collec…
iblancasa Mar 6, 2026
7e09141
Merge branch 'main' into 14441
jade-guiton-dd Apr 7, 2026
2555c5f
Apply review suggestions and use SDK Resource
jade-guiton-dd Apr 7, 2026
5af156b
Merge remote-tracking branch 'jade/14441' into 14411
iblancasa Apr 9, 2026
d198bae
Fix lint
iblancasa Apr 9, 2026
3da82c4
Merge branch 'main' into 14411
iblancasa Apr 9, 2026
ca658d2
Apply nit
iblancasa Apr 9, 2026
b968959
Merge branch '14411' of github.com:iblancasa/opentelemetry-collector …
iblancasa Apr 9, 2026
f1214f2
Merge branch 'main' of github.com:open-telemetry/opentelemetry-collec…
iblancasa Apr 13, 2026
dc09bb8
Fix tests
iblancasa Apr 13, 2026
1938e63
Merge branch 'main' into 14411
iblancasa Apr 13, 2026
44c14de
Apply feedback requested in code review
iblancasa Apr 14, 2026
9147a61
Merge branch 'main' of github.com:open-telemetry/opentelemetry-collec…
iblancasa Apr 14, 2026
2311d99
Merge branch '14411' of github.com:iblancasa/opentelemetry-collector …
iblancasa Apr 14, 2026
fbc1b98
Merge branch 'main' into 14411
iblancasa Apr 14, 2026
3e500a0
Merge branch 'main' into 14411
iblancasa Apr 15, 2026
1ce87bc
Apply changes requested in code review
iblancasa Apr 16, 2026
7ab38a9
Merge branch '14411' of github.com:iblancasa/opentelemetry-collector …
iblancasa Apr 16, 2026
9223a01
Merge branch 'main' of github.com:open-telemetry/opentelemetry-collec…
iblancasa Apr 16, 2026
d9374d5
Merge branch 'main' into 14411
iblancasa Apr 20, 2026
042ead4
Merge branch 'main' into 14411
iblancasa Apr 22, 2026
8a5f736
Merge branch '14411' of github.com:iblancasa/opentelemetry-collector …
iblancasa Apr 22, 2026
e6faeab
Merge branch 'main' of github.com:open-telemetry/opentelemetry-collec…
iblancasa Apr 22, 2026
b0f4a9e
Merge branch 'main' into 14411
iblancasa Apr 22, 2026
b84fcfc
Merge branch 'main' of github.com:open-telemetry/opentelemetry-collec…
iblancasa Apr 22, 2026
bcac1f2
Merge branch '14411' of github.com:iblancasa/opentelemetry-collector …
iblancasa Apr 22, 2026
d9a8d73
Increase coverage
iblancasa Apr 22, 2026
f2ca6ed
Merge branch 'main' into 14411
iblancasa Apr 23, 2026
16a01d6
Merge branch 'main' into 14411
iblancasa Apr 23, 2026
5642768
Merge branch 'main' into 14411
iblancasa Apr 24, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 48 additions & 0 deletions .chloggen/14411.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Use this changelog template to create an entry for release notes.

# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
change_type: enhancement

# The name of the component, or a single word describing the area of concern, (e.g. receiver/otlp)
component: all

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: Add declarative schema support for service telemetry resource configuration.

# One or more tracking issues or pull requests related to the change
issues: [14411]

# (Optional) One or more lines of additional information to render under the primary note.
# These lines will be padded with 2 spaces and then inserted directly into the document.
# Use pipe (|) for multiline entries.
subtext: |
The `service::telemetry::resource` configuration now accepts the declarative schema with explicit name/value pairs:
```yaml
service:
telemetry:
resource:
schema_url: https://opentelemetry.io/schemas/1.38.0
attributes:
- name: service.name
value: my-collector
- name: host.name
value: collector-host
```

The legacy inline attribute map format is still supported for backward compatibility:
```yaml
service:
telemetry:
resource:
service.name: my-collector
host.name: collector-host
```

Note: `resource.detectors` is accepted for forward compatibility but is not yet applied by the collector.

# Optional: The change log or logs in which this entry should be included.
# e.g. '[user]' or '[user, api]'
# Include 'user' if the change is relevant to end users.
# Include 'api' if there is a change to a library API.
# Default: '[user]'
change_logs: [user]
44 changes: 0 additions & 44 deletions service/internal/resource/config.go

This file was deleted.

169 changes: 0 additions & 169 deletions service/internal/resource/config_test.go

This file was deleted.

11 changes: 9 additions & 2 deletions service/telemetry/otelconftelemetry/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,11 @@ type Config struct {
// Resource specifies user-defined attributes to include with all emitted telemetry.
// Note that some attributes are added automatically (e.g. service.version) even
// if they are not specified here. In order to suppress such attributes the
// attribute must be specified in this map with null YAML value (nil string pointer).
Resource map[string]*string `mapstructure:"resource,omitempty"`
// attribute must be specified with a null value in the configuration.
//
// Supports both the declarative config resource schema and the legacy inline
// attribute map format for backward compatibility.
Resource ResourceConfig `mapstructure:"resource,omitempty"`
}

// LogsConfig defines the configurable settings for service telemetry logs.
Expand All @@ -41,6 +44,10 @@ type MetricsConfig = migration.MetricsConfigV030
// Experimental: *NOTE* this structure is subject to change or removal in the future.
type TracesConfig = migration.TracesConfigV030

// ResourceConfig exposes the configuration settings for the service telemetry resource.
// Experimental: *NOTE* this structure is subject to change or removal in the future.
type ResourceConfig = migration.ResourceConfigV030

// Validate checks whether the current configuration is valid
func (c *Config) Validate() error {
// Check when service telemetry metric level is not none, the metrics readers should not be empty
Expand Down
34 changes: 34 additions & 0 deletions service/telemetry/otelconftelemetry/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import (
"go.opentelemetry.io/collector/confmap"
"go.opentelemetry.io/collector/confmap/confmaptest"
"go.opentelemetry.io/collector/confmap/xconfmap"
"go.opentelemetry.io/collector/service/telemetry/otelconftelemetry/internal/migration"
)

func TestComponentConfigStruct(t *testing.T) {
Expand Down Expand Up @@ -126,3 +127,36 @@ func TestConfig(t *testing.T) {
})
}
}

func TestConfigMarshalResource(t *testing.T) {
cfg := createDefaultConfig().(*Config)
cfg.Resource = migration.ResourceConfigV030{
Resource: config.Resource{
Attributes: []config.AttributeNameValue{
{Name: "service.name", Value: "custom-service"},
},
},
LegacyAttributes: map[string]any{
"legacy.attr": "legacy-value",
"service.version": nil,
},
}

cm := confmap.New()
require.NoError(t, cm.Marshal(cfg))
raw := cm.ToStringMap()

resourceRaw, ok := raw["resource"].(map[string]any)
require.True(t, ok)
assert.Equal(t, "legacy-value", resourceRaw["legacy.attr"])
assert.Contains(t, resourceRaw, "service.version")
assert.Nil(t, resourceRaw["service.version"])

attrs, ok := resourceRaw["attributes"].([]any)
require.True(t, ok)
require.Len(t, attrs, 1)
attr, ok := attrs[0].(map[string]any)
require.True(t, ok)
assert.Equal(t, "service.name", attr["name"])
assert.Equal(t, "custom-service", attr["value"])
}
8 changes: 8 additions & 0 deletions service/telemetry/otelconftelemetry/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"time"

config "go.opentelemetry.io/contrib/otelconf/v0.3.0"
semconv "go.opentelemetry.io/otel/semconv/v1.40.0"
"go.uber.org/zap/zapcore"

"go.opentelemetry.io/collector/component"
Expand All @@ -33,6 +34,8 @@ func createDefaultConfig() component.Config {
metricsHost = ""
}

schemaURL := semconv.SchemaURL

return &Config{
Logs: LogsConfig{
Level: zapcore.InfoLevel,
Expand Down Expand Up @@ -67,6 +70,11 @@ func createDefaultConfig() component.Config {
},
},
},
Resource: ResourceConfig{
Resource: config.Resource{
SchemaUrl: &schemaURL,
},
},
}
}

Expand Down
Loading
Loading