mirror of
https://github.com/hanzoai/traces.git
synced 2026-10-30 18:20:41 +00:00
* generator: extract validation to reusable package We will also use these functions for the config Controller * wip * update deprecated label validation * fix intrinsic dimensions * add span metrics subprocessor comments
44 lines
664 B
Go
44 lines
664 B
Go
package spanmetrics
|
|
|
|
import (
|
|
"strings"
|
|
|
|
"github.com/grafana/tempo/modules/generator/processor"
|
|
)
|
|
|
|
type Subprocessor int
|
|
|
|
const (
|
|
Latency Subprocessor = iota
|
|
Count
|
|
Size
|
|
)
|
|
|
|
var SupportedSubprocessors = []Subprocessor{
|
|
Latency,
|
|
Count,
|
|
Size,
|
|
}
|
|
|
|
func (s Subprocessor) String() string {
|
|
switch s {
|
|
case Latency:
|
|
return processor.SpanMetricsLatencyName
|
|
case Count:
|
|
return processor.SpanMetricsCountName
|
|
case Size:
|
|
return processor.SpanMetricsSizeName
|
|
default:
|
|
return "unsupported"
|
|
}
|
|
}
|
|
|
|
func ParseSubprocessor(s string) bool {
|
|
for _, p := range SupportedSubprocessors {
|
|
if strings.EqualFold(p.String(), s) {
|
|
return true
|
|
}
|
|
}
|
|
return false
|
|
}
|