🔑 KeyValue is a key-value pair used for attributes.
The fundamental building block for all attribute data in OpenTelemetry. Each key is a string, and the value can be any supported type via AnyValue.
// Simple string attributeconst serviceAttr: KeyValue = { key: "service.name", value: { stringValue: "turtle-miner" }};// Numeric attributeconst levelAttr: KeyValue = { key: "mining.level", value: { intValue: 12 }};// Boolean attributeconst activeAttr: KeyValue = { key: "turtle.active", value: { boolValue: true }}; Copy
// Simple string attributeconst serviceAttr: KeyValue = { key: "service.name", value: { stringValue: "turtle-miner" }};// Numeric attributeconst levelAttr: KeyValue = { key: "mining.level", value: { intValue: 12 }};// Boolean attributeconst activeAttr: KeyValue = { key: "turtle.active", value: { boolValue: true }};
The attribute key (must be a string)
The attribute value (can be any supported type)
🔑 KeyValue is a key-value pair used for attributes.
The fundamental building block for all attribute data in OpenTelemetry. Each key is a string, and the value can be any supported type via AnyValue.
Example