mirror of
https://github.com/containrrr/watchtower.git
synced 2025-12-16 23:20:12 +01:00
feat(api): implement new api handler
This commit is contained in:
parent
72e437f173
commit
47091761a5
17 changed files with 571 additions and 294 deletions
|
|
@ -45,12 +45,11 @@ func (metrics *Metrics) Register(metric *Metric) {
|
|||
metrics.channel <- metric
|
||||
}
|
||||
|
||||
// Default creates a new metrics handler if none exists, otherwise returns the existing one
|
||||
func Default() *Metrics {
|
||||
// Init creates a new metrics handler if none exists
|
||||
func Init() {
|
||||
if metrics != nil {
|
||||
return metrics
|
||||
return
|
||||
}
|
||||
|
||||
metrics = &Metrics{
|
||||
scanned: promauto.NewGauge(prometheus.GaugeOpts{
|
||||
Name: "watchtower_containers_scanned",
|
||||
|
|
@ -76,6 +75,11 @@ func Default() *Metrics {
|
|||
}
|
||||
|
||||
go metrics.HandleUpdate(metrics.channel)
|
||||
}
|
||||
|
||||
// Default creates a new metrics handler if none exists, otherwise returns the existing one
|
||||
func Default() *Metrics {
|
||||
Init()
|
||||
|
||||
return metrics
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue