Skip to content

Commit

Permalink
.resource.attributes are name, value, type
Browse files Browse the repository at this point in the history
  • Loading branch information
jack-berg committed Sep 3, 2024
1 parent a42f9ed commit a4248d9
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 45 deletions.
28 changes: 20 additions & 8 deletions examples/kitchen-sink.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion examples/sdk-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion examples/sdk-migration-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
58 changes: 23 additions & 35 deletions schema/resource.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": [
Expand Down

0 comments on commit a4248d9

Please sign in to comment.