-
Notifications
You must be signed in to change notification settings - Fork 122
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add metrics * fix build * merge conflicts * Improve metric names to match Prometheus conventions * Use one histogram with labels for controller operation histogram * fix histogram labels * combine health and prom http server * fix metrics help text * remove dead flag * set prom annotations and listen address flag * rename listen address flag * fix port
- Loading branch information
1 parent
bb708b9
commit 10407b0
Showing
8 changed files
with
245 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
package main | ||
|
||
import ( | ||
"github.com/go-kit/kit/metrics" | ||
"github.com/go-kit/kit/metrics/prometheus" | ||
prom "github.com/prometheus/client_golang/prometheus" | ||
) | ||
|
||
// MachineControllerMetrics is a struct of all metrics used in | ||
// the machine controller. | ||
type MachineControllerMetrics struct { | ||
Machines metrics.Gauge | ||
Nodes metrics.Gauge | ||
Workers metrics.Gauge | ||
Errors metrics.Counter | ||
ControllerOperation metrics.Histogram | ||
NodeJoinDuration metrics.Histogram | ||
} | ||
|
||
// NewMachineControllerMetrics creates new MachineControllerMetrics | ||
// with default values initialized, so metrics always show up. | ||
func NewMachineControllerMetrics() *MachineControllerMetrics { | ||
namespace := "machine" | ||
subsystem := "controller" | ||
|
||
cm := &MachineControllerMetrics{ | ||
Machines: prometheus.NewGaugeFrom(prom.GaugeOpts{ | ||
Namespace: namespace, | ||
Subsystem: subsystem, | ||
Name: "machines", | ||
Help: "The number of machines", | ||
}, []string{}), | ||
Workers: prometheus.NewGaugeFrom(prom.GaugeOpts{ | ||
Namespace: namespace, | ||
Subsystem: subsystem, | ||
Name: "workers", | ||
Help: "The number of running machine controller workers", | ||
}, []string{}), | ||
Nodes: prometheus.NewGaugeFrom(prom.GaugeOpts{ | ||
Namespace: namespace, | ||
Subsystem: subsystem, | ||
Name: "nodes", | ||
Help: "The number of nodes created by a machine", | ||
}, []string{}), | ||
Errors: prometheus.NewCounterFrom(prom.CounterOpts{ | ||
Namespace: namespace, | ||
Subsystem: subsystem, | ||
Name: "errors_total", | ||
Help: "The total number or unexpected errors the controller encountered", | ||
}, []string{}), | ||
ControllerOperation: prometheus.NewHistogramFrom(prom.HistogramOpts{ | ||
Namespace: namespace, | ||
Subsystem: subsystem, | ||
Name: "controller_operation_duration_seconds", | ||
Help: "The duration it takes to execute an operation", | ||
}, []string{"operation"}), | ||
NodeJoinDuration: prometheus.NewHistogramFrom(prom.HistogramOpts{ | ||
Namespace: namespace, | ||
Subsystem: subsystem, | ||
Name: "node_join_duration_seconds", | ||
Help: "The time it takes from creation of the machine resource and the final creation of the node resource", | ||
}, []string{}), | ||
} | ||
|
||
// Set default values, so that these metrics always show up | ||
cm.Machines.Set(0) | ||
cm.Workers.Set(0) | ||
cm.Nodes.Set(0) | ||
|
||
return cm | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.