mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Update go-metrics to match swarmkit's dependency
Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
This commit is contained in:
parent
721b7a7fad
commit
0a377b5f56
2 changed files with 13 additions and 7 deletions
|
@ -132,6 +132,6 @@ github.com/inconshreveable/mousetrap 76626ae9c91c4f2a10f34cad8ce83ea42c93bb75
|
|||
github.com/Nvveen/Gotty a8b993ba6abdb0e0c12b0125c603323a71c7790c https://github.com/ijc25/Gotty
|
||||
|
||||
# metrics
|
||||
github.com/docker/go-metrics 8fd5772bf1584597834c6f7961a530f06cbfbb87
|
||||
github.com/docker/go-metrics d466d4f6fd960e01820085bd7e1a24426ee7ef18
|
||||
|
||||
github.com/opencontainers/selinux v1.0.0-rc1
|
||||
|
|
18
vendor/github.com/docker/go-metrics/namespace.go
generated
vendored
18
vendor/github.com/docker/go-metrics/namespace.go
generated
vendored
|
@ -66,7 +66,7 @@ func (n *Namespace) newCounterOpts(name, help string) prometheus.CounterOpts {
|
|||
return prometheus.CounterOpts{
|
||||
Namespace: n.name,
|
||||
Subsystem: n.subsystem,
|
||||
Name: fmt.Sprintf("%s_%s", name, Total),
|
||||
Name: makeName(name, Total),
|
||||
Help: help,
|
||||
ConstLabels: prometheus.Labels(n.labels),
|
||||
}
|
||||
|
@ -92,7 +92,7 @@ func (n *Namespace) newTimerOpts(name, help string) prometheus.HistogramOpts {
|
|||
return prometheus.HistogramOpts{
|
||||
Namespace: n.name,
|
||||
Subsystem: n.subsystem,
|
||||
Name: fmt.Sprintf("%s_%s", name, Seconds),
|
||||
Name: makeName(name, Seconds),
|
||||
Help: help,
|
||||
ConstLabels: prometheus.Labels(n.labels),
|
||||
}
|
||||
|
@ -118,7 +118,7 @@ func (n *Namespace) newGaugeOpts(name, help string, unit Unit) prometheus.GaugeO
|
|||
return prometheus.GaugeOpts{
|
||||
Namespace: n.name,
|
||||
Subsystem: n.subsystem,
|
||||
Name: fmt.Sprintf("%s_%s", name, unit),
|
||||
Name: makeName(name, unit),
|
||||
Help: help,
|
||||
ConstLabels: prometheus.Labels(n.labels),
|
||||
}
|
||||
|
@ -149,9 +149,7 @@ func (n *Namespace) Add(collector prometheus.Collector) {
|
|||
}
|
||||
|
||||
func (n *Namespace) NewDesc(name, help string, unit Unit, labels ...string) *prometheus.Desc {
|
||||
if string(unit) != "" {
|
||||
name = fmt.Sprintf("%s_%s", name, unit)
|
||||
}
|
||||
name = makeName(name, unit)
|
||||
namespace := n.name
|
||||
if n.subsystem != "" {
|
||||
namespace = fmt.Sprintf("%s_%s", namespace, n.subsystem)
|
||||
|
@ -173,3 +171,11 @@ func mergeLabels(lbs ...Labels) Labels {
|
|||
|
||||
return merged
|
||||
}
|
||||
|
||||
func makeName(name string, unit Unit) string {
|
||||
if unit == "" {
|
||||
return name
|
||||
}
|
||||
|
||||
return fmt.Sprintf("%s_%s", name, unit)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue