MCPcopy
hub / github.com/grafana/tempo / ApplyASTRewrites

Function ApplyASTRewrites

pkg/traceql/ast_rewriter.go:46–62  ·  view source on GitHub ↗

ApplyASTRewrites applies all registered transformations except those whose names appear in skip. Passing [TransformationAll] in skip disables every transformation.

(r *RootExpr, skip []string)

Source from the content-addressed store, hash-verified

44// ApplyASTRewrites applies all registered transformations except those whose names appear in skip.
45// Passing [TransformationAll] in skip disables every transformation.
46func ApplyASTRewrites(r *RootExpr, skip []string) *RootExpr {
47 if slices.Contains(skip, TransformationAll) {
48 return r
49 }
50
51 var chain rewriteChain
52 for _, nr := range defaultTransformations {
53 if !slices.Contains(skip, nr.name) {
54 chain = append(chain, nr.rewrite)
55 }
56 }
57 if len(chain) == 0 {
58 return r
59 }
60
61 return chain.RewriteRoot(r)
62}
63
64// ASTRewriter modifies a TraceQL AST without changing its meaning.
65type ASTRewriter interface {

Callers 1

parseInternalFunction · 0.85

Calls 1

RewriteRootMethod · 0.95

Tested by

no test coverage detected