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

Function ParseDimensionKey

modules/distributor/usage/tracker.go:499–509  ·  view source on GitHub ↗

ParseDimensionKey take the dimensions key, and gives the scope and the attribute with scope trimmed we are not using traceql.ParseIdentifier because it needs `.` for unscoped attributes and errors out for string without `.` or the scope prefix, also it supports other scopes that we don't support in

(key string)

Source from the content-addressed store, hash-verified

497// and errors out for string without `.` or the scope prefix, also it supports other scopes that we don't support
498// in cost attribution config
499func ParseDimensionKey(key string) (attribute string, scope Scope) {
500 switch {
501 case strings.HasPrefix(key, "resource."):
502 return strings.TrimPrefix(key, "resource."), ScopeResource
503 case strings.HasPrefix(key, "span."):
504 return strings.TrimPrefix(key, "span."), ScopeSpan
505 default:
506 // it's not `resource.` or `span.` so it's ScopeAll, and the dimensions key is the attribute
507 return key, ScopeAll
508 }
509}

Callers 3

TestParseDimensionKeyFunction · 0.85

Calls

no outgoing calls

Tested by 1

TestParseDimensionKeyFunction · 0.68