From 10be8fe5f2d530816906171e9911bb2c15046fff Mon Sep 17 00:00:00 2001 From: Paulo Dias Date: Sat, 6 Sep 2025 09:37:00 +0100 Subject: [PATCH 01/10] [cmd/mdatagen] Add lint/ordering validation for metadata.yaml Signed-off-by: Paulo Dias --- .chloggen/feat_13781.yaml | 25 +++++++++ cmd/mdatagen/internal/command.go | 72 ++++++++++++++++++++++++++ cmd/mdatagen/internal/metadata.go | 7 ++- cmd/mdatagen/internal/metadata_test.go | 8 +-- 4 files changed, 102 insertions(+), 10 deletions(-) create mode 100644 .chloggen/feat_13781.yaml diff --git a/.chloggen/feat_13781.yaml b/.chloggen/feat_13781.yaml new file mode 100644 index 000000000000..be90457af7f3 --- /dev/null +++ b/.chloggen/feat_13781.yaml @@ -0,0 +1,25 @@ +# 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. otlpreceiver) +component: "cmd/mdatagen" + +# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). +note: "Add lint/ordering validation for metadata.yaml" + +# One or more tracking issues or pull requests related to the change +issues: [13781] + +# (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: + +# 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] diff --git a/cmd/mdatagen/internal/command.go b/cmd/mdatagen/internal/command.go index 0f4ca575530e..5bcfaa884a04 100644 --- a/cmd/mdatagen/internal/command.go +++ b/cmd/mdatagen/internal/command.go @@ -21,6 +21,7 @@ import ( "github.com/spf13/cobra" "golang.org/x/text/cases" "golang.org/x/text/language" + "gopkg.in/yaml.v3" ) const ( @@ -77,6 +78,15 @@ func run(ymlPath string) error { ymlDir := filepath.Dir(ymlPath) packageName := filepath.Base(ymlDir) + raw, readErr := os.ReadFile(ymlPath) + if readErr != nil { + return fmt.Errorf("failed reading %v: %w", ymlPath, readErr) + } + + if err := validateYAMLKeyOrder(raw); err != nil { + return fmt.Errorf("metadata.yaml ordering check failed: %w", err) + } + md, err := LoadMetadata(ymlPath) if err != nil { return fmt.Errorf("failed loading %v: %w", ymlPath, err) @@ -404,3 +414,65 @@ func generateFile(tmplFile, outputFile string, md Metadata, goPackage string) er return formatErr } + +func validateMappingKeysSorted(root *yaml.Node, path ...string) error { + // unwrap doc + n := root + if n.Kind == yaml.DocumentNode && len(n.Content) > 0 { + n = n.Content[0] + } + // follow path + for _, seg := range path { + if n.Kind != yaml.MappingNode { + return nil + } + var next *yaml.Node + for i := 0; i < len(n.Content); i += 2 { + if n.Content[i].Value == seg { + next = n.Content[i+1] + break + } + } + if next == nil { + return nil + } + n = next + } + if n.Kind != yaml.MappingNode { + return nil + } + + // collect keys + keys := make([]string, 0, len(n.Content)/2) + for i := 0; i < len(n.Content); i += 2 { + keys = append(keys, n.Content[i].Value) + } + sorted := append([]string(nil), keys...) + slices.Sort(sorted) + for i := range keys { + if keys[i] != sorted[i] { + return fmt.Errorf("%v keys are not sorted: %v", path, keys) + } + } + return nil +} + +// ValidateYAMLKeyOrder checks the sections we care about. +func validateYAMLKeyOrder(raw []byte) error { + var doc yaml.Node + if err := yaml.Unmarshal(raw, &doc); err != nil { + return err + } + for _, p := range [][]string{ + {"resource_attributes"}, + {"attributes"}, + {"metrics"}, + {"events"}, + {"telemetry", "metrics"}, + } { + if err := validateMappingKeysSorted(&doc, p...); err != nil { + return err + } + } + return nil +} diff --git a/cmd/mdatagen/internal/metadata.go b/cmd/mdatagen/internal/metadata.go index 3fe2cbe82c97..9bd12ab07d27 100644 --- a/cmd/mdatagen/internal/metadata.go +++ b/cmd/mdatagen/internal/metadata.go @@ -7,6 +7,7 @@ import ( "errors" "fmt" "regexp" + "slices" "strconv" "strings" @@ -156,10 +157,8 @@ func (md *Metadata) supportsSignal(signal string) bool { } for _, signals := range md.Status.Stability { - for _, s := range signals { - if s == signal { - return true - } + if slices.Contains(signals, signal) { + return true } } diff --git a/cmd/mdatagen/internal/metadata_test.go b/cmd/mdatagen/internal/metadata_test.go index ab1a2e4bb9f6..adee6f0a07fa 100644 --- a/cmd/mdatagen/internal/metadata_test.go +++ b/cmd/mdatagen/internal/metadata_test.go @@ -6,6 +6,7 @@ package internal import ( "io/fs" "path/filepath" + "slices" "testing" "github.com/stretchr/testify/assert" @@ -172,12 +173,7 @@ func TestSupportsSignal(t *testing.T) { } func contains(r string, rs []string) bool { - for _, s := range rs { - if s == r { - return true - } - } - return false + return slices.Contains(rs, r) } func TestCodeCovID(t *testing.T) { From d7c634c597666fd2c4ab88ec0ccb6a6c688c5214 Mon Sep 17 00:00:00 2001 From: Paulo Dias Date: Sat, 6 Sep 2025 09:41:52 +0100 Subject: [PATCH 02/10] feat: add tests Signed-off-by: Paulo Dias --- cmd/mdatagen/internal/loader_test.go | 5 +++++ .../internal/testdata/unsorted_rattr.yaml | 16 ++++++++++++++++ 2 files changed, 21 insertions(+) create mode 100644 cmd/mdatagen/internal/testdata/unsorted_rattr.yaml diff --git a/cmd/mdatagen/internal/loader_test.go b/cmd/mdatagen/internal/loader_test.go index 4ea52e111d93..c6dd538123a0 100644 --- a/cmd/mdatagen/internal/loader_test.go +++ b/cmd/mdatagen/internal/loader_test.go @@ -486,6 +486,11 @@ func TestLoadMetadata(t *testing.T) { want: Metadata{}, wantErr: "decoding failed due to the following error(s):\n\n'attributes[used_attr].type' invalid type: \"invalidtype\"", }, + { + name: "testdata/unsorted_rattr.yaml", + want: Metadata{}, + wantErr: "metadata.yaml ordering check failed: [resource_attributes] keys are not sorted", + }, { name: "testdata/~~this file doesn't exist~~.yaml", wantErr: "unable to read the file file:testdata/~~this file doesn't exist~~.yaml", diff --git a/cmd/mdatagen/internal/testdata/unsorted_rattr.yaml b/cmd/mdatagen/internal/testdata/unsorted_rattr.yaml new file mode 100644 index 000000000000..8520678f7940 --- /dev/null +++ b/cmd/mdatagen/internal/testdata/unsorted_rattr.yaml @@ -0,0 +1,16 @@ +type: sample + +status: + class: receiver + stability: + beta: [logs] + +resource_attributes: + cloud.region: + description: region + enabled: true + type: string + cloud.availability_zone: + description: az + enabled: true + type: string From ca48de901b739cc9fd291852e3564493a938cc9d Mon Sep 17 00:00:00 2001 From: Paulo Dias Date: Sat, 6 Sep 2025 12:22:38 +0100 Subject: [PATCH 03/10] chore: improve linting Signed-off-by: Paulo Dias --- cmd/mdatagen/go.mod | 2 +- cmd/mdatagen/internal/command.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/cmd/mdatagen/go.mod b/cmd/mdatagen/go.mod index 64c26ae52a86..ed50806ecd22 100644 --- a/cmd/mdatagen/go.mod +++ b/cmd/mdatagen/go.mod @@ -31,6 +31,7 @@ require ( go.uber.org/goleak v1.3.0 go.uber.org/zap v1.27.0 golang.org/x/text v0.28.0 + gopkg.in/yaml.v3 v3.0.1 ) require ( @@ -77,7 +78,6 @@ require ( google.golang.org/genproto/googleapis/rpc v0.0.0-20250707201910-8d1bb00bc6a7 // indirect google.golang.org/grpc v1.75.0 // indirect google.golang.org/protobuf v1.36.8 // indirect - gopkg.in/yaml.v3 v3.0.1 // indirect ) replace go.opentelemetry.io/collector/component => ../../component diff --git a/cmd/mdatagen/internal/command.go b/cmd/mdatagen/internal/command.go index 5bcfaa884a04..4b4af4f77808 100644 --- a/cmd/mdatagen/internal/command.go +++ b/cmd/mdatagen/internal/command.go @@ -78,12 +78,12 @@ func run(ymlPath string) error { ymlDir := filepath.Dir(ymlPath) packageName := filepath.Base(ymlDir) - raw, readErr := os.ReadFile(ymlPath) + raw, readErr := os.ReadFile(ymlPath) //nolint:gosec // G304: abs path is cleaned/validated above; safe to read if readErr != nil { return fmt.Errorf("failed reading %v: %w", ymlPath, readErr) } - if err := validateYAMLKeyOrder(raw); err != nil { + if err = validateYAMLKeyOrder(raw); err != nil { return fmt.Errorf("metadata.yaml ordering check failed: %w", err) } From 73c7c28aa839de1cb07d815b9b74c95670eb4842 Mon Sep 17 00:00:00 2001 From: Paulo Dias <44772900+paulojmdias@users.noreply.github.com> Date: Sat, 6 Sep 2025 13:06:17 +0100 Subject: [PATCH 04/10] fix: revert test --- cmd/mdatagen/internal/loader_test.go | 5 ----- 1 file changed, 5 deletions(-) diff --git a/cmd/mdatagen/internal/loader_test.go b/cmd/mdatagen/internal/loader_test.go index c6dd538123a0..4ea52e111d93 100644 --- a/cmd/mdatagen/internal/loader_test.go +++ b/cmd/mdatagen/internal/loader_test.go @@ -486,11 +486,6 @@ func TestLoadMetadata(t *testing.T) { want: Metadata{}, wantErr: "decoding failed due to the following error(s):\n\n'attributes[used_attr].type' invalid type: \"invalidtype\"", }, - { - name: "testdata/unsorted_rattr.yaml", - want: Metadata{}, - wantErr: "metadata.yaml ordering check failed: [resource_attributes] keys are not sorted", - }, { name: "testdata/~~this file doesn't exist~~.yaml", wantErr: "unable to read the file file:testdata/~~this file doesn't exist~~.yaml", From 0d4b186e99ce5609d77c5debb50b94a5e801fed6 Mon Sep 17 00:00:00 2001 From: Paulo Dias Date: Sun, 7 Sep 2025 21:16:18 +0100 Subject: [PATCH 05/10] chore: sort Signed-off-by: Paulo Dias --- .../internal/sampleconnector/metadata.yaml | 104 +++++------ .../internal/sampleprocessor/metadata.yaml | 24 +-- .../internal/samplereceiver/metadata.yaml | 170 ++++++++++-------- .../internal/samplescraper/metadata.yaml | 104 +++++------ exporter/exporterhelper/metadata.yaml | 146 +++++++++------ processor/batchprocessor/metadata.yaml | 101 +++++++++-- .../memorylimiterprocessor/metadata.yaml | 36 ++-- processor/processorhelper/metadata.yaml | 20 +-- receiver/receiverhelper/metadata.yaml | 52 +++--- scraper/scraperhelper/metadata.yaml | 8 +- service/metadata.yaml | 154 ++++++++-------- 11 files changed, 529 insertions(+), 390 deletions(-) diff --git a/cmd/mdatagen/internal/sampleconnector/metadata.yaml b/cmd/mdatagen/internal/sampleconnector/metadata.yaml index ad46b6f834dc..e5a666023ccc 100644 --- a/cmd/mdatagen/internal/sampleconnector/metadata.yaml +++ b/cmd/mdatagen/internal/sampleconnector/metadata.yaml @@ -18,15 +18,9 @@ status: - Any additional information that should be brought to the consumer's attention resource_attributes: - string.resource.attr: - description: Resource attribute with any string value. - type: string - enabled: true - - string.enum.resource.attr: - description: Resource attribute with a known set of string values. - type: string - enum: [one, two] + map.resource.attr: + description: Resource attribute with a map value. + type: map enabled: true optional.resource.attr: @@ -39,9 +33,15 @@ resource_attributes: type: slice enabled: true - map.resource.attr: - description: Resource attribute with a map value. - type: map + string.enum.resource.attr: + description: Resource attribute with a known set of string values. + type: string + enum: [one, two] + enabled: true + + string.resource.attr: + description: Resource attribute with any string value. + type: string enabled: true string.resource.attr_disable_warning: @@ -66,20 +66,6 @@ resource_attributes: if_enabled: This resource_attribute is deprecated and will be removed soon. attributes: - string_attr: - description: Attribute with any string value. - type: string - - overridden_int_attr: - name_override: state - description: Integer attribute with overridden name. - type: int - - enum_attr: - description: Attribute with a known set of string values. - type: string - enum: [red, green, blue] - boolean_attr: description: Attribute with a boolean value. type: bool @@ -90,14 +76,28 @@ attributes: description: Another attribute with a boolean value. type: bool - slice_attr: - description: Attribute with a slice value. - type: slice + enum_attr: + description: Attribute with a known set of string values. + type: string + enum: [red, green, blue] map_attr: description: Attribute with a map value. type: map + overridden_int_attr: + name_override: state + description: Integer attribute with overridden name. + type: int + + slice_attr: + description: Attribute with a slice value. + type: slice + + string_attr: + description: Attribute with any string value. + type: string + metrics: default.metric: enabled: true @@ -108,30 +108,11 @@ metrics: value_type: int monotonic: true aggregation_temporality: cumulative - attributes: [string_attr, overridden_int_attr, enum_attr, slice_attr, map_attr] + attributes: + [string_attr, overridden_int_attr, enum_attr, slice_attr, map_attr] warnings: if_enabled_not_set: This metric will be disabled by default soon. - optional.metric: - enabled: false - description: "[DEPRECATED] Gauge double metric disabled by default." - unit: "1" - gauge: - value_type: double - attributes: [string_attr, boolean_attr, boolean_attr2] - warnings: - if_configured: This metric is deprecated and will be removed soon. - - optional.metric.empty_unit: - enabled: false - description: "[DEPRECATED] Gauge double metric disabled by default." - unit: "" - gauge: - value_type: double - attributes: [string_attr, boolean_attr] - warnings: - if_configured: This metric is deprecated and will be removed soon. - default.metric.to_be_removed: enabled: true description: "[DEPRECATED] Non-monotonic delta sum double metric enabled by default." @@ -153,4 +134,25 @@ metrics: input_type: string monotonic: true aggregation_temporality: cumulative - attributes: [ string_attr, overridden_int_attr, enum_attr, slice_attr, map_attr ] + attributes: + [string_attr, overridden_int_attr, enum_attr, slice_attr, map_attr] + + optional.metric: + enabled: false + description: "[DEPRECATED] Gauge double metric disabled by default." + unit: "1" + gauge: + value_type: double + attributes: [string_attr, boolean_attr, boolean_attr2] + warnings: + if_configured: This metric is deprecated and will be removed soon. + + optional.metric.empty_unit: + enabled: false + description: "[DEPRECATED] Gauge double metric disabled by default." + unit: "" + gauge: + value_type: double + attributes: [string_attr, boolean_attr] + warnings: + if_configured: This metric is deprecated and will be removed soon. diff --git a/cmd/mdatagen/internal/sampleprocessor/metadata.yaml b/cmd/mdatagen/internal/sampleprocessor/metadata.yaml index 1ad54810e09d..ce7f738c0f6f 100644 --- a/cmd/mdatagen/internal/sampleprocessor/metadata.yaml +++ b/cmd/mdatagen/internal/sampleprocessor/metadata.yaml @@ -21,15 +21,9 @@ status: - Any additional information that should be brought to the consumer's attention resource_attributes: - string.resource.attr: - description: Resource attribute with any string value. - type: string - enabled: true - - string.enum.resource.attr: - description: Resource attribute with a known set of string values. - type: string - enum: [one, two] + map.resource.attr: + description: Resource attribute with a map value. + type: map enabled: true optional.resource.attr: @@ -42,9 +36,15 @@ resource_attributes: type: slice enabled: true - map.resource.attr: - description: Resource attribute with a map value. - type: map + string.enum.resource.attr: + description: Resource attribute with a known set of string values. + type: string + enum: [one, two] + enabled: true + + string.resource.attr: + description: Resource attribute with any string value. + type: string enabled: true string.resource.attr_disable_warning: diff --git a/cmd/mdatagen/internal/samplereceiver/metadata.yaml b/cmd/mdatagen/internal/samplereceiver/metadata.yaml index 95b22c30741e..9aa1b75f87d8 100644 --- a/cmd/mdatagen/internal/samplereceiver/metadata.yaml +++ b/cmd/mdatagen/internal/samplereceiver/metadata.yaml @@ -26,15 +26,9 @@ status: - Any additional information that should be brought to the consumer's attention resource_attributes: - string.resource.attr: - description: Resource attribute with any string value. - type: string - enabled: true - - string.enum.resource.attr: - description: Resource attribute with a known set of string values. - type: string - enum: [one, two] + map.resource.attr: + description: Resource attribute with a map value. + type: map enabled: true optional.resource.attr: @@ -47,9 +41,15 @@ resource_attributes: type: slice enabled: true - map.resource.attr: - description: Resource attribute with a map value. - type: map + string.enum.resource.attr: + description: Resource attribute with a known set of string values. + type: string + enum: [one, two] + enabled: true + + string.resource.attr: + description: Resource attribute with any string value. + type: string enabled: true string.resource.attr_disable_warning: @@ -74,20 +74,6 @@ resource_attributes: if_enabled: This resource_attribute is deprecated and will be removed soon. attributes: - string_attr: - description: Attribute with any string value. - type: string - - overridden_int_attr: - name_override: state - description: Integer attribute with overridden name. - type: int - - enum_attr: - description: Attribute with a known set of string values. - type: string - enum: [red, green, blue] - boolean_attr: description: Attribute with a boolean value. type: bool @@ -98,9 +84,10 @@ attributes: description: Another attribute with a boolean value. type: bool - slice_attr: - description: Attribute with a slice value. - type: slice + enum_attr: + description: Attribute with a known set of string values. + type: string + enum: [red, green, blue] map_attr: description: Attribute with a map value. @@ -116,29 +103,52 @@ attributes: type: string optional: true + overridden_int_attr: + name_override: state + description: Integer attribute with overridden name. + type: int + + slice_attr: + description: Attribute with a slice value. + type: slice + + string_attr: + description: Attribute with any string value. + type: string + events: default.event: enabled: true description: Example event enabled by default. - attributes: [ string_attr, overridden_int_attr, enum_attr, slice_attr, map_attr, optional_int_attr, optional_string_attr] + attributes: + [ + string_attr, + overridden_int_attr, + enum_attr, + slice_attr, + map_attr, + optional_int_attr, + optional_string_attr, + ] warnings: if_enabled_not_set: This event will be disabled by default soon. - default.event.to_be_renamed: - enabled: false - description: "[DEPRECATED] Example event disabled by default." - extended_documentation: The event will be renamed soon. - attributes: [ string_attr, boolean_attr, boolean_attr2, optional_string_attr ] - warnings: - if_configured: This event is deprecated and will be renamed soon. - default.event.to_be_removed: enabled: true description: "[DEPRECATED] Example to-be-removed event enabled by default." extended_documentation: The event will be removed soon. warnings: if_enabled: This event is deprecated and will be removed soon. - attributes: [ string_attr, overridden_int_attr, enum_attr, slice_attr, map_attr ] + attributes: + [string_attr, overridden_int_attr, enum_attr, slice_attr, map_attr] + + default.event.to_be_renamed: + enabled: false + description: "[DEPRECATED] Example event disabled by default." + extended_documentation: The event will be renamed soon. + attributes: [string_attr, boolean_attr, boolean_attr2, optional_string_attr] + warnings: + if_configured: This event is deprecated and will be renamed soon. metrics: default.metric: @@ -150,30 +160,19 @@ metrics: value_type: int monotonic: true aggregation_temporality: cumulative - attributes: [string_attr, overridden_int_attr, enum_attr, slice_attr, map_attr, optional_int_attr, optional_string_attr] + attributes: + [ + string_attr, + overridden_int_attr, + enum_attr, + slice_attr, + map_attr, + optional_int_attr, + optional_string_attr, + ] warnings: if_enabled_not_set: This metric will be disabled by default soon. - optional.metric: - enabled: false - description: "[DEPRECATED] Gauge double metric disabled by default." - unit: "1" - gauge: - value_type: double - attributes: [string_attr, boolean_attr, boolean_attr2, optional_string_attr] - warnings: - if_configured: This metric is deprecated and will be removed soon. - - optional.metric.empty_unit: - enabled: false - description: "[DEPRECATED] Gauge double metric disabled by default." - unit: "" - gauge: - value_type: double - attributes: [string_attr, boolean_attr] - warnings: - if_configured: This metric is deprecated and will be removed soon. - default.metric.to_be_removed: enabled: true description: "[DEPRECATED] Non-monotonic delta sum double metric enabled by default." @@ -195,7 +194,28 @@ metrics: input_type: string monotonic: true aggregation_temporality: cumulative - attributes: [ string_attr, overridden_int_attr, enum_attr, slice_attr, map_attr ] + attributes: + [string_attr, overridden_int_attr, enum_attr, slice_attr, map_attr] + + optional.metric: + enabled: false + description: "[DEPRECATED] Gauge double metric disabled by default." + unit: "1" + gauge: + value_type: double + attributes: [string_attr, boolean_attr, boolean_attr2, optional_string_attr] + warnings: + if_configured: This metric is deprecated and will be removed soon. + + optional.metric.empty_unit: + enabled: false + description: "[DEPRECATED] Gauge double metric disabled by default." + unit: "" + gauge: + value_type: double + attributes: [string_attr, boolean_attr] + warnings: + if_configured: This metric is deprecated and will be removed soon. telemetry: metrics: @@ -209,15 +229,6 @@ telemetry: sum: value_type: int monotonic: true - request_duration: - enabled: true - stability: - level: alpha - description: Duration of request - unit: s - histogram: - value_type: double - bucket_boundaries: [1, 10, 100] process_runtime_total_alloc_bytes: enabled: true stability: @@ -228,6 +239,12 @@ telemetry: async: true value_type: int monotonic: true + queue_capacity: + enabled: true + description: Queue capacity - sync gauge example. + unit: "{items}" + gauge: + value_type: int queue_length: enabled: true stability: @@ -239,9 +256,12 @@ telemetry: gauge: async: true value_type: int - queue_capacity: + request_duration: enabled: true - description: Queue capacity - sync gauge example. - unit: "{items}" - gauge: - value_type: int + stability: + level: alpha + description: Duration of request + unit: s + histogram: + value_type: double + bucket_boundaries: [1, 10, 100] diff --git a/cmd/mdatagen/internal/samplescraper/metadata.yaml b/cmd/mdatagen/internal/samplescraper/metadata.yaml index 01105f11de0c..b5b43df2004e 100644 --- a/cmd/mdatagen/internal/samplescraper/metadata.yaml +++ b/cmd/mdatagen/internal/samplescraper/metadata.yaml @@ -19,15 +19,9 @@ status: - Any additional information that should be brought to the consumer's attention resource_attributes: - string.resource.attr: - description: Resource attribute with any string value. - type: string - enabled: true - - string.enum.resource.attr: - description: Resource attribute with a known set of string values. - type: string - enum: [one, two] + map.resource.attr: + description: Resource attribute with a map value. + type: map enabled: true optional.resource.attr: @@ -40,9 +34,15 @@ resource_attributes: type: slice enabled: true - map.resource.attr: - description: Resource attribute with a map value. - type: map + string.enum.resource.attr: + description: Resource attribute with a known set of string values. + type: string + enum: [one, two] + enabled: true + + string.resource.attr: + description: Resource attribute with any string value. + type: string enabled: true string.resource.attr_disable_warning: @@ -67,20 +67,6 @@ resource_attributes: if_enabled: This resource_attribute is deprecated and will be removed soon. attributes: - string_attr: - description: Attribute with any string value. - type: string - - overridden_int_attr: - name_override: state - description: Integer attribute with overridden name. - type: int - - enum_attr: - description: Attribute with a known set of string values. - type: string - enum: [red, green, blue] - boolean_attr: description: Attribute with a boolean value. type: bool @@ -91,14 +77,28 @@ attributes: description: Another attribute with a boolean value. type: bool - slice_attr: - description: Attribute with a slice value. - type: slice + enum_attr: + description: Attribute with a known set of string values. + type: string + enum: [red, green, blue] map_attr: description: Attribute with a map value. type: map + overridden_int_attr: + name_override: state + description: Integer attribute with overridden name. + type: int + + slice_attr: + description: Attribute with a slice value. + type: slice + + string_attr: + description: Attribute with any string value. + type: string + metrics: default.metric: enabled: true @@ -109,30 +109,11 @@ metrics: value_type: int monotonic: true aggregation_temporality: cumulative - attributes: [string_attr, overridden_int_attr, enum_attr, slice_attr, map_attr] + attributes: + [string_attr, overridden_int_attr, enum_attr, slice_attr, map_attr] warnings: if_enabled_not_set: This metric will be disabled by default soon. - optional.metric: - enabled: false - description: "[DEPRECATED] Gauge double metric disabled by default." - unit: "1" - gauge: - value_type: double - attributes: [string_attr, boolean_attr, boolean_attr2] - warnings: - if_configured: This metric is deprecated and will be removed soon. - - optional.metric.empty_unit: - enabled: false - description: "[DEPRECATED] Gauge double metric disabled by default." - unit: "" - gauge: - value_type: double - attributes: [string_attr, boolean_attr] - warnings: - if_configured: This metric is deprecated and will be removed soon. - default.metric.to_be_removed: enabled: true description: "[DEPRECATED] Non-monotonic delta sum double metric enabled by default." @@ -154,4 +135,25 @@ metrics: input_type: string monotonic: true aggregation_temporality: cumulative - attributes: [ string_attr, overridden_int_attr, enum_attr, slice_attr, map_attr ] + attributes: + [string_attr, overridden_int_attr, enum_attr, slice_attr, map_attr] + + optional.metric: + enabled: false + description: "[DEPRECATED] Gauge double metric disabled by default." + unit: "1" + gauge: + value_type: double + attributes: [string_attr, boolean_attr, boolean_attr2] + warnings: + if_configured: This metric is deprecated and will be removed soon. + + optional.metric.empty_unit: + enabled: false + description: "[DEPRECATED] Gauge double metric disabled by default." + unit: "" + gauge: + value_type: double + attributes: [string_attr, boolean_attr] + warnings: + if_configured: This metric is deprecated and will be removed soon. diff --git a/exporter/exporterhelper/metadata.yaml b/exporter/exporterhelper/metadata.yaml index 0af14cce32ef..9212c3ec2210 100644 --- a/exporter/exporterhelper/metadata.yaml +++ b/exporter/exporterhelper/metadata.yaml @@ -13,22 +13,22 @@ status: telemetry: metrics: - exporter_sent_spans: + exporter_enqueue_failed_log_records: enabled: true stability: level: alpha - description: Number of spans successfully sent to destination. - unit: "{spans}" + description: Number of log records failed to be added to the sending queue. + unit: "{records}" sum: value_type: int monotonic: true - exporter_send_failed_spans: + exporter_enqueue_failed_metric_points: enabled: true stability: level: alpha - description: Number of spans in failed attempts to send to destination. - unit: "{spans}" + description: Number of metric points failed to be added to the sending queue. + unit: "{datapoints}" sum: value_type: int monotonic: true @@ -43,45 +43,81 @@ telemetry: value_type: int monotonic: true - exporter_sent_metric_points: + exporter_queue_batch_send_size: enabled: true - stability: - level: alpha - description: Number of metric points successfully sent to destination. - unit: "{datapoints}" - sum: + description: Number of units in the batch + unit: "{units}" + histogram: value_type: int - monotonic: true + bucket_boundaries: + [ + 10, + 25, + 50, + 75, + 100, + 250, + 500, + 750, + 1000, + 2000, + 3000, + 4000, + 5000, + 6000, + 7000, + 8000, + 9000, + 10000, + 20000, + 30000, + 50000, + 100000, + ] - exporter_send_failed_metric_points: + exporter_queue_batch_send_size_bytes: enabled: true - stability: - level: alpha - description: Number of metric points in failed attempts to send to destination. - unit: "{datapoints}" - sum: + description: Number of bytes in batch that was sent. Only available on detailed level. + unit: By + histogram: value_type: int - monotonic: true + bucket_boundaries: + [ + 10, + 25, + 50, + 75, + 100, + 250, + 500, + 750, + 1000, + 2000, + 3000, + 4000, + 5000, + 6000, + ] - exporter_enqueue_failed_metric_points: + exporter_queue_capacity: enabled: true stability: level: alpha - description: Number of metric points failed to be added to the sending queue. - unit: "{datapoints}" - sum: + description: Fixed capacity of the retry queue (in batches). + unit: "{batches}" + gauge: value_type: int - monotonic: true + async: true - exporter_sent_log_records: + exporter_queue_size: enabled: true stability: level: alpha - description: Number of log record successfully sent to destination. - unit: "{records}" - sum: + description: Current size of the retry queue (in batches). + unit: "{batches}" + gauge: value_type: int - monotonic: true + async: true exporter_send_failed_log_records: enabled: true @@ -93,48 +129,52 @@ telemetry: value_type: int monotonic: true - exporter_enqueue_failed_log_records: + exporter_send_failed_metric_points: enabled: true stability: level: alpha - description: Number of log records failed to be added to the sending queue. - unit: "{records}" + description: Number of metric points in failed attempts to send to destination. + unit: "{datapoints}" sum: value_type: int monotonic: true - exporter_queue_size: + exporter_send_failed_spans: enabled: true stability: level: alpha - description: Current size of the retry queue (in batches). - unit: "{batches}" - gauge: + description: Number of spans in failed attempts to send to destination. + unit: "{spans}" + sum: value_type: int - async: true + monotonic: true - exporter_queue_batch_send_size: + exporter_sent_log_records: enabled: true - description: Number of units in the batch - unit: "{units}" - histogram: + stability: + level: alpha + description: Number of log record successfully sent to destination. + unit: "{records}" + sum: value_type: int - bucket_boundaries: [ 10, 25, 50, 75, 100, 250, 500, 750, 1000, 2000, 3000, 4000, 5000, 6000, 7000, 8000, 9000, 10000, 20000, 30000, 50000, 100000 ] + monotonic: true - exporter_queue_batch_send_size_bytes: + exporter_sent_metric_points: enabled: true - description: Number of bytes in batch that was sent. Only available on detailed level. - unit: By - histogram: + stability: + level: alpha + description: Number of metric points successfully sent to destination. + unit: "{datapoints}" + sum: value_type: int - bucket_boundaries: [ 10, 25, 50, 75, 100, 250, 500, 750, 1000, 2000, 3000, 4000, 5000, 6000 ] + monotonic: true - exporter_queue_capacity: + exporter_sent_spans: enabled: true stability: level: alpha - description: Fixed capacity of the retry queue (in batches). - unit: "{batches}" - gauge: + description: Number of spans successfully sent to destination. + unit: "{spans}" + sum: value_type: int - async: true + monotonic: true diff --git a/processor/batchprocessor/metadata.yaml b/processor/batchprocessor/metadata.yaml index fa9bb713df63..127322310050 100644 --- a/processor/batchprocessor/metadata.yaml +++ b/processor/batchprocessor/metadata.yaml @@ -5,41 +5,99 @@ status: disable_codecov_badge: true class: processor stability: - beta: [ traces, metrics, logs ] - distributions: [ core, contrib, k8s ] + beta: [traces, metrics, logs] + distributions: [core, contrib, k8s] tests: telemetry: metrics: - processor_batch_batch_size_trigger_send: - enabled: true - description: Number of times the batch was sent due to a size trigger - unit: "{times}" - sum: - value_type: int - monotonic: true - processor_batch_timeout_trigger_send: - enabled: true - description: Number of times the batch was sent due to a timeout trigger - unit: "{times}" - sum: - value_type: int - monotonic: true processor_batch_batch_send_size: enabled: true description: Number of units in the batch unit: "{units}" histogram: value_type: int - bucket_boundaries: [ 10, 25, 50, 75, 100, 250, 500, 750, 1000, 2000, 3000, 4000, 5000, 6000, 7000, 8000, 9000, 10000, 20000, 30000, 50000, 100000 ] + bucket_boundaries: + [ + 10, + 25, + 50, + 75, + 100, + 250, + 500, + 750, + 1000, + 2000, + 3000, + 4000, + 5000, + 6000, + 7000, + 8000, + 9000, + 10000, + 20000, + 30000, + 50000, + 100000, + ] processor_batch_batch_send_size_bytes: enabled: true description: Number of bytes in batch that was sent. Only available on detailed level. unit: By histogram: value_type: int - bucket_boundaries: [ 10, 25, 50, 75, 100, 250, 500, 750, 1000, 2000, 3000, 4000, 5000, 6000, 7000, 8000, 9000, 10000, 20000, 30000, 50000, 100_000, 200_000, 300_000, 400_000, 500_000, 600_000, 700_000, 800_000, 900_000, 1000_000, 2000_000, 3000_000, 4000_000, 5000_000, 6000_000, 7000_000, 8000_000, 9000_000 ] + bucket_boundaries: + [ + 10, + 25, + 50, + 75, + 100, + 250, + 500, + 750, + 1000, + 2000, + 3000, + 4000, + 5000, + 6000, + 7000, + 8000, + 9000, + 10000, + 20000, + 30000, + 50000, + 100_000, + 200_000, + 300_000, + 400_000, + 500_000, + 600_000, + 700_000, + 800_000, + 900_000, + 1000_000, + 2000_000, + 3000_000, + 4000_000, + 5000_000, + 6000_000, + 7000_000, + 8000_000, + 9000_000, + ] + processor_batch_batch_size_trigger_send: + enabled: true + description: Number of times the batch was sent due to a size trigger + unit: "{times}" + sum: + value_type: int + monotonic: true processor_batch_metadata_cardinality: enabled: true description: Number of distinct metadata value combinations being processed @@ -47,3 +105,10 @@ telemetry: sum: value_type: int async: true + processor_batch_timeout_trigger_send: + enabled: true + description: Number of times the batch was sent due to a timeout trigger + unit: "{times}" + sum: + value_type: int + monotonic: true diff --git a/processor/memorylimiterprocessor/metadata.yaml b/processor/memorylimiterprocessor/metadata.yaml index 2b73072a2f03..aa8813f1eaf7 100644 --- a/processor/memorylimiterprocessor/metadata.yaml +++ b/processor/memorylimiterprocessor/metadata.yaml @@ -17,68 +17,68 @@ tests: telemetry: metrics: - processor_accepted_spans: + processor_accepted_log_records: enabled: true - description: Number of spans successfully pushed into the next component in the pipeline. + description: Number of log records successfully pushed into the next component in the pipeline. stability: level: deprecated from: v0.110.0 - unit: "{spans}" + unit: "{records}" sum: value_type: int monotonic: true - processor_refused_spans: + processor_accepted_metric_points: enabled: true - description: Number of spans that were rejected by the next component in the pipeline. + description: Number of metric points successfully pushed into the next component in the pipeline. stability: level: deprecated from: v0.110.0 - unit: "{spans}" + unit: "{datapoints}" sum: value_type: int monotonic: true - processor_accepted_metric_points: + processor_accepted_spans: enabled: true - description: Number of metric points successfully pushed into the next component in the pipeline. + description: Number of spans successfully pushed into the next component in the pipeline. stability: level: deprecated from: v0.110.0 - unit: "{datapoints}" + unit: "{spans}" sum: value_type: int monotonic: true - processor_refused_metric_points: + processor_refused_log_records: enabled: true - description: Number of metric points that were rejected by the next component in the pipeline. + description: Number of log records that were rejected by the next component in the pipeline. stability: level: deprecated from: v0.110.0 - unit: "{datapoints}" + unit: "{records}" sum: value_type: int monotonic: true - processor_accepted_log_records: + processor_refused_metric_points: enabled: true - description: Number of log records successfully pushed into the next component in the pipeline. + description: Number of metric points that were rejected by the next component in the pipeline. stability: level: deprecated from: v0.110.0 - unit: "{records}" + unit: "{datapoints}" sum: value_type: int monotonic: true - processor_refused_log_records: + processor_refused_spans: enabled: true - description: Number of log records that were rejected by the next component in the pipeline. + description: Number of spans that were rejected by the next component in the pipeline. stability: level: deprecated from: v0.110.0 - unit: "{records}" + unit: "{spans}" sum: value_type: int monotonic: true diff --git a/processor/processorhelper/metadata.yaml b/processor/processorhelper/metadata.yaml index 89f2775dd2ee..97b9e594a1cd 100644 --- a/processor/processorhelper/metadata.yaml +++ b/processor/processorhelper/metadata.yaml @@ -19,16 +19,6 @@ telemetry: value_type: int monotonic: true - processor_outgoing_items: - enabled: true - stability: - level: alpha - description: Number of items emitted from the processor. - unit: "{items}" - sum: - value_type: int - monotonic: true - processor_internal_duration: enabled: true stability: @@ -38,3 +28,13 @@ telemetry: histogram: async: false value_type: double + + processor_outgoing_items: + enabled: true + stability: + level: alpha + description: Number of items emitted from the processor. + unit: "{items}" + sum: + value_type: int + monotonic: true diff --git a/receiver/receiverhelper/metadata.yaml b/receiver/receiverhelper/metadata.yaml index 5d19ac537d68..e5854f996b53 100644 --- a/receiver/receiverhelper/metadata.yaml +++ b/receiver/receiverhelper/metadata.yaml @@ -7,84 +7,84 @@ status: beta: [metrics, traces, logs] telemetry: metrics: - receiver_accepted_spans: + receiver_accepted_log_records: enabled: true stability: level: alpha - description: Number of spans successfully pushed into the pipeline. - unit: "{spans}" + description: Number of log records successfully pushed into the pipeline. + unit: "{records}" sum: value_type: int monotonic: true - receiver_refused_spans: - enabled: true + receiver_accepted_metric_points: stability: level: alpha - description: Number of spans that could not be pushed into the pipeline. - unit: "{spans}" + enabled: true + description: Number of metric points successfully pushed into the pipeline. + unit: "{datapoints}" sum: value_type: int monotonic: true - receiver_failed_spans: + receiver_accepted_spans: enabled: true stability: level: alpha - description: The number of spans that failed to be processed by the receiver due to internal errors. + description: Number of spans successfully pushed into the pipeline. unit: "{spans}" sum: value_type: int monotonic: true - receiver_accepted_metric_points: + receiver_failed_log_records: + enabled: true stability: level: alpha - enabled: true - description: Number of metric points successfully pushed into the pipeline. - unit: "{datapoints}" + description: The number of log records that failed to be processed by the receiver due to internal errors. + unit: "{records}" sum: value_type: int monotonic: true - receiver_refused_metric_points: + receiver_failed_metric_points: enabled: true stability: level: alpha - description: Number of metric points that could not be pushed into the pipeline. + description: The number of metric points that failed to be processed by the receiver due to internal errors. unit: "{datapoints}" sum: value_type: int monotonic: true - receiver_failed_metric_points: + receiver_failed_spans: enabled: true stability: level: alpha - description: The number of metric points that failed to be processed by the receiver due to internal errors. - unit: "{datapoints}" + description: The number of spans that failed to be processed by the receiver due to internal errors. + unit: "{spans}" sum: value_type: int monotonic: true - receiver_accepted_log_records: + receiver_refused_log_records: enabled: true stability: level: alpha - description: Number of log records successfully pushed into the pipeline. + description: Number of log records that could not be pushed into the pipeline. unit: "{records}" sum: value_type: int monotonic: true - receiver_refused_log_records: + receiver_refused_metric_points: enabled: true stability: level: alpha - description: Number of log records that could not be pushed into the pipeline. - unit: "{records}" + description: Number of metric points that could not be pushed into the pipeline. + unit: "{datapoints}" sum: value_type: int monotonic: true - receiver_failed_log_records: + receiver_refused_spans: enabled: true stability: level: alpha - description: The number of log records that failed to be processed by the receiver due to internal errors. - unit: "{records}" + description: Number of spans that could not be pushed into the pipeline. + unit: "{spans}" sum: value_type: int monotonic: true diff --git a/scraper/scraperhelper/metadata.yaml b/scraper/scraperhelper/metadata.yaml index 74ca910307cc..6963d5751d64 100644 --- a/scraper/scraperhelper/metadata.yaml +++ b/scraper/scraperhelper/metadata.yaml @@ -9,11 +9,11 @@ status: telemetry: metrics: - scraper_scraped_metric_points: + scraper_errored_log_records: enabled: true stability: level: alpha - description: Number of metric points successfully scraped. + description: Number of log records that were unable to be scraped. unit: "{datapoints}" sum: value_type: int @@ -39,11 +39,11 @@ telemetry: value_type: int monotonic: true - scraper_errored_log_records: + scraper_scraped_metric_points: enabled: true stability: level: alpha - description: Number of log records that were unable to be scraped. + description: Number of metric points successfully scraped. unit: "{datapoints}" sum: value_type: int diff --git a/service/metadata.yaml b/service/metadata.yaml index 53f1a66836d5..344b7e587c32 100644 --- a/service/metadata.yaml +++ b/service/metadata.yaml @@ -10,17 +10,81 @@ status: telemetry: metrics: - process_uptime: + connector.consumed.items: + prefix: otelcol. + enabled: true + description: Number of items passed to the connector. + unit: "{item}" + sum: + value_type: int + monotonic: true + + connector.consumed.size: + prefix: otelcol. + enabled: false + description: Size of items passed to the connector, based on ProtoMarshaler.Sizer. + unit: "{item}" + sum: + value_type: int + monotonic: true + + connector.produced.items: + prefix: otelcol. + enabled: true + description: Number of items emitted from the connector. + unit: "{item}" + sum: + value_type: int + monotonic: true + + connector.produced.size: + prefix: otelcol. + enabled: false + description: Size of items emitted from the connector, based on ProtoMarshaler.Sizer. + unit: "{item}" + sum: + value_type: int + monotonic: true + + exporter.consumed.items: + prefix: otelcol. + enabled: true + description: Number of items passed to the exporter. + unit: "{item}" + sum: + value_type: int + monotonic: true + + exporter.consumed.size: + prefix: otelcol. + enabled: false + description: Size of items passed to the exporter, based on ProtoMarshaler.Sizer. + unit: "{item}" + sum: + value_type: int + monotonic: true + + process_cpu_seconds: enabled: true stability: level: alpha - description: Uptime of the process + description: Total CPU user and system time in seconds unit: s sum: async: true value_type: double monotonic: true + process_memory_rss: + enabled: true + stability: + level: alpha + description: Total physical memory (resident set size) + unit: By + gauge: + async: true + value_type: int + process_runtime_heap_alloc_bytes: enabled: true stability: @@ -52,35 +116,17 @@ telemetry: async: true value_type: int - process_cpu_seconds: + process_uptime: enabled: true stability: level: alpha - description: Total CPU user and system time in seconds + description: Uptime of the process unit: s sum: async: true value_type: double monotonic: true - process_memory_rss: - enabled: true - stability: - level: alpha - description: Total physical memory (resident set size) - unit: By - gauge: - async: true - value_type: int - - receiver.produced.items: - prefix: otelcol. - enabled: true - description: Number of items emitted from the receiver. - unit: "{item}" - sum: - value_type: int - monotonic: true processor.consumed.items: prefix: otelcol. enabled: true @@ -89,47 +135,7 @@ telemetry: sum: value_type: int monotonic: true - processor.produced.items: - prefix: otelcol. - enabled: true - description: Number of items emitted from the processor. - unit: "{item}" - sum: - value_type: int - monotonic: true - connector.consumed.items: - prefix: otelcol. - enabled: true - description: Number of items passed to the connector. - unit: "{item}" - sum: - value_type: int - monotonic: true - connector.produced.items: - prefix: otelcol. - enabled: true - description: Number of items emitted from the connector. - unit: "{item}" - sum: - value_type: int - monotonic: true - exporter.consumed.items: - prefix: otelcol. - enabled: true - description: Number of items passed to the exporter. - unit: "{item}" - sum: - value_type: int - monotonic: true - receiver.produced.size: - prefix: otelcol. - enabled: false - description: Size of items emitted from the receiver, based on ProtoMarshaler.Sizer. - unit: "{item}" - sum: - value_type: int - monotonic: true processor.consumed.size: prefix: otelcol. enabled: false @@ -138,34 +144,38 @@ telemetry: sum: value_type: int monotonic: true - processor.produced.size: + + processor.produced.items: prefix: otelcol. - enabled: false - description: Size of items emitted from the processor, based on ProtoMarshaler.Sizer. + enabled: true + description: Number of items emitted from the processor. unit: "{item}" sum: value_type: int monotonic: true - connector.consumed.size: + + processor.produced.size: prefix: otelcol. enabled: false - description: Size of items passed to the connector, based on ProtoMarshaler.Sizer. + description: Size of items emitted from the processor, based on ProtoMarshaler.Sizer. unit: "{item}" sum: value_type: int monotonic: true - connector.produced.size: + + receiver.produced.items: prefix: otelcol. - enabled: false - description: Size of items emitted from the connector, based on ProtoMarshaler.Sizer. + enabled: true + description: Number of items emitted from the receiver. unit: "{item}" sum: value_type: int monotonic: true - exporter.consumed.size: + + receiver.produced.size: prefix: otelcol. enabled: false - description: Size of items passed to the exporter, based on ProtoMarshaler.Sizer. + description: Size of items emitted from the receiver, based on ProtoMarshaler.Sizer. unit: "{item}" sum: value_type: int From 598d295998cb9c7b5f8581d169da246801833355 Mon Sep 17 00:00:00 2001 From: Paulo Dias Date: Sun, 7 Sep 2025 21:26:01 +0100 Subject: [PATCH 06/10] fix: improve testing Signed-off-by: Paulo Dias --- cmd/mdatagen/internal/command_test.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/cmd/mdatagen/internal/command_test.go b/cmd/mdatagen/internal/command_test.go index 706e00e46eef..9a079c625c75 100644 --- a/cmd/mdatagen/internal/command_test.go +++ b/cmd/mdatagen/internal/command_test.go @@ -48,12 +48,17 @@ func TestRunContents(t *testing.T) { wantGoleakSetup bool wantGoleakTeardown bool wantErr bool + wantOrderErr bool wantAttributes []string }{ { yml: "invalid.yaml", wantErr: true, }, + { + yml: "unsorted_rattr.yaml", + wantOrderErr: true, + }, { yml: "basic_connector.yaml", wantErr: false, @@ -234,6 +239,11 @@ foo require.NoError(t, os.WriteFile(filepath.Join(tmpdir, generatedPackageDir, "generated_component_test.go"), []byte("test"), 0o600)) err = run(metadataFile) + if tt.wantOrderErr { + require.Error(t, err) + require.Contains(t, err.Error(), "metadata.yaml ordering check failed") + return + } require.NoError(t, err) var contents []byte From c4734184ea3b8603f6f1904b2b7c1c26de5040bb Mon Sep 17 00:00:00 2001 From: Paulo Dias Date: Fri, 10 Oct 2025 23:09:29 +0100 Subject: [PATCH 07/10] chore: make gotidy Signed-off-by: Paulo Dias --- cmd/mdatagen/go.mod | 9 --------- 1 file changed, 9 deletions(-) diff --git a/cmd/mdatagen/go.mod b/cmd/mdatagen/go.mod index b4d54f501e4a..45a90a66252d 100644 --- a/cmd/mdatagen/go.mod +++ b/cmd/mdatagen/go.mod @@ -73,20 +73,11 @@ require ( go.opentelemetry.io/otel/sdk v1.38.0 // indirect go.uber.org/multierr v1.11.0 // indirect go.yaml.in/yaml/v3 v3.0.4 // indirect -<<<<<<< HEAD - golang.org/x/net v0.43.0 // indirect - golang.org/x/sys v0.35.0 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20250707201910-8d1bb00bc6a7 // indirect - google.golang.org/grpc v1.75.0 // indirect - google.golang.org/protobuf v1.36.8 // indirect -======= golang.org/x/net v0.44.0 // indirect golang.org/x/sys v0.36.0 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20250825161204-c5933d9347a5 // indirect google.golang.org/grpc v1.76.0 // indirect google.golang.org/protobuf v1.36.10 // indirect - gopkg.in/yaml.v3 v3.0.1 // indirect ->>>>>>> 995bea5150603d41fbb1a3f9f9a55509d49bea00 ) replace go.opentelemetry.io/collector/component => ../../component From 8039f9cbeb10de8ce45423f6323b1a85466d6ffc Mon Sep 17 00:00:00 2001 From: Paulo Dias Date: Fri, 10 Oct 2025 23:16:29 +0100 Subject: [PATCH 08/10] chore: fix metadata Signed-off-by: Paulo Dias --- .../internal/samplescraper/metadata.yaml | 22 ------------------- 1 file changed, 22 deletions(-) diff --git a/cmd/mdatagen/internal/samplescraper/metadata.yaml b/cmd/mdatagen/internal/samplescraper/metadata.yaml index 255be818214c..6f9b4c957725 100644 --- a/cmd/mdatagen/internal/samplescraper/metadata.yaml +++ b/cmd/mdatagen/internal/samplescraper/metadata.yaml @@ -114,28 +114,6 @@ metrics: warnings: if_enabled_not_set: This metric will be disabled by default soon. - optional.metric: - enabled: false - description: "[DEPRECATED] Gauge double metric disabled by default." - unit: "1" - gauge: - value_type: double - attributes: [string_attr, boolean_attr, boolean_attr2] - warnings: - if_configured: This metric is deprecated and will be removed soon. - - optional.metric.empty_unit: - enabled: false - stability: - level: deprecated - description: "[DEPRECATED] Gauge double metric disabled by default." - unit: "" - gauge: - value_type: double - attributes: [string_attr, boolean_attr] - warnings: - if_configured: This metric is deprecated and will be removed soon. - default.metric.to_be_removed: enabled: true description: "[DEPRECATED] Non-monotonic delta sum double metric enabled by default." From ab936eb49e3c10604626fb7a7ea9c5b6261d2dea Mon Sep 17 00:00:00 2001 From: Paulo Dias Date: Fri, 10 Oct 2025 23:21:56 +0100 Subject: [PATCH 09/10] chore: update docs Signed-off-by: Paulo Dias --- cmd/mdatagen/internal/samplescraper/documentation.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cmd/mdatagen/internal/samplescraper/documentation.md b/cmd/mdatagen/internal/samplescraper/documentation.md index 5044a8669ef5..5b75413d1c3c 100644 --- a/cmd/mdatagen/internal/samplescraper/documentation.md +++ b/cmd/mdatagen/internal/samplescraper/documentation.md @@ -90,9 +90,9 @@ metrics: [DEPRECATED] Gauge double metric disabled by default. -| Unit | Metric Type | Value Type | Stability | -| ---- | ----------- | ---------- | --------- | -| | Gauge | Double | deprecated | +| Unit | Metric Type | Value Type | +| ---- | ----------- | ---------- | +| | Gauge | Double | #### Attributes From 54b37b44497c5d6f368c9f47f2ae8831a55a2ec1 Mon Sep 17 00:00:00 2001 From: Paulo Dias Date: Sat, 11 Oct 2025 15:24:00 +0100 Subject: [PATCH 10/10] fix: move to IsSorted Signed-off-by: Paulo Dias --- cmd/mdatagen/internal/command.go | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/cmd/mdatagen/internal/command.go b/cmd/mdatagen/internal/command.go index 4b4af4f77808..511dad19d159 100644 --- a/cmd/mdatagen/internal/command.go +++ b/cmd/mdatagen/internal/command.go @@ -447,12 +447,9 @@ func validateMappingKeysSorted(root *yaml.Node, path ...string) error { for i := 0; i < len(n.Content); i += 2 { keys = append(keys, n.Content[i].Value) } - sorted := append([]string(nil), keys...) - slices.Sort(sorted) - for i := range keys { - if keys[i] != sorted[i] { - return fmt.Errorf("%v keys are not sorted: %v", path, keys) - } + + if !slices.IsSorted(keys) { + return fmt.Errorf("%v keys are not sorted: %v", path, keys) } return nil }