diff --git a/.gitignore b/.gitignore index 79390fd..24e60ca 100644 --- a/.gitignore +++ b/.gitignore @@ -21,3 +21,6 @@ # Node.js files for tools (e.g. markdown-toc) node_modules/ package-lock.json + +# Output directory after applying env substitution +out \ No newline at end of file diff --git a/Makefile b/Makefile index 7c34c31..808aacd 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,6 @@ SCHEMA_FILES := $(shell find . -path './schema/*.json' -exec basename {} \; | sort) -EXAMPLE_FILES := $(shell find . -path './examples/*.yaml' | sort) +EXAMPLE_FILES := $(shell find . -path './examples/*.yaml' -exec basename {} \; | sort) +$(shell mkdir -p out) .PHONY: all all: install-tools compile-schema validate-examples @@ -16,7 +17,8 @@ compile-schema: validate-examples: @if ! npm ls ajv-cli; then npm install; fi @for f in $(EXAMPLE_FILES); do \ - npx --no ajv-cli validate --spec=draft2020 --allow-matching-properties --errors=text -s ./schema/opentelemetry_configuration.json -r "./schema/!(opentelemetry_configuration.json)" -d $$f \ + npx envsub ./examples/$$f ./out/$$f || exit 1; \ + npx --no ajv-cli validate --spec=draft2020 --allow-matching-properties --errors=text -s ./schema/opentelemetry_configuration.json -r "./schema/!(opentelemetry_configuration.json)" -d ./out/$$f \ || exit 1; \ done diff --git a/README.md b/README.md index aeb4d69..4d804a0 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,15 @@ This repository contains the JSON schema that defines the OpenTelemetry configur - code generation - broad support across languages +## Starter templates + +The [examples](./examples) repository contains a variety of sample configuration files to help get started and illustrate useful patterns. The following are noteworthy: + +- [sdk-migration-config.yaml](./examples/sdk-migration-config.yaml): Includes env var substitution references to all [standard environment variables](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/configuration/sdk-environment-variables.md) which map cleanly to file configuration (see notes in the example for the set of env vars which are not referenced). Note, SDKs parsing configuration files ignore all env vars besides those referenced via [env var substitution][]. This is a great starting point for transitioning from env var based configuration to file based configuration. +- [sdk-config.yaml](./examples/sdk-config.yaml): Represents the typical default configuration. This is a good starting point if you are not using env var based configuration or wish to transition fully to file based configuration. Note, SDKs parsing configuration files ignore all env vars besides those referenced via [env var substitution][]. + +[env var substitution]: https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/configuration/file-configuration.md#environment-variable-substitution + ## Code generation There are [several tools](https://json-schema.org/implementations.html) available to generate code from a JSON schema. The following shows an example for generating code from the JSON schema in Go: diff --git a/examples/anchors.yaml b/examples/anchors.yaml index 1a6d3c7..5aed3bd 100644 --- a/examples/anchors.yaml +++ b/examples/anchors.yaml @@ -4,7 +4,6 @@ file_format: "0.1" exporters: otlp: &otlp-exporter protocol: http/protobuf - endpoint: http://localhost:4318 certificate: /app/cert.pem client_key: /app/cert.pem client_certificate: /app/cert.pem @@ -20,6 +19,7 @@ logger_provider: otlp: # expand the otlp-exporter anchor <<: *otlp-exporter + endpoint: http://localhost:4318/v1/logs meter_provider: readers: @@ -30,6 +30,7 @@ meter_provider: otlp: # expand the otlp-exporter anchor and add metric specific configuration <<: *otlp-exporter + endpoint: http://localhost:4318/v1/metrics temporality_preference: delta default_histogram_aggregation: base2_exponential_bucket_histogram @@ -40,3 +41,4 @@ tracer_provider: otlp: # expand the otlp-exporter anchor <<: *otlp-exporter + endpoint: http://localhost:4318/v1/traces diff --git a/examples/kitchen-sink.yaml b/examples/kitchen-sink.yaml index b7f1f99..3e0671f 100644 --- a/examples/kitchen-sink.yaml +++ b/examples/kitchen-sink.yaml @@ -61,7 +61,7 @@ logger_provider: # Configure endpoint. # # Environment variable: OTEL_EXPORTER_OTLP_ENDPOINT, OTEL_EXPORTER_OTLP_LOGS_ENDPOINT - endpoint: http://localhost:4318 + endpoint: http://localhost:4318/v1/logs # Configure certificate. # # Environment variable: OTEL_EXPORTER_OTLP_CERTIFICATE, OTEL_EXPORTER_OTLP_LOGS_CERTIFICATE @@ -169,7 +169,7 @@ meter_provider: # Configure endpoint. # # Environment variable: OTEL_EXPORTER_OTLP_ENDPOINT, OTEL_EXPORTER_OTLP_METRICS_ENDPOINT - endpoint: http://localhost:4318 + endpoint: http://localhost:4318/v1/metrics # Configure certificate. # # Environment variable: OTEL_EXPORTER_OTLP_CERTIFICATE, OTEL_EXPORTER_OTLP_METRICS_CERTIFICATE @@ -293,7 +293,7 @@ tracer_provider: # Configure endpoint. # # Environment variable: OTEL_EXPORTER_OTLP_ENDPOINT, OTEL_EXPORTER_OTLP_TRACES_ENDPOINT - endpoint: http://localhost:4318 + endpoint: http://localhost:4318/v1/traces # Configure certificate. # # Environment variable: OTEL_EXPORTER_OTLP_CERTIFICATE, OTEL_EXPORTER_OTLP_TRACES_CERTIFICATE diff --git a/examples/sdk-config.yaml b/examples/sdk-config.yaml new file mode 100644 index 0000000..9675500 --- /dev/null +++ b/examples/sdk-config.yaml @@ -0,0 +1,179 @@ +# sdk-config.yaml is a typical starting point for configuring the SDK, including exporting to +# localhost via OTLP. + +# NOTE: With the exception of env var substitution syntax (i.e. ${MY_ENV}), SDKs ignore +# environment variables when interpreting config files. This including ignoring all env +# vars defined in https://opentelemetry.io/docs/specs/otel/configuration/sdk-environment-variables/. + +# The file format version +file_format: "0.1" + +# Configure if the SDK is disabled or not. +disabled: false + +# Configure resource for all signals. +resource: + # Configure resource attributes. + attributes: + # Configure `service.name` resource attribute + service.name: unknown_service + +# Configure general attribute limits. See also tracer_provider.limits, logger_provider.limits. +attribute_limits: + # Configure max attribute value size. + attribute_value_length_limit: + # Configure max attribute count. + attribute_count_limit: 128 + +# Configure text map context propagators. +propagator: + composite: [tracecontext, baggage] + +# Configure tracer provider. +tracer_provider: + # Configure span processors. + processors: + # Configure a batch span processor. + - batch: + # Configure delay interval (in milliseconds) between two consecutive exports. + schedule_delay: 5000 + # Configure maximum allowed time (in milliseconds) to export data. + export_timeout: 30000 + # Configure maximum queue size. + max_queue_size: 2048 + # Configure maximum batch size. + max_export_batch_size: 512 + # Configure exporter. + exporter: + # Configure exporter to be OTLP. + otlp: + # Configure protocol. + protocol: http/protobuf + # Configure endpoint. + endpoint: http://localhost:4318/v1/traces + # Configure certificate. + certificate: + # Configure mTLS private client key. + client_key: + # Configure mTLS client certificate. + client_certificate: + # Configure compression. + compression: gzip + # Configure max time (in milliseconds) to wait for each export. + timeout: 10000 + # Configure headers: + headers: {} + # Configure span limits. See also attribute_limits. + limits: + # Configure max span attribute value size. Overrides attribute_limits.attribute_value_length_limit. + attribute_value_length_limit: + # Configure max span attribute count. Overrides attribute_limits.attribute_count_limit. + attribute_count_limit: 128 + # Configure max span event count. + event_count_limit: 128 + # Configure max span link count. + link_count_limit: 128 + # Configure max attributes per span event. + event_attribute_count_limit: 128 + # Configure max attributes per span link. + link_attribute_count_limit: 128 + # Configure the sampler. + sampler: + # Configure sampler to be parent_based. Known values include: always_off, always_on, jaeger_remote, parent_based, trace_id_ratio_based. + parent_based: + # Configure root sampler. + root: + # Configure sampler to be always_on. + always_on: {} + # Configure remote_parent_sampled sampler. + remote_parent_sampled: + # Configure sampler to be always_on. + always_on: {} + # Configure remote_parent_not_sampled sampler. + remote_parent_not_sampled: + # Configure sampler to be always_off. + always_off: {} + # Configure local_parent_sampled sampler. + local_parent_sampled: + # Configure sampler to be always_on. + always_on: {} + # Configure local_parent_not_sampled sampler. + local_parent_not_sampled: + # Configure sampler to be always_off. + always_off: {} + +# Configure meter provider. +meter_provider: + # Configure metric readers. + readers: + # Configure a periodic metric reader. + - periodic: + # Configure delay interval (in milliseconds) between start of two consecutive exports. + interval: 60000 + # Configure maximum allowed time (in milliseconds) to export data. + timeout: 30000 + # Configure exporter. + exporter: + # Configure exporter to be OTLP. + otlp: + # Configure protocol. + protocol: http/protobuf + # Configure endpoint. + endpoint: http://localhost:4318/v1/metrics + # Configure certificate. + certificate: + # Configure mTLS private client key. + client_key: + # Configure mTLS client certificate. + client_certificate: + # Configure compression. + compression: gzip + # Configure max time (in milliseconds) to wait for each export. + timeout: 10000 + # Configure headers: + headers: {} + # Configure temporality preference. + temporality_preference: cumulative + # Configure default histogram aggregation. + default_histogram_aggregation: explicit_bucket_histogram + +# Configure logger provider. +logger_provider: + # Configure log record processors. + processors: + # Configure a batch log record processor. + - batch: + # Configure delay interval (in milliseconds) between two consecutive exports. + schedule_delay: 1000 + # Configure maximum allowed time (in milliseconds) to export data. + export_timeout: 30000 + # Configure maximum queue size. + max_queue_size: 2048 + # Configure maximum batch size. + max_export_batch_size: 512 + # Configure exporter. + exporter: + # Configure exporter to be OTLP. + otlp: + # Configure protocol. + protocol: http/protobuf + # Configure endpoint. + endpoint: http://localhost:4318/v1/logs + # Configure certificate. + certificate: + # Configure mTLS private client key. + client_key: + # Configure mTLS client certificate. + client_certificate: + # Configure compression. + compression: gzip + # Configure max time (in milliseconds) to wait for each export. + timeout: 10000 + # Configure headers: + headers: {} + # Configure log record limits. See also attribute_limits. + limits: + # Configure max log record attribute value size. Overrides attribute_limits.attribute_value_length_limit. + attribute_value_length_limit: + # Configure max log record attribute count. Overrides attribute_limits.attribute_count_limit. + attribute_count_limit: 128 diff --git a/examples/sdk-migration-config.yaml b/examples/sdk-migration-config.yaml new file mode 100644 index 0000000..772c0e7 --- /dev/null +++ b/examples/sdk-migration-config.yaml @@ -0,0 +1,211 @@ +# sdk-migration-config.yaml is a typical starting point for configuring the SDK when migrating +# from environment variable based configuration. +# +# This template includes env var substitution references (i.e. ${MY_ENV}) for all spec defined +# env vars (https://opentelemetry.io/docs/specs/otel/configuration/sdk-environment-variables/) +# which map cleanly to file configuration. For example, OTEL_SDK_DISABLED is referenced below, +# but OTEL_TRACES_EXPORTER is not since it does not map well to the hierarchical structure of +# file configuration. +# +# NOTE: With the exception of env var substitution syntax, SDKs ignore environment variables +# when interpreting config files. For example, if "disabled: ${OTEL_SDK_DISABLED:-false}" +# is replaced with "disabled: false", then setting the env var OTEL_SDK_DISABLED will have +# no effect. See https://opentelemetry.io/docs/specs/otel/configuration/file-configuration/ +# for more information. The following spec defined env vars are NOT referenced and are thus +# ignored: +# +# - OTEL_RESOURCE_ATTRIBUTES +# - OTEL_LOG_LEVEL +# - OTEL_PROPAGATORS +# - OTEL_TRACES_SAMPLER +# - OTEL_TRACES_SAMPLER_ARG +# - OTEL_EXPORTER_ZIPKIN_ENDPOINT +# - OTEL_EXPORTER_ZIPKIN_TIMEOUT +# - OTEL_EXPORTER_PROMETHEUS_HOST +# - OTEL_EXPORTER_PROMETHEUS_PORT +# - OTEL_TRACES_EXPORTER +# - OTEL_METRICS_EXPORTER +# - OTEL_LOGS_EXPORTER +# - OTEL_METRICS_EXEMPLAR_FILTER +# - OTEL_EXPORTER_OTLP_PROTOCOL +# - OTEL_EXPORTER_OTLP_ENDPOINT +# - OTEL_EXPORTER_OTLP_INSECURE, OTEL_EXPORTER_OTLP_{SIGNAL}_INSECURE +# - OTEL_EXPORTER_OTLP_CERTIFICATE +# - OTEL_EXPORTER_OTLP_CLIENT_KEY +# - OTEL_EXPORTER_OTLP_CLIENT_CERTIFICATE +# - OTEL_EXPORTER_OTLP_HEADERS, OTEL_EXPORTER_OTLP_{SIGNAL}_HEADERS +# - OTEL_EXPORTER_OTLP_COMPRESSION +# - OTEL_EXPORTER_OTLP_TIMEOUT + +# The file format version +file_format: "0.1" + +# Configure if the SDK is disabled or not. +disabled: ${OTEL_SDK_DISABLED:-false} + +# Configure resource for all signals. +resource: + # Configure resource attributes. + attributes: + # Configure `service.name` resource attribute + service.name: ${OTEL_SERVICE_NAME:-unknown_service} + +# Configure general attribute limits. See also tracer_provider.limits, logger_provider.limits. +attribute_limits: + # Configure max attribute value size. + attribute_value_length_limit: ${OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT} + # Configure max attribute count. + attribute_count_limit: ${OTEL_ATTRIBUTE_COUNT_LIMIT:-128} + +# Configure text map context propagators. +propagator: + composite: [tracecontext, baggage] + +# Configure tracer provider. +tracer_provider: + # Configure span processors. + processors: + # Configure a batch span processor. + - batch: + # Configure delay interval (in milliseconds) between two consecutive exports. + schedule_delay: ${OTEL_BSP_SCHEDULE_DELAY:-5000} + # Configure maximum allowed time (in milliseconds) to export data. + export_timeout: ${OTEL_BSP_EXPORT_TIMEOUT:-30000} + # Configure maximum queue size. + max_queue_size: ${OTEL_BSP_MAX_QUEUE_SIZE:-2048} + # Configure maximum batch size. + max_export_batch_size: ${OTEL_BSP_MAX_EXPORT_BATCH_SIZE:-512} + # Configure exporter. + exporter: + # Configure exporter to be OTLP. + otlp: + # Configure protocol. + protocol: ${OTEL_EXPORTER_OTLP_TRACES_PROTOCOL:-http/protobuf} + # Configure endpoint. + endpoint: ${OTEL_EXPORTER_OTLP_TRACES_ENDPOINT:-http://localhost:4318/v1/traces} + # Configure certificate. + certificate: ${OTEL_EXPORTER_OTLP_TRACES_CERTIFICATE} + # Configure mTLS private client key. + client_key: ${OTEL_EXPORTER_OTLP_TRACES_CLIENT_KEY} + # Configure mTLS client certificate. + client_certificate: ${OTEL_EXPORTER_OTLP_TRACES_CLIENT_CERTIFICATE} + # Configure compression. + compression: ${OTEL_EXPORTER_OTLP_TRACES_COMPRESSION:-gzip} + # Configure max time (in milliseconds) to wait for each export. + timeout: ${OTEL_EXPORTER_OTLP_TRACES_TIMEOUT:-10000} + # Configure headers: + headers: {} + # Configure span limits. See also attribute_limits. + limits: + # Configure max span attribute value size. Overrides attribute_limits.attribute_value_length_limit. + attribute_value_length_limit: ${OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT} + # Configure max span attribute count. Overrides attribute_limits.attribute_count_limit. + attribute_count_limit: ${OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT:-128} + # Configure max span event count. + event_count_limit: ${OTEL_SPAN_EVENT_COUNT_LIMIT:-128} + # Configure max span link count. + link_count_limit: ${OTEL_SPAN_LINK_COUNT_LIMIT:-128} + # Configure max attributes per span event. + event_attribute_count_limit: ${OTEL_EVENT_ATTRIBUTE_COUNT_LIMIT:-128} + # Configure max attributes per span link. + link_attribute_count_limit: ${OTEL_LINK_ATTRIBUTE_COUNT_LIMIT:-128} + # Configure the sampler. + sampler: + # Configure sampler to be parent_based. Known values include: always_off, always_on, jaeger_remote, parent_based, trace_id_ratio_based. + parent_based: + # Configure root sampler. + root: + # Configure sampler to be always_on. + always_on: {} + # Configure remote_parent_sampled sampler. + remote_parent_sampled: + # Configure sampler to be always_on. + always_on: {} + # Configure remote_parent_not_sampled sampler. + remote_parent_not_sampled: + # Configure sampler to be always_off. + always_off: {} + # Configure local_parent_sampled sampler. + local_parent_sampled: + # Configure sampler to be always_on. + always_on: {} + # Configure local_parent_not_sampled sampler. + local_parent_not_sampled: + # Configure sampler to be always_off. + always_off: {} + +# Configure meter provider. +meter_provider: + # Configure metric readers. + readers: + # Configure a periodic metric reader. + - periodic: + # Configure delay interval (in milliseconds) between start of two consecutive exports. + interval: ${OTEL_METRIC_EXPORT_INTERVAL:-60000} + # Configure maximum allowed time (in milliseconds) to export data. + timeout: ${OTEL_METRIC_EXPORT_TIMEOUT:-30000} + # Configure exporter. + exporter: + # Configure exporter to be OTLP. + otlp: + # Configure protocol. + protocol: ${OTEL_EXPORTER_OTLP_METRICS_PROTOCOL:-http/protobuf} + # Configure endpoint. + endpoint: ${OTEL_EXPORTER_OTLP_METRICS_ENDPOINT:-http://localhost:4318/v1/metrics} + # Configure certificate. + certificate: ${OTEL_EXPORTER_OTLP_METRICS_CERTIFICATE} + # Configure mTLS private client key. + client_key: ${OTEL_EXPORTER_OTLP_METRICS_CLIENT_KEY} + # Configure mTLS client certificate. + client_certificate: ${OTEL_EXPORTER_OTLP_METRICS_CLIENT_CERTIFICATE} + # Configure compression. + compression: ${OTEL_EXPORTER_OTLP_METRICS_COMPRESSION:-gzip} + # Configure max time (in milliseconds) to wait for each export. + timeout: ${OTEL_EXPORTER_OTLP_METRICS_TIMEOUT:-10000} + # Configure headers: + headers: {} + # Configure temporality preference. + temporality_preference: ${OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE:-cumulative} + # Configure default histogram aggregation. + default_histogram_aggregation: ${OTEL_EXPORTER_OTLP_METRICS_DEFAULT_HISTOGRAM_AGGREGATION:-explicit_bucket_histogram} + +# Configure logger provider. +logger_provider: + # Configure log record processors. + processors: + # Configure a batch log record processor. + - batch: + # Configure delay interval (in milliseconds) between two consecutive exports. + schedule_delay: ${OTEL_BLRP_SCHEDULE_DELAY:-1000} + # Configure maximum allowed time (in milliseconds) to export data. + export_timeout: ${OTEL_BLRP_EXPORT_TIMEOUT:-30000} + # Configure maximum queue size. + max_queue_size: ${OTEL_BLRP_MAX_QUEUE_SIZE:-2048} + # Configure maximum batch size. + max_export_batch_size: ${OTEL_BLRP_MAX_EXPORT_BATCH_SIZE:-512} + # Configure exporter. + exporter: + # Configure exporter to be OTLP. + otlp: + # Configure protocol. + protocol: ${OTEL_EXPORTER_OTLP_LOGS_PROTOCOL:-http/protobuf} + # Configure endpoint. + endpoint: ${OTEL_EXPORTER_OTLP_LOGS_ENDPOINT:-http://localhost:4318/v1/logs} + # Configure certificate. + certificate: ${OTEL_EXPORTER_OTLP_LOGS_CERTIFICATE} + # Configure mTLS private client key. + client_key: ${OTEL_EXPORTER_OTLP_LOGS_CLIENT_KEY} + # Configure mTLS client certificate. + client_certificate: ${OTEL_EXPORTER_OTLP_LOGS_CLIENT_CERTIFICATE} + # Configure compression. + compression: ${OTEL_EXPORTER_OTLP_LOGS_COMPRESSION:-gzip} + # Configure max time (in milliseconds) to wait for each export. + timeout: ${OTEL_EXPORTER_OTLP_LOGS_TIMEOUT:-10000} + # Configure headers: + headers: {} + # Configure log record limits. See also attribute_limits. + limits: + # Configure max log record attribute value size. Overrides attribute_limits.attribute_value_length_limit. + attribute_value_length_limit: ${OTEL_LOGRECORD_ATTRIBUTE_VALUE_LENGTH_LIMIT} + # Configure max log record attribute count. Overrides attribute_limits.attribute_count_limit. + attribute_count_limit: ${OTEL_LOGRECORD_ATTRIBUTE_COUNT_LIMIT:-128} diff --git a/package.json b/package.json index 785eac3..0122c0b 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,8 @@ { "devDependencies": { "ajv-cli": "^5.0.0" + }, + "dependencies": { + "envsub": "^4.1.0" } } diff --git a/schema/common.json b/schema/common.json index 8c488e8..b4ff765 100644 --- a/schema/common.json +++ b/schema/common.json @@ -2,14 +2,14 @@ "$id": "https://opentelemetry.io/otelconfig/common.json", "$schema": "https://json-schema.org/draft/2020-12/schema", "title": "Common", - "type": "object", + "type": ["object", "null"], "$defs": { "Headers": { - "type": "object", + "type": ["object", "null"], "title": "Headers", "patternProperties": { ".*": { - "type": "string" + "type": ["string", "null"] } } }, @@ -32,37 +32,37 @@ } }, "Otlp": { - "type": "object", + "type": ["object", "null"], "additionalProperties": false, "properties": { "protocol": { - "type": "string", + "type": ["string", "null"], "pattern": "^(http|grpc)\\/(protobuf|json)" }, "endpoint": { - "type": "string" + "type": ["string", "null"] }, "certificate": { - "type": "string" + "type": ["string", "null"] }, "client_key": { - "type": "string" + "type": ["string", "null"] }, "client_certificate": { - "type": "string" + "type": ["string", "null"] }, "headers": { "$ref": "#/$defs/Headers" }, "compression": { - "type": "string" + "type": ["string", "null"] }, "timeout": { - "type": "integer", + "type": ["integer", "null"], "minimum": 0 }, "insecure": { - "type": "boolean" + "type": ["boolean", "null"] } }, "required": [ @@ -72,7 +72,7 @@ "title": "Otlp" }, "Console": { - "type": "object", + "type": ["object", "null"], "additionalProperties": false } } diff --git a/schema/logger_provider.json b/schema/logger_provider.json index 4bad0ca..f05e248 100644 --- a/schema/logger_provider.json +++ b/schema/logger_provider.json @@ -2,7 +2,7 @@ "$id": "https://opentelemetry.io/otelconfig/logger_provider.json", "$schema": "https://json-schema.org/draft/2020-12/schema", "title": "LoggerProvider", - "type": "object", + "type": ["object", "null"], "additionalProperties": false, "properties": { "processors": { @@ -17,7 +17,7 @@ }, "$defs": { "SimpleLogRecordProcessor": { - "type": "object", + "type": ["object", "null"], "additionalProperties": false, "properties": { "exporter": { @@ -29,23 +29,23 @@ ] }, "BatchLogRecordProcessor": { - "type": "object", + "type": ["object", "null"], "additionalProperties": false, "properties": { "schedule_delay": { - "type": "integer", + "type": ["integer", "null"], "minimum": 0 }, "export_timeout": { - "type": "integer", + "type": ["integer", "null"], "minimum": 0 }, "max_queue_size": { - "type": "integer", + "type": ["integer", "null"], "minimum": 0 }, "max_export_batch_size": { - "type": "integer", + "type": ["integer", "null"], "minimum": 0 }, "exporter": { @@ -57,7 +57,7 @@ ] }, "LogRecordExporter": { - "type": "object", + "type": ["object", "null"], "additionalProperties": true, "minProperties": 1, "maxProperties": 1, @@ -71,26 +71,26 @@ }, "patternProperties": { ".*": { - "type": "object" + "type": ["object", "null"] } } }, "LogRecordLimits": { - "type": "object", + "type": ["object", "null"], "additionalProperties": false, "properties": { "attribute_value_length_limit": { - "type": "integer", + "type": ["integer", "null"], "minimum": 0 }, "attribute_count_limit": { - "type": "integer", + "type": ["integer", "null"], "minimum": 0 } } }, "LogRecordProcessor": { - "type": "object", + "type": ["object", "null"], "additionalProperties": true, "minProperties": 1, "maxProperties": 1, @@ -104,7 +104,7 @@ }, "patternProperties": { ".*": { - "type": "object" + "type": ["object", "null"] } } } diff --git a/schema/meter_provider.json b/schema/meter_provider.json index 9639a40..511920b 100644 --- a/schema/meter_provider.json +++ b/schema/meter_provider.json @@ -2,7 +2,7 @@ "$id": "https://opentelemetry.io/otelconfig/meter_provider.json", "$schema": "https://json-schema.org/draft/2020-12/schema", "title": "MeterProvider", - "type": "object", + "type": ["object", "null"], "additionalProperties": false, "properties": { "readers": { @@ -20,15 +20,15 @@ }, "$defs": { "PeriodicMetricReader": { - "type": "object", + "type": ["object", "null"], "additionalProperties": false, "properties": { "interval": { - "type": "integer", + "type": ["integer", "null"], "minimum": 0 }, "timeout": { - "type": "integer", + "type": ["integer", "null"], "minimum": 0 }, "exporter": { @@ -41,7 +41,7 @@ "title": "PeriodicMetricReader" }, "PullMetricReader": { - "type": "object", + "type": ["object", "null"], "additionalProperties": false, "properties": { "exporter": { @@ -54,7 +54,7 @@ "title": "PullMetricReader" }, "MetricExporter": { - "type": "object", + "type": ["object", "null"], "additionalProperties": true, "minProperties": 1, "maxProperties": 1, @@ -71,7 +71,7 @@ }, "patternProperties": { ".*": { - "type": "object" + "type": ["object", "null"] } } }, @@ -93,23 +93,23 @@ } }, "Prometheus": { - "type": "object", + "type": ["object", "null"], "additionalProperties": false, "properties": { "host": { - "type": "string" + "type": ["string", "null"] }, "port": { - "type": "integer" + "type": ["integer", "null"] }, "without_units": { - "type": "boolean" + "type": ["boolean", "null"] }, "without_type_suffix": { - "type": "boolean" + "type": ["boolean", "null"] }, "without_scope_info": { - "type": "boolean" + "type": ["boolean", "null"] }, "with_resource_constant_labels": { "$ref": "common.json#/$defs/IncludeExclude" @@ -117,7 +117,7 @@ } }, "MetricReader": { - "type": "object", + "type": ["object", "null"], "additionalProperties": false, "minProperties": 1, "maxProperties": 2, @@ -137,47 +137,47 @@ } }, "OtlpMetric": { - "type": "object", + "type": ["object", "null"], "additionalProperties": false, "properties": { "protocol": { - "type": "string", + "type": ["string", "null"], "pattern": "^(http|grpc)\\/(protobuf|json)" }, "endpoint": { - "type": "string" + "type": ["string", "null"] }, "certificate": { - "type": "string" + "type": ["string", "null"] }, "client_key": { - "type": "string" + "type": ["string", "null"] }, "client_certificate": { - "type": "string" + "type": ["string", "null"] }, "headers": { "$ref": "common.json#/$defs/Headers" }, "compression": { - "type": "string" + "type": ["string", "null"] }, "timeout": { - "type": "integer", + "type": ["integer", "null"], "minimum": 0 }, "temporality_preference": { - "type": "string" + "type": ["string", "null"] }, "default_histogram_aggregation": { - "type": "string", + "type": ["string", "null"], "enum": [ "explicit_bucket_histogram", "base2_exponential_bucket_histogram" ] }, "insecure": { - "type": "boolean" + "type": ["boolean", "null"] } }, "required": [ @@ -187,19 +187,19 @@ "title": "OtlpMetric" }, "View": { - "type": "object", + "type": ["object", "null"], "additionalProperties": false, "properties": { "selector": { "title": "Selector", - "type": "object", + "type": ["object", "null"], "additionalProperties": false, "properties": { "instrument_name": { - "type": "string" + "type": ["string", "null"] }, "instrument_type": { - "type": "string", + "type": ["string", "null"], "enum": [ "counter", "histogram", @@ -210,46 +210,46 @@ ] }, "unit": { - "type": "string" + "type": ["string", "null"] }, "meter_name": { - "type": "string" + "type": ["string", "null"] }, "meter_version": { - "type": "string" + "type": ["string", "null"] }, "meter_schema_url": { - "type": "string" + "type": ["string", "null"] } } }, "stream": { "title": "Stream", - "type": "object", + "type": ["object", "null"], "additionalProperties": false, "properties": { "name": { - "type": "string" + "type": ["string", "null"] }, "description": { - "type": "string" + "type": ["string", "null"] }, "aggregation": { - "type": "object", + "type": ["object", "null"], "additionalProperties": false, "minProperties": 1, "maxProperties": 1, "properties": { "default": { - "type": "object", + "type": ["object", "null"], "additionalProperties": false }, "drop": { - "type": "object", + "type": ["object", "null"], "additionalProperties": false }, "explicit_bucket_histogram": { - "type": "object", + "type": ["object", "null"], "additionalProperties": false, "properties": { "boundaries": { @@ -259,31 +259,31 @@ } }, "record_min_max": { - "type": "boolean" + "type": ["boolean", "null"] } } }, "base2_exponential_bucket_histogram": { - "type": "object", + "type": ["object", "null"], "additionalProperties": false, "properties": { "max_scale": { - "type": "integer" + "type": ["integer", "null"] }, "max_size": { - "type": "integer" + "type": ["integer", "null"] }, "record_min_max": { - "type": "boolean" + "type": ["boolean", "null"] } } }, "last_value": { - "type": "object", + "type": ["object", "null"], "additionalProperties": false }, "sum": { - "type": "object", + "type": ["object", "null"], "additionalProperties": false } } @@ -291,7 +291,7 @@ "attribute_keys": { "type": "array", "items": { - "type": "string" + "type": ["string", "null"] } } } diff --git a/schema/opentelemetry_configuration.json b/schema/opentelemetry_configuration.json index 5062ae0..2f955cb 100644 --- a/schema/opentelemetry_configuration.json +++ b/schema/opentelemetry_configuration.json @@ -2,14 +2,14 @@ "$id": "https://opentelemetry.io/otelconfig/opentelemetry_configuration.json", "$schema": "https://json-schema.org/draft/2020-12/schema", "title": "OpenTelemetryConfiguration", - "type": "object", + "type": ["object", "null"], "additionalProperties": true, "properties": { "file_format": { - "type": "string" + "type": ["string", "null"] }, "disabled": { - "type": "boolean" + "type": ["boolean", "null"] }, "attribute_limits": { "$ref": "#/$defs/AttributeLimits" @@ -38,14 +38,14 @@ ], "$defs": { "AttributeLimits": { - "type": "object", + "type": ["object", "null"], "additionalProperties": true, "properties": { "attribute_value_length_limit": { - "type": "integer" + "type": ["integer", "null"] }, "attribute_count_limit": { - "type": "integer" + "type": ["integer", "null"] } } } diff --git a/schema/propagator.json b/schema/propagator.json index 1b29ec2..64e2d51 100644 --- a/schema/propagator.json +++ b/schema/propagator.json @@ -2,7 +2,7 @@ "$id": "https://opentelemetry.io/otelconfig/propagator.json", "$schema": "https://json-schema.org/draft/2020-12/schema", "title": "Propagator", - "type": "object", + "type": ["object", "null"], "minProperties": 1, "maxProperties": 1, "additionalProperties": true, @@ -10,7 +10,7 @@ "composite": { "type": "array", "items": { - "type": "string" + "type": ["string", "null"] } } } diff --git a/schema/resource.json b/schema/resource.json index 80f77fd..c6f9a5d 100644 --- a/schema/resource.json +++ b/schema/resource.json @@ -2,7 +2,7 @@ "$id": "https://opentelemetry.io/otelconfig/resource.json", "$schema": "https://json-schema.org/draft/2020-12/schema", "title": "Resource", - "type": "object", + "type": ["object", "null"], "additionalProperties": false, "properties": { "attributes": { @@ -12,13 +12,13 @@ "$ref": "#/$defs/Detectors" }, "schema_url": { - "type": "string" + "type": ["string", "null"] } }, "$defs": { "Attributes": { "title": "Attributes", - "type": "object", + "type": ["object", "null"], "additionalProperties": true }, "Detectors": { diff --git a/schema/tracer_provider.json b/schema/tracer_provider.json index 96dfa5c..67c2c56 100644 --- a/schema/tracer_provider.json +++ b/schema/tracer_provider.json @@ -2,7 +2,7 @@ "$id": "https://opentelemetry.io/otelconfig/tracer_provider.json", "$schema": "https://json-schema.org/draft/2020-12/schema", "title": "TracerProvider", - "type": "object", + "type": ["object", "null"], "additionalProperties": false, "properties": { "processors": { @@ -20,24 +20,24 @@ }, "$defs": { "BatchSpanProcessor": { - "type": "object", + "type": ["object", "null"], "additionalProperties": false, "title": "BatchSpanProcessor", "properties": { "schedule_delay": { - "type": "integer", + "type": ["integer", "null"], "minimum": 0 }, "export_timeout": { - "type": "integer", + "type": ["integer", "null"], "minimum": 0 }, "max_queue_size": { - "type": "integer", + "type": ["integer", "null"], "minimum": 0 }, "max_export_batch_size": { - "type": "integer", + "type": ["integer", "null"], "minimum": 0 }, "exporter": { @@ -49,28 +49,28 @@ ] }, "Sampler": { - "type": "object", + "type": ["object", "null"], "additionalProperties": true, "minProperties": 1, "maxProperties": 1, "properties": { "always_off": { - "type": "object", + "type": ["object", "null"], "additionalProperties": false }, "always_on": { - "type": "object", + "type": ["object", "null"], "additionalProperties": false }, "jaeger_remote": { - "type": "object", + "type": ["object", "null"], "additionalProperties": false, "properties": { "endpoint": { - "type": "string" + "type": ["string", "null"] }, "interval": { - "type": "integer", + "type": ["integer", "null"], "minimum": 0 }, "initial_sampler": { @@ -79,7 +79,7 @@ } }, "parent_based": { - "type": "object", + "type": ["object", "null"], "additionalProperties": false, "properties": { "root": { @@ -100,7 +100,7 @@ } }, "trace_id_ratio_based": { - "type": "object", + "type": ["object", "null"], "additionalProperties": false, "properties": { "ratio": { @@ -111,12 +111,12 @@ }, "patternProperties": { ".*": { - "type": "object" + "type": ["object", "null"] } } }, "SimpleSpanProcessor": { - "type": "object", + "type": ["object", "null"], "additionalProperties": false, "title": "SimpleSpanProcessor", "properties": { @@ -129,7 +129,7 @@ ] }, "SpanExporter": { - "type": "object", + "type": ["object", "null"], "additionalProperties": true, "minProperties": 1, "maxProperties": 1, @@ -146,42 +146,42 @@ }, "patternProperties": { ".*": { - "type": "object" + "type": ["object", "null"] } } }, "SpanLimits": { - "type": "object", + "type": ["object", "null"], "additionalProperties": false, "properties": { "attribute_value_length_limit": { - "type": "integer", + "type": ["integer", "null"], "minimum": 0 }, "attribute_count_limit": { - "type": "integer", + "type": ["integer", "null"], "minimum": 0 }, "event_count_limit": { - "type": "integer", + "type": ["integer", "null"], "minimum": 0 }, "link_count_limit": { - "type": "integer", + "type": ["integer", "null"], "minimum": 0 }, "event_attribute_count_limit": { - "type": "integer", + "type": ["integer", "null"], "minimum": 0 }, "link_attribute_count_limit": { - "type": "integer", + "type": ["integer", "null"], "minimum": 0 } } }, "SpanProcessor": { - "type": "object", + "type": ["object", "null"], "additionalProperties": true, "minProperties": 1, "maxProperties": 1, @@ -195,19 +195,19 @@ }, "patternProperties": { ".*": { - "type": "object" + "type": ["object", "null"] } } }, "Zipkin": { - "type": "object", + "type": ["object", "null"], "additionalProperties": false, "properties": { "endpoint": { - "type": "string" + "type": ["string", "null"] }, "timeout": { - "type": "integer", + "type": ["integer", "null"], "minimum": 0 } },