fix
This commit is contained in:
parent
0c0a501aad
commit
9d4945c733
@ -6,6 +6,9 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func WithPrometheus(reg *prometheus.Registry, namespace, subsystem string) Option {
|
func WithPrometheus(reg *prometheus.Registry, namespace, subsystem string) Option {
|
||||||
|
if reg == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
if subsystem == "" {
|
if subsystem == "" {
|
||||||
subsystem = "cache"
|
subsystem = "cache"
|
||||||
}
|
}
|
||||||
@ -13,9 +16,7 @@ func WithPrometheus(reg *prometheus.Registry, namespace, subsystem string) Optio
|
|||||||
subSplit := strings.Split(subsystem, ".")
|
subSplit := strings.Split(subsystem, ".")
|
||||||
namespace = strings.Join(nameSplit, "_")
|
namespace = strings.Join(nameSplit, "_")
|
||||||
subsystem = strings.Join(subSplit, "_")
|
subsystem = strings.Join(subSplit, "_")
|
||||||
if reg == nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
return func(cache *oCache) {
|
return func(cache *oCache) {
|
||||||
cache.metrics = &metrics{
|
cache.metrics = &metrics{
|
||||||
hit: prometheus.NewCounter(prometheus.CounterOpts{
|
hit: prometheus.NewCounter(prometheus.CounterOpts{
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user