From a779c059c1fd8c33d3897efe6c894534dd45f9e0 Mon Sep 17 00:00:00 2001 From: Marc Alff Date: Thu, 5 Dec 2024 23:32:06 +0100 Subject: [PATCH 1/2] Fixes #138 --- examples/kitchen-sink.yaml | 14 ++++++-------- schema/meter_provider.json | 18 ++++++++++++------ schema/type_descriptions.yaml | 6 ++++-- 3 files changed, 22 insertions(+), 16 deletions(-) diff --git a/examples/kitchen-sink.yaml b/examples/kitchen-sink.yaml index 0839b5a..6813c11 100644 --- a/examples/kitchen-sink.yaml +++ b/examples/kitchen-sink.yaml @@ -131,10 +131,9 @@ meter_provider: # If omitted, .included resource attributes are included. excluded: - "service.attr1" - # Configure metric producers. - producers: - - # Configure metric producer to be opencensus. - opencensus: + # Configure metric producers. + producers: + - opencensus: - # Configure a periodic metric reader. periodic: # Configure delay interval (in milliseconds) between start of two consecutive exports. @@ -185,10 +184,9 @@ meter_provider: # Configure default histogram aggregation. Values include: explicit_bucket_histogram, base2_exponential_bucket_histogram. For behavior of values, see https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/metrics/sdk_exporters/otlp.md. # If omitted or null, explicit_bucket_histogram is used. default_histogram_aggregation: base2_exponential_bucket_histogram - # Configure metric producers. - producers: - - # Configure metric producer to be prometheus. - prometheus: + # Configure metric producers. + producers: + - prometheus: - # Configure a periodic metric reader. periodic: # Configure exporter. diff --git a/schema/meter_provider.json b/schema/meter_provider.json index 16686a9..3c6cc61 100644 --- a/schema/meter_provider.json +++ b/schema/meter_provider.json @@ -44,6 +44,12 @@ }, "exporter": { "$ref": "#/$defs/PushMetricExporter" + }, + "producers": { + "type": "array", + "items": { + "$ref": "#/$defs/MetricProducer" + } } }, "required": [ @@ -57,6 +63,12 @@ "properties": { "exporter": { "$ref": "#/$defs/PullMetricExporter" + }, + "producers": { + "type": "array", + "items": { + "$ref": "#/$defs/MetricProducer" + } } }, "required": [ @@ -151,12 +163,6 @@ }, "pull": { "$ref": "#/$defs/PullMetricReader" - }, - "producers": { - "type": "array", - "items": { - "$ref": "#/$defs/MetricProducer" - } } } }, diff --git a/schema/type_descriptions.yaml b/schema/type_descriptions.yaml index 149cc57..47cd0c8 100644 --- a/schema/type_descriptions.yaml +++ b/schema/type_descriptions.yaml @@ -328,13 +328,13 @@ property_descriptions: pull: Configure a pull based metric reader. periodic: Configure a periodic metric reader. - producers: Configure metric producers. path_patterns: - .meter_provider.readers[] - type: PullMetricReader property_descriptions: exporter: Configure exporter. + producers: Configure metric producers. path_patterns: - .meter_provider.readers[].pull @@ -349,6 +349,7 @@ If omitted or null, 30000 is used. exporter: Configure exporter. + producers: Configure metric producers. path_patterns: - .meter_provider.readers[].periodic @@ -357,7 +358,8 @@ opencensus: Configure metric producer to be opencensus. prometheus: Configure metric producer to be prometheus. path_patterns: - - .meter_provider.readers[].producers[] + - .meter_provider.readers[].producers[].pull + - .meter_provider.readers[].producers[].periodic - type: MetricExporter property_descriptions: From c5aaa18bc861567e657fc5c90cad8e244c3cf3af Mon Sep 17 00:00:00 2001 From: Marc Alff Date: Thu, 5 Dec 2024 23:40:57 +0100 Subject: [PATCH 2/2] Changelog, cleanup. --- CHANGELOG.md | 1 + schema/meter_provider.json | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d22f80e..a160e6e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ * Improved file_format documentation. [#137](https://github.com/open-telemetry/opentelemetry-configuration/pull/137) * Periodic exporter interval default value is inconsistent [#143](https://github.com/open-telemetry/opentelemetry-configuration/pull/143) +* Fix MetricReader invalid configurations [#148](https://github.com/open-telemetry/opentelemetry-configuration/pull/148) ## [v0.3.0] - 2024-05-08 diff --git a/schema/meter_provider.json b/schema/meter_provider.json index 3c6cc61..996b9e2 100644 --- a/schema/meter_provider.json +++ b/schema/meter_provider.json @@ -156,7 +156,7 @@ "type": "object", "additionalProperties": false, "minProperties": 1, - "maxProperties": 2, + "maxProperties": 1, "properties": { "periodic": { "$ref": "#/$defs/PeriodicMetricReader"