traceqlsyntax

package module
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 20, 2026 License: Apache-2.0 Imports: 0 Imported by: 0

README

TraceQL Syntax

Standalone Go parser and AST for Grafana Tempo's TraceQL. Lifts the upstream traceql package (and the tempopb message types it needs) out of grafana/tempo with the server-side runtime dependencies (the gRPC service stubs, dskit, jaeger, prometheus metrics) stripped away.

Installation

go get github.com/qualithm/traceql-syntax

Usage

import "github.com/qualithm/traceql-syntax/traceql"

root, err := traceql.Parse(`{ span.http.status_code >= 500 } | count() > 1`)
if err != nil {
    return err
}
// inspect the parsed AST

Relationship to upstream Tempo

The traceql/, tempopb/, and internal/ directories are copied near-verbatim from grafana/tempo, with import paths rewritten to this module. See NOTICE for the exact packages vendored and the modifications applied (gRPC stubs removed, dskit and prometheus dependencies trimmed).

Only first-party code (the trimmed shims and this module's own files) is edited directly; the vendored directories are refreshed via the sync workflow.

Syncing from upstream

./scripts/sync-upstream.sh [TEMPO_VERSION]

This re-copies the vendored packages from the module cache and rewrites imports. The gRPC-stub excision in tempopb/tempo.pb.go, the tempopb/pool.go metric trim, and the internal/util/log/log.go shim are manual reconciliations documented in the script — review the diff and re-apply them after a sync.

Documentation

Overview

Package traceqlsyntax is the root of a partial fork of Grafana Tempo's TraceQL parser packages, stripped of Tempo's runtime dependencies (the gRPC service stubs in tempopb, dskit, jaeger, and the query/storage machinery).

Use the traceql sub-package to parse and inspect TraceQL expressions:

import "github.com/qualithm/traceql-syntax/traceql"

root, err := traceql.Parse(`{ span.http.status_code >= 500 } | count() > 1`)
if err != nil {
    return err
}

See the README for the relationship to upstream Tempo and the sync workflow.

Directories

Path Synopsis
internal
Code generated by goyacc -l -o pkg/traceql/expr.y.go pkg/traceql/expr.y.
Code generated by goyacc -l -o pkg/traceql/expr.y.go pkg/traceql/expr.y.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL