From 6d6bccfa3f6cfc55bbb6c951f068c7dcad92d753 Mon Sep 17 00:00:00 2001 From: Gjermund Garaba Date: Wed, 25 Feb 2026 13:20:22 +0100 Subject: [PATCH 1/4] feat(telemetry): export ExtraConfig and CosmosExtra types Export the otel.yaml Cosmos extension types so external consumers (e.g. platform tooling) can programmatically build otel configs without maintaining manual YAML templates. --- telemetry/config.go | 13 ++++++++----- telemetry/config_test.go | 32 ++++++++++++++++---------------- 2 files changed, 24 insertions(+), 21 deletions(-) diff --git a/telemetry/config.go b/telemetry/config.go index 4191733bc392..05b28c89cd09 100644 --- a/telemetry/config.go +++ b/telemetry/config.go @@ -85,7 +85,7 @@ func InitializeOpenTelemetry(filePath string) error { opts = append(opts, otelconf.WithOpenTelemetryConfiguration(*cfg)) // parse cosmos extra config - var extraCfg extraConfig + var extraCfg ExtraConfig err = yaml.Unmarshal(bz, &extraCfg) if err == nil { if extraCfg.CosmosExtra != nil { @@ -159,11 +159,14 @@ func setNoop() { logglobal.SetLoggerProvider(lognoop.NewLoggerProvider()) } -type extraConfig struct { - CosmosExtra *cosmosExtra `json:"cosmos_extra" yaml:"cosmos_extra" mapstructure:"cosmos_extra"` +// ExtraConfig is the top-level wrapper for Cosmos-specific OpenTelemetry extensions. +// It is intended to be marshaled alongside an [otelconf.OpenTelemetryConfiguration] +// to produce a complete otel.yaml file. +type ExtraConfig struct { + CosmosExtra *CosmosExtra `json:"cosmos_extra" yaml:"cosmos_extra" mapstructure:"cosmos_extra"` } -// cosmosExtra provides extensions to the OpenTelemetry declarative configuration. +// CosmosExtra provides extensions to the OpenTelemetry declarative configuration. // These options allow features not yet supported by otelconf, such as writing traces/metrics/logs to local // files, enabling additional host/runtime instrumentation, and configuring custom propagators. // @@ -171,7 +174,7 @@ type extraConfig struct { // augment/override portions of the OpenTelemetry SDK initialization. // // For an example configuration, see the README in this package. -type cosmosExtra struct { +type CosmosExtra struct { // TraceFile is an optional path to a file where spans should be exported // using the stdouttrace exporter. If empty, no file-based trace export is // configured. diff --git a/telemetry/config_test.go b/telemetry/config_test.go index ebe3b186203f..12c280535d43 100644 --- a/telemetry/config_test.go +++ b/telemetry/config_test.go @@ -11,7 +11,7 @@ func TestCosmosExtraUnmarshal(t *testing.T) { tests := []struct { name string yaml string - expected extraConfig + expected ExtraConfig }{ { name: "instruments with empty config", @@ -21,8 +21,8 @@ cosmos_extra: host: {} runtime: {} `, - expected: extraConfig{ - CosmosExtra: &cosmosExtra{ + expected: ExtraConfig{ + CosmosExtra: &CosmosExtra{ Instruments: map[string]map[string]any{ "host": {}, "runtime": {}, @@ -39,8 +39,8 @@ cosmos_extra: diskio: disable_virtual_device_filter: true `, - expected: extraConfig{ - CosmosExtra: &cosmosExtra{ + expected: ExtraConfig{ + CosmosExtra: &CosmosExtra{ Instruments: map[string]map[string]any{ "host": {}, "diskio": { @@ -60,8 +60,8 @@ cosmos_extra: - tracecontext - baggage `, - expected: extraConfig{ - CosmosExtra: &cosmosExtra{ + expected: ExtraConfig{ + CosmosExtra: &CosmosExtra{ Instruments: map[string]map[string]any{ "host": {}, }, @@ -83,8 +83,8 @@ cosmos_extra: propagators: - tracecontext `, - expected: extraConfig{ - CosmosExtra: &cosmosExtra{ + expected: ExtraConfig{ + CosmosExtra: &CosmosExtra{ TraceFile: "/tmp/traces.json", MetricsFile: "/tmp/metrics.json", Instruments: map[string]map[string]any{ @@ -103,7 +103,7 @@ cosmos_extra: yaml: ` cosmos_extra: `, - expected: extraConfig{ + expected: ExtraConfig{ CosmosExtra: nil, // YAML with just "cosmos_extra:" and no value results in nil }, }, @@ -112,8 +112,8 @@ cosmos_extra: yaml: ` cosmos_extra: {} `, - expected: extraConfig{ - CosmosExtra: &cosmosExtra{}, + expected: ExtraConfig{ + CosmosExtra: &CosmosExtra{}, }, }, { @@ -121,7 +121,7 @@ cosmos_extra: {} yaml: ` some_other_key: value `, - expected: extraConfig{ + expected: ExtraConfig{ CosmosExtra: nil, }, }, @@ -158,8 +158,8 @@ cosmos_extra: propagators: - tracecontext `, - expected: extraConfig{ - CosmosExtra: &cosmosExtra{ + expected: ExtraConfig{ + CosmosExtra: &CosmosExtra{ Instruments: map[string]map[string]any{ "host": {}, "runtime": {}, @@ -175,7 +175,7 @@ cosmos_extra: for _, tc := range tests { t.Run(tc.name, func(t *testing.T) { - var cfg extraConfig + var cfg ExtraConfig err := yaml.Unmarshal([]byte(tc.yaml), &cfg) require.NoError(t, err) From 7664b3ebce19a046ecc4a2ab2435fc53f745b212 Mon Sep 17 00:00:00 2001 From: Gjermund Garaba Date: Wed, 25 Feb 2026 13:46:01 +0100 Subject: [PATCH 2/4] docs: add changelog entry for exported telemetry types --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2a7644d44f8e..dee6e3e1c26b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -79,6 +79,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ ### Improvements +* (telemetry) [#26006](https://github.com/cosmos/cosmos-sdk/pull/26006) Export `ExtraConfig` and `CosmosExtra` types for programmatic otel.yaml generation. * [#25955](https://github.com/cosmos/cosmos-sdk/pull/25955) Use cosmos/btree directly instead of replacing it in go.mods * (types) [#25342](https://github.com/cosmos/cosmos-sdk/pull/25342) Undeprecated `EmitEvent` and `EmitEvents` on the `EventManager`. These functions will continue to be maintained. * (types) [#24668](https://github.com/cosmos/cosmos-sdk/pull/24668) Scope the global config to a particular binary so that multiple SDK binaries can be properly run on the same machine. From b11604f1f70b79a2b60afb2a10f3400d4258e1a7 Mon Sep 17 00:00:00 2001 From: Gjermund Garaba Date: Fri, 27 Feb 2026 07:30:13 +0100 Subject: [PATCH 3/4] refactor(telemetry): rename exported types and simplify config parsing MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Rename CosmosExtra to SupplementalOptions since the config is not Cosmos-specific — it fills gaps in upstream otelconf. Drop the ExtraConfig/OTelConfig wrapper types and the double-parse in InitializeOpenTelemetry, keeping only SupplementalOptions as the single exported type. Co-Authored-By: Claude Opus 4.6 --- CHANGELOG.md | 2 +- telemetry/config.go | 56 ++++++++++------------ telemetry/config_test.go | 100 +++++++++++++++++---------------------- 3 files changed, 68 insertions(+), 90 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index dee6e3e1c26b..7ae23970ceb0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -79,7 +79,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ ### Improvements -* (telemetry) [#26006](https://github.com/cosmos/cosmos-sdk/pull/26006) Export `ExtraConfig` and `CosmosExtra` types for programmatic otel.yaml generation. +* (telemetry) [#26006](https://github.com/cosmos/cosmos-sdk/pull/26006) Export `SupplementalOptions` type for programmatic otel.yaml generation. * [#25955](https://github.com/cosmos/cosmos-sdk/pull/25955) Use cosmos/btree directly instead of replacing it in go.mods * (types) [#25342](https://github.com/cosmos/cosmos-sdk/pull/25342) Undeprecated `EmitEvent` and `EmitEvents` on the `EventManager`. These functions will continue to be maintained. * (types) [#24668](https://github.com/cosmos/cosmos-sdk/pull/24668) Scope the global config to a particular binary so that multiple SDK binaries can be properly run on the same machine. diff --git a/telemetry/config.go b/telemetry/config.go index 05b28c89cd09..77c5e9b764ae 100644 --- a/telemetry/config.go +++ b/telemetry/config.go @@ -56,7 +56,6 @@ func InitializeOpenTelemetry(filePath string) error { if openTelemetrySDK != nil { return nil } - var err error var opts []otelconf.ConfigurationOption @@ -84,29 +83,28 @@ func InitializeOpenTelemetry(filePath string) error { opts = append(opts, otelconf.WithOpenTelemetryConfiguration(*cfg)) - // parse cosmos extra config - var extraCfg ExtraConfig - err = yaml.Unmarshal(bz, &extraCfg) - if err == nil { - if extraCfg.CosmosExtra != nil { - extra := *extraCfg.CosmosExtra - for name, cfg := range extra.Instruments { - inst := registry.Get(name) - if inst == nil { - return fmt.Errorf("unknown instrument: %s", name) - } - fmt.Printf("Initializing %s instrumentation\n", name) - if err := inst.Start(cfg); err != nil { - return fmt.Errorf("failed to start %s instrumentation: %w", name, err) - } + // parse supplemental config (features not yet supported by otelconf) + var supplemental struct { + CosmosExtra *SupplementalOptions `yaml:"cosmos_extra"` + } + if err := yaml.Unmarshal(bz, &supplemental); err == nil && supplemental.CosmosExtra != nil { + extra := *supplemental.CosmosExtra + for name, cfg := range extra.Instruments { + inst := registry.Get(name) + if inst == nil { + return fmt.Errorf("unknown instrument: %s", name) } - - // TODO: this code should be removed once propagation is properly supported by otelconf. - if len(extra.Propagators) > 0 { - propagator := initPropagator(extra.Propagators) - otel.SetTextMapPropagator(propagator) + fmt.Printf("Initializing %s instrumentation\n", name) + if err := inst.Start(cfg); err != nil { + return fmt.Errorf("failed to start %s instrumentation: %w", name, err) } } + + // TODO: this code should be removed once propagation is properly supported by otelconf. + if len(extra.Propagators) > 0 { + propagator := initPropagator(extra.Propagators) + otel.SetTextMapPropagator(propagator) + } } otelSDK, err := otelconf.NewSDK(opts...) @@ -159,22 +157,16 @@ func setNoop() { logglobal.SetLoggerProvider(lognoop.NewLoggerProvider()) } -// ExtraConfig is the top-level wrapper for Cosmos-specific OpenTelemetry extensions. -// It is intended to be marshaled alongside an [otelconf.OpenTelemetryConfiguration] -// to produce a complete otel.yaml file. -type ExtraConfig struct { - CosmosExtra *CosmosExtra `json:"cosmos_extra" yaml:"cosmos_extra" mapstructure:"cosmos_extra"` -} - -// CosmosExtra provides extensions to the OpenTelemetry declarative configuration. -// These options allow features not yet supported by otelconf, such as writing traces/metrics/logs to local -// files, enabling additional host/runtime instrumentation, and configuring custom propagators. +// SupplementalOptions provides configuration for OpenTelemetry features not yet +// supported by [otelconf], such as writing traces/metrics/logs to local files, +// enabling additional host/runtime instrumentation, and configuring custom +// propagators. // // When present in otel.yaml under the `cosmos_extra` key, these fields // augment/override portions of the OpenTelemetry SDK initialization. // // For an example configuration, see the README in this package. -type CosmosExtra struct { +type SupplementalOptions struct { // TraceFile is an optional path to a file where spans should be exported // using the stdouttrace exporter. If empty, no file-based trace export is // configured. diff --git a/telemetry/config_test.go b/telemetry/config_test.go index 12c280535d43..aacfeba56a71 100644 --- a/telemetry/config_test.go +++ b/telemetry/config_test.go @@ -7,11 +7,11 @@ import ( "go.yaml.in/yaml/v3" ) -func TestCosmosExtraUnmarshal(t *testing.T) { +func TestSupplementalOptionsUnmarshal(t *testing.T) { tests := []struct { name string yaml string - expected ExtraConfig + expected *SupplementalOptions }{ { name: "instruments with empty config", @@ -21,12 +21,10 @@ cosmos_extra: host: {} runtime: {} `, - expected: ExtraConfig{ - CosmosExtra: &CosmosExtra{ - Instruments: map[string]map[string]any{ - "host": {}, - "runtime": {}, - }, + expected: &SupplementalOptions{ + Instruments: map[string]map[string]any{ + "host": {}, + "runtime": {}, }, }, }, @@ -39,13 +37,11 @@ cosmos_extra: diskio: disable_virtual_device_filter: true `, - expected: ExtraConfig{ - CosmosExtra: &CosmosExtra{ - Instruments: map[string]map[string]any{ - "host": {}, - "diskio": { - "disable_virtual_device_filter": true, - }, + expected: &SupplementalOptions{ + Instruments: map[string]map[string]any{ + "host": {}, + "diskio": { + "disable_virtual_device_filter": true, }, }, }, @@ -60,13 +56,11 @@ cosmos_extra: - tracecontext - baggage `, - expected: ExtraConfig{ - CosmosExtra: &CosmosExtra{ - Instruments: map[string]map[string]any{ - "host": {}, - }, - Propagators: []string{"tracecontext", "baggage"}, + expected: &SupplementalOptions{ + Instruments: map[string]map[string]any{ + "host": {}, }, + Propagators: []string{"tracecontext", "baggage"}, }, }, { @@ -83,19 +77,17 @@ cosmos_extra: propagators: - tracecontext `, - expected: ExtraConfig{ - CosmosExtra: &CosmosExtra{ - TraceFile: "/tmp/traces.json", - MetricsFile: "/tmp/metrics.json", - Instruments: map[string]map[string]any{ - "host": {}, - "runtime": {}, - "diskio": { - "disable_virtual_device_filter": true, - }, + expected: &SupplementalOptions{ + TraceFile: "/tmp/traces.json", + MetricsFile: "/tmp/metrics.json", + Instruments: map[string]map[string]any{ + "host": {}, + "runtime": {}, + "diskio": { + "disable_virtual_device_filter": true, }, - Propagators: []string{"tracecontext"}, }, + Propagators: []string{"tracecontext"}, }, }, { @@ -103,27 +95,21 @@ cosmos_extra: yaml: ` cosmos_extra: `, - expected: ExtraConfig{ - CosmosExtra: nil, // YAML with just "cosmos_extra:" and no value results in nil - }, + expected: nil, }, { name: "empty cosmos_extra (empty object)", yaml: ` cosmos_extra: {} `, - expected: ExtraConfig{ - CosmosExtra: &CosmosExtra{}, - }, + expected: &SupplementalOptions{}, }, { name: "no cosmos_extra", yaml: ` some_other_key: value `, - expected: ExtraConfig{ - CosmosExtra: nil, - }, + expected: nil, }, { name: "realistic otel.yaml with cosmos_extra", @@ -158,41 +144,41 @@ cosmos_extra: propagators: - tracecontext `, - expected: ExtraConfig{ - CosmosExtra: &CosmosExtra{ - Instruments: map[string]map[string]any{ - "host": {}, - "runtime": {}, - "diskio": { - "disable_virtual_device_filter": true, - }, + expected: &SupplementalOptions{ + Instruments: map[string]map[string]any{ + "host": {}, + "runtime": {}, + "diskio": { + "disable_virtual_device_filter": true, }, - Propagators: []string{"tracecontext"}, }, + Propagators: []string{"tracecontext"}, }, }, } for _, tc := range tests { t.Run(tc.name, func(t *testing.T) { - var cfg ExtraConfig + var cfg struct { + CosmosExtra *SupplementalOptions `yaml:"cosmos_extra"` + } err := yaml.Unmarshal([]byte(tc.yaml), &cfg) require.NoError(t, err) - if tc.expected.CosmosExtra == nil { + if tc.expected == nil { require.Nil(t, cfg.CosmosExtra) return } require.NotNil(t, cfg.CosmosExtra) - require.Equal(t, tc.expected.CosmosExtra.TraceFile, cfg.CosmosExtra.TraceFile) - require.Equal(t, tc.expected.CosmosExtra.MetricsFile, cfg.CosmosExtra.MetricsFile) - require.Equal(t, tc.expected.CosmosExtra.Propagators, cfg.CosmosExtra.Propagators) + require.Equal(t, tc.expected.TraceFile, cfg.CosmosExtra.TraceFile) + require.Equal(t, tc.expected.MetricsFile, cfg.CosmosExtra.MetricsFile) + require.Equal(t, tc.expected.Propagators, cfg.CosmosExtra.Propagators) - require.Equal(t, len(tc.expected.CosmosExtra.Instruments), len(cfg.CosmosExtra.Instruments), + require.Equal(t, len(tc.expected.Instruments), len(cfg.CosmosExtra.Instruments), "instruments count mismatch") - for name, expectedOpts := range tc.expected.CosmosExtra.Instruments { + for name, expectedOpts := range tc.expected.Instruments { actualOpts, ok := cfg.CosmosExtra.Instruments[name] require.True(t, ok, "missing instrument: %s", name) require.Equal(t, len(expectedOpts), len(actualOpts), From 348ead02dfbbeb3be1551064f4741bcf6011eeb5 Mon Sep 17 00:00:00 2001 From: Gjermund Garaba Date: Mon, 2 Mar 2026 14:51:53 +0100 Subject: [PATCH 4/4] refactor(telemetry): rename supplemental config to extensions --- CHANGELOG.md | 2 +- telemetry/README.md | 2 +- telemetry/config.go | 14 +++++------ telemetry/config_test.go | 54 ++++++++++++++++++++-------------------- 4 files changed, 36 insertions(+), 36 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7ae23970ceb0..019aeef7dd35 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -79,7 +79,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ ### Improvements -* (telemetry) [#26006](https://github.com/cosmos/cosmos-sdk/pull/26006) Export `SupplementalOptions` type for programmatic otel.yaml generation. +* (telemetry) [#26006](https://github.com/cosmos/cosmos-sdk/pull/26006) Export `ExtensionOptions` type for programmatic otel.yaml generation. * [#25955](https://github.com/cosmos/cosmos-sdk/pull/25955) Use cosmos/btree directly instead of replacing it in go.mods * (types) [#25342](https://github.com/cosmos/cosmos-sdk/pull/25342) Undeprecated `EmitEvent` and `EmitEvents` on the `EventManager`. These functions will continue to be maintained. * (types) [#24668](https://github.com/cosmos/cosmos-sdk/pull/24668) Scope the global config to a particular binary so that multiple SDK binaries can be properly run on the same machine. diff --git a/telemetry/README.md b/telemetry/README.md index 7b6e4f4af0aa..bdd684524424 100644 --- a/telemetry/README.md +++ b/telemetry/README.md @@ -56,7 +56,7 @@ logger_provider: endpoint: http://localhost:4317 -cosmos_extra: +extensions: instruments: host: {} # enable optional host instrumentation with go.opentelemetry.io/contrib/instrumentation/host runtime: {} # enable optional runtime instrumentation with go.opentelemetry.io/contrib/instrumentation/runtime diff --git a/telemetry/config.go b/telemetry/config.go index 77c5e9b764ae..fd9d7d9880a8 100644 --- a/telemetry/config.go +++ b/telemetry/config.go @@ -83,12 +83,12 @@ func InitializeOpenTelemetry(filePath string) error { opts = append(opts, otelconf.WithOpenTelemetryConfiguration(*cfg)) - // parse supplemental config (features not yet supported by otelconf) + // parse extensions config (features not yet supported by otelconf) var supplemental struct { - CosmosExtra *SupplementalOptions `yaml:"cosmos_extra"` + Extensions *ExtensionOptions `yaml:"extensions"` } - if err := yaml.Unmarshal(bz, &supplemental); err == nil && supplemental.CosmosExtra != nil { - extra := *supplemental.CosmosExtra + if err := yaml.Unmarshal(bz, &supplemental); err == nil && supplemental.Extensions != nil { + extra := *supplemental.Extensions for name, cfg := range extra.Instruments { inst := registry.Get(name) if inst == nil { @@ -157,16 +157,16 @@ func setNoop() { logglobal.SetLoggerProvider(lognoop.NewLoggerProvider()) } -// SupplementalOptions provides configuration for OpenTelemetry features not yet +// ExtensionOptions provides configuration for OpenTelemetry features not yet // supported by [otelconf], such as writing traces/metrics/logs to local files, // enabling additional host/runtime instrumentation, and configuring custom // propagators. // -// When present in otel.yaml under the `cosmos_extra` key, these fields +// When present in otel.yaml under the `extensions` key, these fields // augment/override portions of the OpenTelemetry SDK initialization. // // For an example configuration, see the README in this package. -type SupplementalOptions struct { +type ExtensionOptions struct { // TraceFile is an optional path to a file where spans should be exported // using the stdouttrace exporter. If empty, no file-based trace export is // configured. diff --git a/telemetry/config_test.go b/telemetry/config_test.go index aacfeba56a71..f557992cad08 100644 --- a/telemetry/config_test.go +++ b/telemetry/config_test.go @@ -7,21 +7,21 @@ import ( "go.yaml.in/yaml/v3" ) -func TestSupplementalOptionsUnmarshal(t *testing.T) { +func TestExtensionOptionsUnmarshal(t *testing.T) { tests := []struct { name string yaml string - expected *SupplementalOptions + expected *ExtensionOptions }{ { name: "instruments with empty config", yaml: ` -cosmos_extra: +extensions: instruments: host: {} runtime: {} `, - expected: &SupplementalOptions{ + expected: &ExtensionOptions{ Instruments: map[string]map[string]any{ "host": {}, "runtime": {}, @@ -31,13 +31,13 @@ cosmos_extra: { name: "instruments with options", yaml: ` -cosmos_extra: +extensions: instruments: host: {} diskio: disable_virtual_device_filter: true `, - expected: &SupplementalOptions{ + expected: &ExtensionOptions{ Instruments: map[string]map[string]any{ "host": {}, "diskio": { @@ -49,14 +49,14 @@ cosmos_extra: { name: "instruments with propagators", yaml: ` -cosmos_extra: +extensions: instruments: host: {} propagators: - tracecontext - baggage `, - expected: &SupplementalOptions{ + expected: &ExtensionOptions{ Instruments: map[string]map[string]any{ "host": {}, }, @@ -66,7 +66,7 @@ cosmos_extra: { name: "full config", yaml: ` -cosmos_extra: +extensions: trace_file: /tmp/traces.json metrics_file: /tmp/metrics.json instruments: @@ -77,7 +77,7 @@ cosmos_extra: propagators: - tracecontext `, - expected: &SupplementalOptions{ + expected: &ExtensionOptions{ TraceFile: "/tmp/traces.json", MetricsFile: "/tmp/metrics.json", Instruments: map[string]map[string]any{ @@ -91,28 +91,28 @@ cosmos_extra: }, }, { - name: "empty cosmos_extra (null)", + name: "empty extensions (null)", yaml: ` -cosmos_extra: +extensions: `, expected: nil, }, { - name: "empty cosmos_extra (empty object)", + name: "empty extensions (empty object)", yaml: ` -cosmos_extra: {} +extensions: {} `, - expected: &SupplementalOptions{}, + expected: &ExtensionOptions{}, }, { - name: "no cosmos_extra", + name: "no extensions", yaml: ` some_other_key: value `, expected: nil, }, { - name: "realistic otel.yaml with cosmos_extra", + name: "realistic otel.yaml with extensions", yaml: ` file_format: "1.0-rc.3" resource: @@ -135,7 +135,7 @@ meter_provider: host: 0.0.0.0 port: 9464 -cosmos_extra: +extensions: instruments: host: {} runtime: {} @@ -144,7 +144,7 @@ cosmos_extra: propagators: - tracecontext `, - expected: &SupplementalOptions{ + expected: &ExtensionOptions{ Instruments: map[string]map[string]any{ "host": {}, "runtime": {}, @@ -160,26 +160,26 @@ cosmos_extra: for _, tc := range tests { t.Run(tc.name, func(t *testing.T) { var cfg struct { - CosmosExtra *SupplementalOptions `yaml:"cosmos_extra"` + Extensions *ExtensionOptions `yaml:"extensions"` } err := yaml.Unmarshal([]byte(tc.yaml), &cfg) require.NoError(t, err) if tc.expected == nil { - require.Nil(t, cfg.CosmosExtra) + require.Nil(t, cfg.Extensions) return } - require.NotNil(t, cfg.CosmosExtra) - require.Equal(t, tc.expected.TraceFile, cfg.CosmosExtra.TraceFile) - require.Equal(t, tc.expected.MetricsFile, cfg.CosmosExtra.MetricsFile) - require.Equal(t, tc.expected.Propagators, cfg.CosmosExtra.Propagators) + require.NotNil(t, cfg.Extensions) + require.Equal(t, tc.expected.TraceFile, cfg.Extensions.TraceFile) + require.Equal(t, tc.expected.MetricsFile, cfg.Extensions.MetricsFile) + require.Equal(t, tc.expected.Propagators, cfg.Extensions.Propagators) - require.Equal(t, len(tc.expected.Instruments), len(cfg.CosmosExtra.Instruments), + require.Equal(t, len(tc.expected.Instruments), len(cfg.Extensions.Instruments), "instruments count mismatch") for name, expectedOpts := range tc.expected.Instruments { - actualOpts, ok := cfg.CosmosExtra.Instruments[name] + actualOpts, ok := cfg.Extensions.Instruments[name] require.True(t, ok, "missing instrument: %s", name) require.Equal(t, len(expectedOpts), len(actualOpts), "options count mismatch for instrument %s", name)