forked from TrueCloudLab/frostfs-node
[#312] metrics: Add writecache metrcis
Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
This commit is contained in:
parent
d212d908b5
commit
2ce43935f9
14 changed files with 415 additions and 32 deletions
|
@ -48,6 +48,18 @@ func newGaugeVec(opts prometheus.GaugeOpts, labelNames []string) metric[*prometh
|
|||
}
|
||||
}
|
||||
|
||||
func newGaugeFunc(opts prometheus.GaugeOpts, f func() float64) metric[prometheus.GaugeFunc] {
|
||||
return metric[prometheus.GaugeFunc]{
|
||||
value: prometheus.NewGaugeFunc(opts, f),
|
||||
desc: Description{
|
||||
Name: prometheus.BuildFQName(opts.Namespace, opts.Subsystem, opts.Name),
|
||||
Type: dto.MetricType_GAUGE.String(),
|
||||
Help: opts.Help,
|
||||
ConstantLabels: opts.ConstLabels,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func newCounter(opts prometheus.CounterOpts) metric[prometheus.Counter] {
|
||||
return metric[prometheus.Counter]{
|
||||
value: prometheus.NewCounter(opts),
|
||||
|
@ -60,6 +72,32 @@ func newCounter(opts prometheus.CounterOpts) metric[prometheus.Counter] {
|
|||
}
|
||||
}
|
||||
|
||||
func newCounterVec(opts prometheus.CounterOpts, labels []string) metric[*prometheus.CounterVec] {
|
||||
return metric[*prometheus.CounterVec]{
|
||||
value: prometheus.NewCounterVec(opts, labels),
|
||||
desc: Description{
|
||||
Name: prometheus.BuildFQName(opts.Namespace, opts.Subsystem, opts.Name),
|
||||
Type: dto.MetricType_COUNTER.String(),
|
||||
Help: opts.Help,
|
||||
ConstantLabels: opts.ConstLabels,
|
||||
VariableLabels: labels,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func newHistogramVec(opts prometheus.HistogramOpts, labelNames []string) metric[*prometheus.HistogramVec] {
|
||||
return metric[*prometheus.HistogramVec]{
|
||||
value: prometheus.NewHistogramVec(opts, labelNames),
|
||||
desc: Description{
|
||||
Name: prometheus.BuildFQName(opts.Namespace, opts.Subsystem, opts.Name),
|
||||
Type: dto.MetricType_HISTOGRAM.String(),
|
||||
Help: opts.Help,
|
||||
ConstantLabels: opts.ConstLabels,
|
||||
VariableLabels: labelNames,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
// DescribeAll returns descriptions for all registered metrics.
|
||||
func DescribeAll() ([]Description, error) {
|
||||
registeredDescriptionsMtx.Lock()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue