mirror of
https://github.com/prometheus-community/windows_exporter.git
synced 2026-10-21 12:09:03 +02:00
collector: publish base units and _total counter names (#2743)
Signed-off-by: Jan-Otto Kröpke <mail@jkroepke.de>
This commit is contained in:
@@ -151,8 +151,8 @@ func (c *Collector) Build(_ *slog.Logger, _ *mi.Session) error {
|
||||
nil,
|
||||
)
|
||||
c.printerJobCount = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(types.Namespace, Name, "job_count"),
|
||||
"Number of jobs processed by the printer since the last reset",
|
||||
prometheus.BuildFQName(types.Namespace, Name, "jobs"),
|
||||
"Number of jobs in the queue of the printer",
|
||||
[]string{"printer"},
|
||||
nil,
|
||||
)
|
||||
@@ -190,7 +190,7 @@ func (c *Collector) Collect(ch chan<- prometheus.Metric, _ time.Duration) error
|
||||
// Win32_Printer JobCountSinceLastReset is PRINTER_INFO_2.cJobs, the number of queued jobs.
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.printerJobCount,
|
||||
prometheus.CounterValue,
|
||||
prometheus.GaugeValue,
|
||||
float64(printer.Jobs),
|
||||
printer.Name,
|
||||
)
|
||||
|
||||
@@ -35,7 +35,7 @@ func BenchmarkCollector(b *testing.B) {
|
||||
|
||||
func TestCollector(t *testing.T) {
|
||||
metrics := testutils.TestCollector(t, printer.New, nil)
|
||||
testutils.RequireFixtureMetric(t, metrics, printer.Name, "windows_printer_job_count", prometheus.Labels{"printer": "CIPrinter"})
|
||||
testutils.RequireFixtureMetric(t, metrics, printer.Name, "windows_printer_jobs", prometheus.Labels{"printer": "CIPrinter"})
|
||||
}
|
||||
|
||||
// TestCollectorWithoutMISession checks that the collector does not depend on WMI.
|
||||
|
||||
Reference in New Issue
Block a user