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

Method validate

pkg/traceql/ast_metrics.go:312–343  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

310}
311
312func (a *MetricsAggregate) validate() error {
313 switch a.op {
314 case metricsAggregateCountOverTime:
315 case metricsAggregateMinOverTime:
316 case metricsAggregateMaxOverTime:
317 case metricsAggregateSumOverTime:
318 case metricsAggregateRate:
319 case metricsAggregateHistogramOverTime:
320 if len(a.by) >= maxGroupBys {
321 // We reserve a spot for the bucket so quantile has 1 less group by
322 return newUnsupportedError(fmt.Sprintf("metrics group by %v values", len(a.by)))
323 }
324 case metricsAggregateQuantileOverTime:
325 if len(a.by) >= maxGroupBys {
326 // We reserve a spot for the bucket so quantile has 1 less group by
327 return newUnsupportedError(fmt.Sprintf("metrics group by %v values", len(a.by)))
328 }
329 for _, q := range a.floats {
330 if q < 0 || q > 1 {
331 return fmt.Errorf("quantile must be between 0 and 1: %v", q)
332 }
333 }
334 default:
335 return newUnsupportedError(fmt.Sprintf("metrics aggregate operation (%v)", a.op))
336 }
337
338 if len(a.by) > maxGroupBys {
339 return newUnsupportedError(fmt.Sprintf("metrics group by %v values", len(a.by)))
340 }
341
342 return nil
343}
344
345var _ firstStageElement = (*MetricsAggregate)(nil)
346

Callers

nothing calls this directly

Calls 1

newUnsupportedErrorFunction · 0.85

Tested by

no test coverage detected