From 27c133d26f30f99983dae524b9a056cc73fe209c Mon Sep 17 00:00:00 2001 From: Jack Berg <jberg@newrelic.com> Date: Fri, 22 Nov 2024 13:33:46 -0600 Subject: [PATCH 1/2] Scope config --- examples/kitchen-sink.yaml | 52 ++++++++++++++++++++++- schema/logger_provider.json | 42 +++++++++++++++++++ schema/meter_provider.json | 42 +++++++++++++++++++ schema/tracer_provider.json | 42 +++++++++++++++++++ schema/type_descriptions.yaml | 78 +++++++++++++++++++++++++++++++++++ 5 files changed, 255 insertions(+), 1 deletion(-) diff --git a/examples/kitchen-sink.yaml b/examples/kitchen-sink.yaml index 90e6e21..02c150a 100644 --- a/examples/kitchen-sink.yaml +++ b/examples/kitchen-sink.yaml @@ -73,6 +73,23 @@ logger_provider: attribute_value_length_limit: 4096 # Configure max attribute count. Overrides .attribute_limits.attribute_count_limit. attribute_count_limit: 128 + # Configure loggers. + logger_configurator: + # Configure the default logger config used there is no matching entry in .logger_configurator.loggers. + default_config: + # Configure if the logger is enabled or not. + disabled: true + # Configure loggers. + loggers: + - # Configure logger names to match, evaluated as follows: + # + # * If the logger name exactly matches. + # * If the logger name matches the wildcard pattern, where '?' matches any single character and '*' matches any number of characters including none. + name: io.opentelemetry.contrib.* + # The logger config. + config: + # Configure if the logger is enabled or not. + disabled: false # Configure meter provider. meter_provider: @@ -217,6 +234,23 @@ meter_provider: - key3 # Configure the exemplar filter. Known values include: trace_based, always_on, always_off. exemplar_filter: trace_based + # Configure meters. + meter_configurator: + # Configure the default meter config used there is no matching entry in .meter_configurator.meters. + default_config: + # Configure if the meter is enabled or not. + disabled: true + # Configure meters. + meters: + - # Configure meter names to match, evaluated as follows: + # + # * If the meter name exactly matches. + # * If the meter name matches the wildcard pattern, where '?' matches any single character and '*' matches any number of characters including none. + name: io.opentelemetry.contrib.* + # The meter config. + config: + # Configure if the meter is enabled or not. + disabled: false # Configure text map context propagators. propagator: @@ -320,7 +354,23 @@ tracer_provider: local_parent_not_sampled: # Configure sampler to be always_off. always_off: - + # Configure tracers. + tracer_configurator: + # Configure the default tracer config used there is no matching entry in .tracer_configurator.tracers. + default_config: + # Configure if the tracer is enabled or not. + disabled: true + # Configure tracers. + tracers: + - # Configure tracer names to match, evaluated as follows: + # + # * If the tracer name exactly matches. + # * If the tracer name matches the wildcard pattern, where '?' matches any single character and '*' matches any number of characters including none. + name: io.opentelemetry.contrib.* + # The tracer config. + config: + # Configure if the tracer is enabled or not. + disabled: false # Configure resource for all signals. resource: diff --git a/schema/logger_provider.json b/schema/logger_provider.json index f05e248..076a49f 100644 --- a/schema/logger_provider.json +++ b/schema/logger_provider.json @@ -13,6 +13,9 @@ }, "limits": { "$ref": "#/$defs/LogRecordLimits" + }, + "logger_configurator": { + "$ref": "#/$defs/LoggerConfigurator" } }, "$defs": { @@ -107,6 +110,45 @@ "type": ["object", "null"] } } + }, + "LoggerConfigurator": { + "type": ["object", "null"], + "additionalProperties": false, + "title": "LoggerConfigurator", + "properties": { + "default_config": { + "$ref": "#/$defs/LoggerConfig" + }, + "loggers": { + "type": "array", + "items": { + "$ref": "#/$defs/LoggerMatcherAndConfig" + } + } + } + }, + "LoggerMatcherAndConfig": { + "type": ["object", "null"], + "additionalProperties": false, + "title": "LoggerMatcherAndConfig", + "properties": { + "name": { + "type": ["string", "null"] + }, + "config": { + "$ref": "#/$defs/LoggerConfig" + } + } + }, + "LoggerConfig": { + "type": ["object", "null"], + "additionalProperties": false, + "title": "LoggerConfig", + "properties": { + "disabled": { + "type": ["boolean", "null"] + } + } } } } diff --git a/schema/meter_provider.json b/schema/meter_provider.json index 1412123..58cd686 100644 --- a/schema/meter_provider.json +++ b/schema/meter_provider.json @@ -24,6 +24,9 @@ "always_off", "trace_based" ] + }, + "meter_configurator": { + "$ref": "#/$defs/MeterConfigurator" } }, "$defs": { @@ -321,6 +324,45 @@ } } } + }, + "MeterConfigurator": { + "type": ["object", "null"], + "additionalProperties": false, + "title": "MeterConfigurator", + "properties": { + "default_config": { + "$ref": "#/$defs/MeterConfig" + }, + "meters": { + "type": "array", + "items": { + "$ref": "#/$defs/MeterMatcherAndConfig" + } + } + } + }, + "MeterMatcherAndConfig": { + "type": ["object", "null"], + "additionalProperties": false, + "title": "MeterMatcherAndConfig", + "properties": { + "name": { + "type": ["string", "null"] + }, + "config": { + "$ref": "#/$defs/MeterConfig" + } + } + }, + "MeterConfig": { + "type": ["object", "null"], + "additionalProperties": false, + "title": "MeterConfig", + "properties": { + "disabled": { + "type": ["boolean", "null"] + } + } } } } diff --git a/schema/tracer_provider.json b/schema/tracer_provider.json index 67c2c56..9ca4f24 100644 --- a/schema/tracer_provider.json +++ b/schema/tracer_provider.json @@ -16,6 +16,9 @@ }, "sampler": { "$ref": "#/$defs/Sampler" + }, + "tracer_configurator": { + "$ref": "#/$defs/TracerConfigurator" } }, "$defs": { @@ -215,6 +218,45 @@ "endpoint" ], "title": "Zipkin" + }, + "TracerConfigurator": { + "type": ["object", "null"], + "additionalProperties": false, + "title": "TracerConfigurator", + "properties": { + "default_config": { + "$ref": "#/$defs/TracerConfig" + }, + "tracers": { + "type": "array", + "items": { + "$ref": "#/$defs/TracerMatcherAndConfig" + } + } + } + }, + "TracerMatcherAndConfig": { + "type": ["object", "null"], + "additionalProperties": false, + "title": "MeterMatcherAndConfig", + "properties": { + "name": { + "type": ["string", "null"] + }, + "config": { + "$ref": "#/$defs/TracerConfig" + } + } + }, + "TracerConfig": { + "type": ["object", "null"], + "additionalProperties": false, + "title": "TracerConfig", + "properties": { + "disabled": { + "type": ["boolean", "null"] + } + } } } } diff --git a/schema/type_descriptions.yaml b/schema/type_descriptions.yaml index 6fc0041..f6dfd29 100644 --- a/schema/type_descriptions.yaml +++ b/schema/type_descriptions.yaml @@ -87,6 +87,7 @@ property_descriptions: processors: Configure log record processors. limits: Configure log record limits. See also attribute_limits. + logger_configurator: Configure loggers. path_patterns: - .logger_provider @@ -126,6 +127,31 @@ attribute_count_limit: Configure max attribute count. Overrides .attribute_limits.attribute_count_limit. path_patterns: - .logger_provider.limits + +- type: LoggerConfigurator + property_descriptions: + default_config: Configure the default logger config used there is no matching entry in .logger_configurator.loggers. + loggers: Configure loggers. + path_patterns: + - .logger_provider.logger_configurator + +- type: LoggerConfigAndMatcher + property_descriptions: + name: > + Configure logger names to match, evaluated as follows: + + * If the logger name exactly matches. + * If the logger name matches the wildcard pattern, where '?' matches any single character and '*' matches any number of characters including none. + config: The logger config. + path_patterns: + - .logger_provider.logger_configurator.loggers[] + +- type: LoggerConfig + property_descriptions: + disabled: Configure if the logger is enabled or not. + path_patterns: + - .logger_provider.logger_configurator.default_config + - .logger_provider.logger_configurator.loggers[].config # END LoggerProvider # START TracerProvider @@ -134,6 +160,7 @@ processors: Configure span processors. limits: Configure span limits. See also attribute_limits. sampler: Configure the sampler. + tracer_configurator: Configure tracers. path_patterns: - .tracer_provider @@ -201,6 +228,31 @@ path_patterns: - .tracer_provider.sampler - .tracer_provider.sampler.* + +- type: TracerConfigurator + property_descriptions: + default_config: Configure the default tracer config used there is no matching entry in .tracer_configurator.tracers. + tracers: Configure tracers. + path_patterns: + - .tracer_provider.tracer_configurator + +- type: TracerConfigAndMatcher + property_descriptions: + name: > + Configure tracer names to match, evaluated as follows: + + * If the tracer name exactly matches. + * If the tracer name matches the wildcard pattern, where '?' matches any single character and '*' matches any number of characters including none. + config: The tracer config. + path_patterns: + - .tracer_provider.tracer_configurator.tracers[] + +- type: TracerConfig + property_descriptions: + disabled: Configure if the tracer is enabled or not. + path_patterns: + - .tracer_provider.tracer_configurator.default_config + - .tracer_provider.tracer_configurator.tracers[].config # END TracerProvider # START MeterProvider @@ -209,6 +261,7 @@ readers: Configure metric readers. views: Configure views. Each view has a selector which determines the instrument(s) it applies to, and a configuration for the resulting stream(s). exemplar_filter: "Configure the exemplar filter. Known values include: trace_based, always_on, always_off." + meter_configurator: Configure meters. path_patterns: - .meter_provider @@ -325,6 +378,31 @@ record_min_max: Configure record min and max. path_patterns: - .meter_provider.views[].stream.aggregation.explicit_bucket_histogram + +- type: MeterConfigurator + property_descriptions: + default_config: Configure the default meter config used there is no matching entry in .meter_configurator.meters. + meters: Configure meters. + path_patterns: + - .meter_provider.meter_configurator + +- type: MeterConfigAndMatcher + property_descriptions: + name: > + Configure meter names to match, evaluated as follows: + + * If the meter name exactly matches. + * If the meter name matches the wildcard pattern, where '?' matches any single character and '*' matches any number of characters including none. + config: The meter config. + path_patterns: + - .meter_provider.meter_configurator.meters[] + +- type: MeterConfig + property_descriptions: + disabled: Configure if the meter is enabled or not. + path_patterns: + - .meter_provider.meter_configurator.default_config + - .meter_provider.meter_configurator.meters[].config # END meter_provider # START common From 4258a37a665d2509b8750d2f76570c8722faba02 Mon Sep 17 00:00:00 2001 From: Jack Berg <jberg@newrelic.com> Date: Mon, 25 Nov 2024 10:48:36 -0600 Subject: [PATCH 2/2] Fix typo --- schema/tracer_provider.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/schema/tracer_provider.json b/schema/tracer_provider.json index 9ca4f24..7032fee 100644 --- a/schema/tracer_provider.json +++ b/schema/tracer_provider.json @@ -238,10 +238,10 @@ "TracerMatcherAndConfig": { "type": ["object", "null"], "additionalProperties": false, - "title": "MeterMatcherAndConfig", + "title": "TracerMatcherAndConfig", "properties": { "name": { - "type": ["string", "null"] + "type": ["string"] }, "config": { "$ref": "#/$defs/TracerConfig" @@ -249,7 +249,7 @@ } }, "TracerConfig": { - "type": ["object", "null"], + "type": ["object"], "additionalProperties": false, "title": "TracerConfig", "properties": {