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

Method validate

pkg/traceql/ast_validate.go:111–137  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

109}
110
111func (a Aggregate) validate() error {
112 if a.e == nil {
113 return nil
114 }
115
116 if err := a.e.validate(); err != nil {
117 return err
118 }
119
120 // aggregate field expressions require a type of a number or attribute
121 t := a.e.impliedType()
122 if t != TypeAttribute && !t.isNumeric() {
123 return fmt.Errorf("aggregate field expressions must resolve to a number type: %s", a.String())
124 }
125
126 if !a.e.referencesSpan() {
127 return fmt.Errorf("aggregate field expressions must reference the span: %s", a.String())
128 }
129
130 switch a.op {
131 case aggregateCount, aggregateAvg, aggregateMin, aggregateMax, aggregateSum:
132 default:
133 return newUnsupportedError(fmt.Sprintf("aggregate operation (%v)", a.op))
134 }
135
136 return nil
137}
138
139func (o SpansetOperation) validate() error {
140 if err := o.LHS.validate(); err != nil {

Callers

nothing calls this directly

Calls 6

StringMethod · 0.95
newUnsupportedErrorFunction · 0.85
validateMethod · 0.65
impliedTypeMethod · 0.65
referencesSpanMethod · 0.65
isNumericMethod · 0.45

Tested by

no test coverage detected