@grow-codes/grafana-tempo - v0.1.1
    Preparing search index...

    Class TraceQL

    Immutable TraceQL builder with escaping: span-set filters, structural operators and select().

    TraceQL.span({ "resource.service.name": "api" })
    .and("duration", ">", "200ms")
    .select("span.http.status_code")
    .toString();
    // { resource.service.name = "api" && span:duration > 200ms } | select(span.http.status_code)

    TraceQL.span({ "resource.service.name": "api" }).child(TraceQL.span({ name: "db" })).toString();
    // { resource.service.name = "api" } > { name = "db" }

    Field names are validated (unknown scopes or intrinsics throw ValidationError, because some Tempo endpoints silently ignore an invalid query); attribute names with anything outside [A-Za-z0-9_.] are quoted after the scope (span."grow weird-key"). String values are quoted and escaped (\, ", newline, tab, CR), except duration literals on duration fields (200ms), ok|error|unset on status and span kinds on kind. Numbers and booleans are written as literals; =~ / !~ need a string.

    Index
    • Adds fields to | select(…) so search returns them on each matched span.

      Parameters

      • ...fields: string[]

      Returns TraceQL

    • Renders a field name: validates the scope or intrinsic and quotes odd attribute names.

      Parameters

      • name: string

      Returns string

    • Quotes and escapes a string as a TraceQL string literal.

      Parameters

      • text: string

      Returns string

    • Starts a spanset filter. Each filters entry becomes <field> = <value>, joined with && in insertion order. TraceQL.span() alone matches every span ({}).

      Parameters

      Returns TraceQL