From 38ed570e55a9e6c679fdab73881abd0207ddc220 Mon Sep 17 00:00:00 2001 From: Jack Berg Date: Mon, 24 Apr 2023 21:36:44 -0500 Subject: [PATCH 1/3] Add attribute limits --- kitchen-sink-example.yaml | 51 ++++++++++++++++++++++++- schema/common.json | 17 +++++++++ schema/logger_provider.json | 5 +++ schema/opentelemetry_configuration.json | 3 ++ schema/tracer_provider.json | 19 +++++++++ 5 files changed, 93 insertions(+), 2 deletions(-) create mode 100644 schema/common.json diff --git a/kitchen-sink-example.yaml b/kitchen-sink-example.yaml index 3c323582..baeaad3f 100644 --- a/kitchen-sink-example.yaml +++ b/kitchen-sink-example.yaml @@ -1,11 +1,58 @@ # The file format version file_format: "0.1" +# Configure general attribute limits. See also tracer_provider.span_limits, logger_provider.log_record_limits. +attribute_limits: + # Set the max attribute value size. + # + # Environment variable: OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT + attribute_value_length_limit: 4096 + # Set the max attribute count. + # + # Environment variable: OTEL_ATTRIBUTE_COUNT_LIMIT + attribute_count_limit: 128 + # Configure logger provider. -logger_provider: {} +logger_provider: + # Configure the log record limits. See also attribute_limits. + log_record_limits: + # Set the max log record attribute value size. Overrides attribute_limits.attribute_value_length_limit. + # + # Environment variable: OTEL_LOGRECORD_ATTRIBUTE_VALUE_LENGTH_LIMIT + attribute_value_length_limit: 4096 + # Set the max log record attribute count. Overrides attribute_limits.attribute_count_limit. + # + # Environment variable: OTEL_LOGRECORD_ATTRIBUTE_COUNT_LIMIT + attribute_count_limit: 128 # Configure meter provider. meter_provider: {} # Configure tracer provider. -tracer_provider: {} +tracer_provider: + # Configure span limits. See also attribute_limits. + span_limits: + # Set the max span attribute value size. Overrides attribute_limits.attribute_value_length_limit. + # + # Environment variable: OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT + attribute_value_length_limit: 4096 + # Set the max span attribute count. Overrides attribute_limits.attribute_count_limit. + # + # Environment variable: OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT + attribute_count_limit: 128 + # Set the max span event count. + # + # Environment variable: OTEL_SPAN_EVENT_COUNT_LIMIT + event_count_limit: 128 + # Set the max span link count. + # + # Environment variable: OTEL_SPAN_LINK_COUNT_LIMIT + link_count_limit: 128 + # Set the max attributes per span event. + # + # Environment variable: OTEL_EVENT_ATTRIBUTE_COUNT_LIMIT + event_attribute_count_limit: 128 + # Set the max attributes per span link. + # + # Environment variable: OTEL_LINK_ATTRIBUTE_COUNT_LIMIT + link_attribute_count_limit: 128 diff --git a/schema/common.json b/schema/common.json new file mode 100644 index 00000000..26bb6727 --- /dev/null +++ b/schema/common.json @@ -0,0 +1,17 @@ +{ + "$id": "https://opentelemetry.io/otelconfig/common.json", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "definitions": { + "AttributeLimits": { + "type": "object", + "properties": { + "attribute_value_length_limit": { + "type": "integer" + }, + "attribute_count_limit": { + "type": "integer" + } + } + } + } +} diff --git a/schema/logger_provider.json b/schema/logger_provider.json index 3dffdb57..92f4c7c0 100644 --- a/schema/logger_provider.json +++ b/schema/logger_provider.json @@ -5,5 +5,10 @@ "type": "object", "additionalProperties": false, "properties": { + "log_record_limits": { + "title": "LogRecordLimits", + "type": "object", + "allOf": [{ "$ref": "common.json#/definitions/AttributeLimits" }] + } } } diff --git a/schema/opentelemetry_configuration.json b/schema/opentelemetry_configuration.json index 74fbc069..40b35774 100644 --- a/schema/opentelemetry_configuration.json +++ b/schema/opentelemetry_configuration.json @@ -8,6 +8,9 @@ "file_format": { "type": "string" }, + "attribute_limits": { + "$ref": "common.json#/definitions/AttributeLimits" + }, "logger_provider": { "$ref": "logger_provider.json" }, diff --git a/schema/tracer_provider.json b/schema/tracer_provider.json index 8d3efa62..7fff5840 100644 --- a/schema/tracer_provider.json +++ b/schema/tracer_provider.json @@ -5,5 +5,24 @@ "type": "object", "additionalProperties": false, "properties": { + "span_limits": { + "title": "SpanLimits", + "type": "object", + "allOf": [{ "$ref": "common.json#/definitions/AttributeLimits" }], + "properties": { + "event_count_limit": { + "type": "integer" + }, + "link_count_limit": { + "type": "integer" + }, + "event_attribute_count_limit": { + "type": "integer" + }, + "link_attribute_count_limit": { + "type": "integer" + } + } + } } } From 565af0d91f5fd3c1f01d9842d3ac6bc6068a7c00 Mon Sep 17 00:00:00 2001 From: Jack Berg Date: Mon, 24 Apr 2023 21:42:44 -0500 Subject: [PATCH 2/3] Avoid inheritence --- schema/common.json | 17 ----------------- schema/logger_provider.json | 10 +++++++++- schema/opentelemetry_configuration.json | 12 +++++++++++- schema/tracer_provider.json | 8 +++++++- 4 files changed, 27 insertions(+), 20 deletions(-) delete mode 100644 schema/common.json diff --git a/schema/common.json b/schema/common.json deleted file mode 100644 index 26bb6727..00000000 --- a/schema/common.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "$id": "https://opentelemetry.io/otelconfig/common.json", - "$schema": "https://json-schema.org/draft/2020-12/schema", - "definitions": { - "AttributeLimits": { - "type": "object", - "properties": { - "attribute_value_length_limit": { - "type": "integer" - }, - "attribute_count_limit": { - "type": "integer" - } - } - } - } -} diff --git a/schema/logger_provider.json b/schema/logger_provider.json index 92f4c7c0..618ef23e 100644 --- a/schema/logger_provider.json +++ b/schema/logger_provider.json @@ -8,7 +8,15 @@ "log_record_limits": { "title": "LogRecordLimits", "type": "object", - "allOf": [{ "$ref": "common.json#/definitions/AttributeLimits" }] + "additionalProperties": false, + "properties": { + "attribute_value_length_limit": { + "type": "integer" + }, + "attribute_count_limit": { + "type": "integer" + } + } } } } diff --git a/schema/opentelemetry_configuration.json b/schema/opentelemetry_configuration.json index 40b35774..311dedcd 100644 --- a/schema/opentelemetry_configuration.json +++ b/schema/opentelemetry_configuration.json @@ -9,7 +9,17 @@ "type": "string" }, "attribute_limits": { - "$ref": "common.json#/definitions/AttributeLimits" + "title": "AttributeLimits", + "type": "object", + "additionalProperties": true, + "properties": { + "attribute_value_length_limit": { + "type": "integer" + }, + "attribute_count_limit": { + "type": "integer" + } + } }, "logger_provider": { "$ref": "logger_provider.json" diff --git a/schema/tracer_provider.json b/schema/tracer_provider.json index 7fff5840..65a4bf3e 100644 --- a/schema/tracer_provider.json +++ b/schema/tracer_provider.json @@ -8,8 +8,14 @@ "span_limits": { "title": "SpanLimits", "type": "object", - "allOf": [{ "$ref": "common.json#/definitions/AttributeLimits" }], + "additionalProperties": false, "properties": { + "attribute_value_length_limit": { + "type": "integer" + }, + "attribute_count_limit": { + "type": "integer" + }, "event_count_limit": { "type": "integer" }, From 247b483b3bdf5783b7246544b20cae020d1753ad Mon Sep 17 00:00:00 2001 From: Jack Berg Date: Thu, 27 Apr 2023 07:37:50 -0500 Subject: [PATCH 3/3] log_record_* -> logrecord_* --- kitchen-sink-example.yaml | 4 ++-- schema/logger_provider.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/kitchen-sink-example.yaml b/kitchen-sink-example.yaml index baeaad3f..f95c304b 100644 --- a/kitchen-sink-example.yaml +++ b/kitchen-sink-example.yaml @@ -1,7 +1,7 @@ # The file format version file_format: "0.1" -# Configure general attribute limits. See also tracer_provider.span_limits, logger_provider.log_record_limits. +# Configure general attribute limits. See also tracer_provider.span_limits, logger_provider.logrecord_limits. attribute_limits: # Set the max attribute value size. # @@ -15,7 +15,7 @@ attribute_limits: # Configure logger provider. logger_provider: # Configure the log record limits. See also attribute_limits. - log_record_limits: + logrecord_limits: # Set the max log record attribute value size. Overrides attribute_limits.attribute_value_length_limit. # # Environment variable: OTEL_LOGRECORD_ATTRIBUTE_VALUE_LENGTH_LIMIT diff --git a/schema/logger_provider.json b/schema/logger_provider.json index 618ef23e..527f1fb8 100644 --- a/schema/logger_provider.json +++ b/schema/logger_provider.json @@ -5,7 +5,7 @@ "type": "object", "additionalProperties": false, "properties": { - "log_record_limits": { + "logrecord_limits": { "title": "LogRecordLimits", "type": "object", "additionalProperties": false,