Skip to content

Commit f1f655b

Browse files
authored
Add override_value to mdatagen (#15112)
Fixes #15109 Workflow: - Implement `Validate` method to verify the override value in the startup of otel collector. - Use parsed value in `Emit` method.
1 parent 348822a commit f1f655b

43 files changed

Lines changed: 3027 additions & 247 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Use this changelog template to create an entry for release notes.
2+
3+
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
4+
change_type: enhancement
5+
6+
# The name of the component, e.g. pkg/confighttp, receiver/otlp, exporter/debug
7+
component: cmd/mdatagen
8+
9+
# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
10+
note: Add opt-in override_value support for resource_attributes config via `override_value_enabled` flag
11+
12+
# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists.
13+
issues: [15109]
14+
15+
# (Optional) One or more lines of additional information to render under the primary note.
16+
# These lines will be padded with 2 spaces and then inserted directly into the document.
17+
# Use pipe (|) for multiline entries.
18+
subtext: |
19+
Components can opt in by setting `override_value_enabled: true` in their metadata.yaml.
20+
When enabled, per-attribute config types are generated with typed `override_value` fields
21+
that let users override resource attribute values in the collector configuration.
22+
Components without the flag continue to use the shared `ResourceAttributeConfig` type.
23+
24+
change_logs: [api]

cmd/mdatagen/go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ require (
1212
go.opentelemetry.io/collector/config/configoptional v1.56.0
1313
go.opentelemetry.io/collector/confmap v1.56.0
1414
go.opentelemetry.io/collector/confmap/provider/fileprovider v1.56.0
15+
go.opentelemetry.io/collector/confmap/xconfmap v0.150.0
1516
go.opentelemetry.io/collector/connector v0.150.0
1617
go.opentelemetry.io/collector/connector/connectortest v0.150.0
1718
go.opentelemetry.io/collector/connector/xconnector v0.150.0
@@ -86,7 +87,6 @@ require (
8687
go.opentelemetry.io/collector/config/confignet v1.56.0 // indirect
8788
go.opentelemetry.io/collector/config/configopaque v1.56.0 // indirect
8889
go.opentelemetry.io/collector/config/configtls v1.56.0 // indirect
89-
go.opentelemetry.io/collector/confmap/xconfmap v0.150.0 // indirect
9090
go.opentelemetry.io/collector/consumer/consumererror v0.150.0 // indirect
9191
go.opentelemetry.io/collector/extension/extensionauth v1.56.0 // indirect
9292
go.opentelemetry.io/collector/extension/extensionmiddleware v0.150.0 // indirect

cmd/mdatagen/internal/loader_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ func TestLoadMetadata(t *testing.T) {
5353
SemConvVersion: "1.40.0",
5454
PackageName: "go.opentelemetry.io/collector/cmd/mdatagen/internal/samplereceiver",
5555
ReaggregationEnabled: true,
56+
OverrideValueEnabled: true,
5657
Status: &Status{
5758
DisableCodeCov: true,
5859
Class: "receiver",

cmd/mdatagen/internal/metadata.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ type Metadata struct {
3535
Status *Status `mapstructure:"status"`
3636
// Spatial Re-aggregation featuregate.
3737
ReaggregationEnabled bool `mapstructure:"reaggregation_enabled"`
38+
// Override value featuregate for resource attributes.
39+
OverrideValueEnabled bool `mapstructure:"override_value_enabled"`
3840
// The name of the package that will be generated.
3941
GeneratedPackageName string `mapstructure:"generated_package_name"`
4042
// Telemetry information for the component.

cmd/mdatagen/internal/sampleconnector/internal/metadata/generated_config.go

Lines changed: 260 additions & 19 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)