mirror of
https://github.com/kubernetes/client-go.git
synced 2025-08-07 02:13:45 +00:00
rename metric reflector_xx_last_resource_version to reflector_last_resource_version{name="xx"}
Kubernetes-commit: bca495e2291b0a888d5aaee10e901ddb28e937b2
This commit is contained in:
parent
928a525530
commit
73c17354d4
6
tools/cache/reflector.go
vendored
6
tools/cache/reflector.go
vendored
@ -109,7 +109,7 @@ func NewNamedReflector(name string, lw ListerWatcher, expectedType interface{},
|
|||||||
r := &Reflector{
|
r := &Reflector{
|
||||||
name: name,
|
name: name,
|
||||||
// we need this to be unique per process (some names are still the same)but obvious who it belongs to
|
// we need this to be unique per process (some names are still the same)but obvious who it belongs to
|
||||||
metrics: newReflectorMetrics(makeValidPromethusMetricName(fmt.Sprintf("reflector_"+name+"_%d", reflectorSuffix))),
|
metrics: newReflectorMetrics(makeValidPromethusMetricLabel(fmt.Sprintf("reflector_"+name+"_%d", reflectorSuffix))),
|
||||||
listerWatcher: lw,
|
listerWatcher: lw,
|
||||||
store: store,
|
store: store,
|
||||||
expectedType: reflect.TypeOf(expectedType),
|
expectedType: reflect.TypeOf(expectedType),
|
||||||
@ -120,9 +120,9 @@ func NewNamedReflector(name string, lw ListerWatcher, expectedType interface{},
|
|||||||
return r
|
return r
|
||||||
}
|
}
|
||||||
|
|
||||||
func makeValidPromethusMetricName(in string) string {
|
func makeValidPromethusMetricLabel(in string) string {
|
||||||
// this isn't perfect, but it removes our common characters
|
// this isn't perfect, but it removes our common characters
|
||||||
return strings.NewReplacer("/", "_", ".", "_", "-", "_").Replace(in)
|
return strings.NewReplacer("/", "_", ".", "_", "-", "_", ":", "_").Replace(in)
|
||||||
}
|
}
|
||||||
|
|
||||||
// internalPackages are packages that ignored when creating a default reflector name. These packages are in the common
|
// internalPackages are packages that ignored when creating a default reflector name. These packages are in the common
|
||||||
|
Loading…
Reference in New Issue
Block a user