🔑 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 attribute
const serviceAttr: KeyValue = {
key: "service.name",
value: { stringValue: "turtle-miner" }
};

// Numeric attribute
const levelAttr: KeyValue = {
key: "mining.level",
value: { intValue: 12 }
};

// Boolean attribute
const activeAttr: KeyValue = {
key: "turtle.active",
value: { boolValue: true }
};
interface KeyValue {
    key: string;
    value: AnyValue;
}

Properties

Properties

key: string

The attribute key (must be a string)

value: AnyValue

The attribute value (can be any supported type)