diff --git a/examples/kitchen-sink.yaml b/examples/kitchen-sink.yaml index 29263a5..5611b94 100644 --- a/examples/kitchen-sink.yaml +++ b/examples/kitchen-sink.yaml @@ -414,28 +414,40 @@ tracer_provider: resource: # Configure resource attributes. Entries have higher priority than entries from .resource.attributes_list. # + # Each entry must contain .name and .value, and may optionally include .type, which defaults to "string" if not set. The value must match the type. Known types include: string, bool, int, double, string_array, bool_array, int_array, double_array. + # # Environment variable: OTEL_RESOURCE_ATTRIBUTES attributes: # Configure `service.name` resource attribute # # Environment variable: OTEL_SERVICE_NAME - name: service-name - string_value: "unknown_service" + value: unknown_service # Configure other resource attributes with explicit types. + - name: string_key + value: value + type: string - name: bool_key - bool_value: true + value: true + type: bool - name: int_key - int_value: 1 + value: 1 + type: int - name: double_key - double_value: 1.1 + value: 1.1 + type: double - name: string_array_key - string_array_value: ["value1", "value2"] + value: ["value1", "value2"] + type: string_array - name: bool_array_key - bool_array_value: [ true, false ] + value: [ true, false ] + type: bool_array - name: int_array_key - int_array_value: [ 1, 2 ] + value: [ 1, 2 ] + type: int_array - name: double_array_key - double_array_value: [ 1.1, 2.2 ] + value: [ 1.1, 2.2 ] + type: double_array # Configure resource attributes. Entries have lower priority than entries from .resource.attributes. # # The value is a list of comma separated key-value pairs, matching the format of OTEL_RESOURCE_ATTRIBUTES. See https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/configuration/sdk-environment-variables.md#general-sdk-configuration for details. diff --git a/examples/sdk-config.yaml b/examples/sdk-config.yaml index a699ad1..8a61ec9 100644 --- a/examples/sdk-config.yaml +++ b/examples/sdk-config.yaml @@ -17,7 +17,7 @@ resource: attributes: # Configure `service.name` resource attribute - name: service.name - string_value: unknown_service + value: unknown_service # Configure general attribute limits. See also tracer_provider.limits, logger_provider.limits. attribute_limits: diff --git a/examples/sdk-migration-config.yaml b/examples/sdk-migration-config.yaml index aa9b5f3..b735aa0 100644 --- a/examples/sdk-migration-config.yaml +++ b/examples/sdk-migration-config.yaml @@ -48,7 +48,7 @@ resource: attributes: # Configure `service.name` resource attribute - name: service.name - string_value: ${OTEL_SERVICE_NAME:-unknown_service} + value: ${OTEL_SERVICE_NAME:-unknown_service} # Configure resource attributes. Entries have lower priority than entries from .resource.attributes. # # The value is a list of comma separated key-value pairs, matching the format of OTEL_RESOURCE_ATTRIBUTES. See https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/configuration/sdk-environment-variables.md#general-sdk-configuration for details. diff --git a/schema/resource.json b/schema/resource.json index 304e155..5e03621 100644 --- a/schema/resource.json +++ b/schema/resource.json @@ -27,46 +27,34 @@ "type": "object", "additionalProperties": false, "minProperties": 2, - "maxProperties": 2, + "maxProperties": 3, "properties": { "name": { "type": "string" }, - "string_value": { - "type": "string" - }, - "bool_value": { - "type": "boolean" - }, - "int_value": { - "type": "integer" - }, - "double_value": { - "type": "number" - }, - "string_array_value": { - "type": "array", - "items": { - "type": "string" - } + "value": { + "oneOf": [ + {"type": "string"}, + {"type": "number"}, + {"type": "boolean"}, + {"type": "null"}, + {"type": "array", "items": {"type": "string"}}, + {"type": "array", "items": {"type": "boolean"}}, + {"type": "array", "items": {"type": "number"}} + ] }, - "bool_array_value": { - "type": "array", - "items": { - "type": "boolean" - } - }, - "int_array_value": { - "type": "array", - "items": { - "type": "integer" - } - }, - "double_array_value": { - "type": "array", - "items": { - "type": "number" - } + "type": { + "enum": [ + null, + "string", + "bool", + "int", + "double", + "string_array", + "bool_array", + "int_array", + "double_array" + ] } }, "required": [