Exemplar: {
    filteredAttributes: KeyValue[];
    spanId?: Uint8Array;
    timeUnixNano: Nanos;
    traceId?: Uint8Array;
} & ({ asInt: number } | { asDouble: number })

🎯 Exemplar is a sample input measurement with environment information.

Exemplars provide specific examples of measurements that contributed to aggregated metrics. They help with debugging and understanding metric values.

Type declaration

  • filteredAttributes: KeyValue[]

    Additional attributes for this exemplar

  • OptionalspanId?: Uint8Array

    Optional span ID for trace correlation

  • timeUnixNano: Nanos

    Timestamp of this exemplar (nanoseconds since Unix epoch)

  • OptionaltraceId?: Uint8Array

    Optional trace ID for trace correlation

  • { asInt: number }
    • asInt: number

      Integer exemplar value

  • { asDouble: number }
    • asDouble: number

      Floating-point exemplar value

const slowRequestExemplar: Exemplar = {
filteredAttributes: [
{ key: "trace.id", value: { stringValue: "abc123def456" } },
{ key: "user.id", value: { stringValue: "user_789" } }
],
timeUnixNano: "1640995230000000000",
asDouble: 5.2, // This specific request took 5.2 seconds
spanId: new Uint8Array([1, 2, 3, 4, 5, 6, 7, 8]),
traceId: new Uint8Array([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16])
};