mirror of
https://github.com/kubernetes-sigs/prometheus-adapter.git
synced 2026-04-06 01:38:10 +00:00
Moving metric naming to it's own package
This commit is contained in:
parent
c2e176bb23
commit
6030912cc0
12 changed files with 93 additions and 227 deletions
|
|
@ -18,8 +18,8 @@ import (
|
|||
)
|
||||
|
||||
var (
|
||||
groupNameSanitizer = strings.NewReplacer(".", "_", "-", "_")
|
||||
nsGroupResource = schema.GroupResource{Resource: "namespaces"}
|
||||
GroupNameSanitizer = strings.NewReplacer(".", "_", "-", "_")
|
||||
NsGroupResource = schema.GroupResource{Resource: "namespaces"}
|
||||
)
|
||||
|
||||
// ResourceConverter knows the relationship between Kubernetes group-resources and Prometheus labels,
|
||||
|
|
@ -118,7 +118,7 @@ func (r *resourceConverter) makeLabelForResource(resource schema.GroupResource)
|
|||
return "", fmt.Errorf("unable to singularize resource %s: %v", resource.String(), err)
|
||||
}
|
||||
convResource := schema.GroupResource{
|
||||
Group: groupNameSanitizer.Replace(resource.Group),
|
||||
Group: GroupNameSanitizer.Replace(resource.Group),
|
||||
Resource: singularRes,
|
||||
}
|
||||
|
||||
|
|
@ -177,7 +177,7 @@ func (r *resourceConverter) ResourcesForSeries(series prom.Series) ([]schema.Gro
|
|||
}
|
||||
}
|
||||
|
||||
if groupRes == nsGroupResource {
|
||||
if groupRes == NsGroupResource {
|
||||
namespaced = true
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue