Opts struct, no self-registration
This commit is contained in:
parent
0e7e16e4b6
commit
f75fba266e
1 changed files with 11 additions and 3 deletions
|
@ -17,13 +17,21 @@ type LiteGaugeSummary struct {
|
|||
desc *prometheus.Desc
|
||||
}
|
||||
|
||||
func NewLiteGaugeSummary(varName, help string) *LiteGaugeSummary {
|
||||
type LiteGaugeSummaryOpts struct {
|
||||
// As for usual Prometheus metrics
|
||||
Namespace, Subsystem, Name, Help string
|
||||
|
||||
// As for usual Prometheus metrics
|
||||
ConstLabels prometheus.Labels
|
||||
}
|
||||
|
||||
func NewLiteGaugeSummary(opts LiteGaugeSummaryOpts) *LiteGaugeSummary {
|
||||
varName := prometheus.BuildFQName(opts.Namespace, opts.Subsystem, opts.Name)
|
||||
s := &LiteGaugeSummary{
|
||||
min: math.Inf(1),
|
||||
max: math.Inf(-1),
|
||||
desc: prometheus.NewDesc(varName, help, []string{"stat"}, nil),
|
||||
desc: prometheus.NewDesc(varName, opts.Help, []string{"stat"}, opts.ConstLabels),
|
||||
}
|
||||
prometheus.MustRegister(s)
|
||||
return s
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue