From 70f2ef12652b88131d6bdebf7a04dd8eb5c51de2 Mon Sep 17 00:00:00 2001 From: David Ashpole Date: Fri, 17 May 2024 13:57:48 +0000 Subject: [PATCH 1/4] add metric producers to meter_provider configuration --- examples/kitchen-sink.yaml | 8 ++++++++ schema/meter_provider.json | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+) diff --git a/examples/kitchen-sink.yaml b/examples/kitchen-sink.yaml index e9758ac..27d2d49 100644 --- a/examples/kitchen-sink.yaml +++ b/examples/kitchen-sink.yaml @@ -142,6 +142,10 @@ meter_provider: # Configure resource attributes to be excluded, in this example attribute service.attr1. excluded: - "service.attr1" + # Configure metric producers. + producers: + # Configure metric producer to be opencensus + - opencensus: {} # Configure a periodic metric reader. - periodic: # Configure delay interval (in milliseconds) between start of two consecutive exports. @@ -203,6 +207,10 @@ meter_provider: # # Environment variable: OTEL_EXPORTER_OTLP_METRICS_DEFAULT_HISTOGRAM_AGGREGATION default_histogram_aggregation: base2_exponential_bucket_histogram + # Configure metric producers. + producers: + # Configure metric producer to be prometheus + - prometheus: {} # Configure a periodic metric reader. - periodic: # Configure exporter. diff --git a/schema/meter_provider.json b/schema/meter_provider.json index e53372e..619bae0 100644 --- a/schema/meter_provider.json +++ b/schema/meter_provider.json @@ -33,6 +33,12 @@ }, "exporter": { "$ref": "#/$defs/MetricExporter" + }, + "producers": { + "type": "array", + "items": { + "$ref": "#/$defs/MetricProducer" + } } }, "required": [ @@ -46,6 +52,12 @@ "properties": { "exporter": { "$ref": "#/$defs/MetricExporter" + }, + "producers": { + "type": "array", + "items": { + "$ref": "#/$defs/MetricProducer" + } } }, "required": [ @@ -75,6 +87,27 @@ } } }, + "MetricProducer": { + "type": "object", + "additionalProperties": true, + "minProperties": 1, + "maxProperties": 1, + "properties": { + "opencensus": { + "type": "object", + "additionalProperties": false + }, + "prometheus": { + "type": "object", + "additionalProperties": false + } + }, + "patternProperties": { + ".*": { + "type": "object" + } + } + }, "Prometheus": { "type": "object", "additionalProperties": false, From 2e05e2765c458bbf0a47a7f0ad93e23c4b99517c Mon Sep 17 00:00:00 2001 From: David Ashpole Date: Tue, 21 May 2024 16:22:23 +0000 Subject: [PATCH 2/4] address feedback --- schema/meter_provider.json | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/schema/meter_provider.json b/schema/meter_provider.json index 619bae0..9967dcf 100644 --- a/schema/meter_provider.json +++ b/schema/meter_provider.json @@ -33,12 +33,6 @@ }, "exporter": { "$ref": "#/$defs/MetricExporter" - }, - "producers": { - "type": "array", - "items": { - "$ref": "#/$defs/MetricProducer" - } } }, "required": [ @@ -96,10 +90,6 @@ "opencensus": { "type": "object", "additionalProperties": false - }, - "prometheus": { - "type": "object", - "additionalProperties": false } }, "patternProperties": { @@ -143,6 +133,12 @@ }, "pull": { "$ref": "#/$defs/PullMetricReader" + }, + "producers": { + "type": "array", + "items": { + "$ref": "#/$defs/MetricProducer" + } } } }, From 9fb79e57c995a12350364ac255bed1e6b9f84494 Mon Sep 17 00:00:00 2001 From: David Ashpole Date: Tue, 21 May 2024 18:58:26 +0000 Subject: [PATCH 3/4] fix test, and remove maxProperties --- examples/kitchen-sink.yaml | 16 ++++++++-------- schema/meter_provider.json | 1 - 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/examples/kitchen-sink.yaml b/examples/kitchen-sink.yaml index 27d2d49..1e759ed 100644 --- a/examples/kitchen-sink.yaml +++ b/examples/kitchen-sink.yaml @@ -142,10 +142,10 @@ meter_provider: # Configure resource attributes to be excluded, in this example attribute service.attr1. excluded: - "service.attr1" - # Configure metric producers. - producers: - # Configure metric producer to be opencensus - - opencensus: {} + # Configure metric producers. + producers: + # Configure metric producer to be opencensus + - opencensus: {} # Configure a periodic metric reader. - periodic: # Configure delay interval (in milliseconds) between start of two consecutive exports. @@ -207,10 +207,10 @@ meter_provider: # # Environment variable: OTEL_EXPORTER_OTLP_METRICS_DEFAULT_HISTOGRAM_AGGREGATION default_histogram_aggregation: base2_exponential_bucket_histogram - # Configure metric producers. - producers: - # Configure metric producer to be prometheus - - prometheus: {} + # Configure metric producers. + producers: + # Configure metric producer to be prometheus + - prometheus: {} # Configure a periodic metric reader. - periodic: # Configure exporter. diff --git a/schema/meter_provider.json b/schema/meter_provider.json index 9967dcf..72bc26f 100644 --- a/schema/meter_provider.json +++ b/schema/meter_provider.json @@ -126,7 +126,6 @@ "type": "object", "additionalProperties": false, "minProperties": 1, - "maxProperties": 1, "properties": { "periodic": { "$ref": "#/$defs/PeriodicMetricReader" From d472dc45786b386db976f127c6b9348d1647cfcf Mon Sep 17 00:00:00 2001 From: David Ashpole Date: Thu, 23 May 2024 14:06:32 +0000 Subject: [PATCH 4/4] MetricReader maxProperties: 2 --- schema/meter_provider.json | 1 + 1 file changed, 1 insertion(+) diff --git a/schema/meter_provider.json b/schema/meter_provider.json index 72bc26f..7b2945b 100644 --- a/schema/meter_provider.json +++ b/schema/meter_provider.json @@ -126,6 +126,7 @@ "type": "object", "additionalProperties": false, "minProperties": 1, + "maxProperties": 2, "properties": { "periodic": { "$ref": "#/$defs/PeriodicMetricReader"