collector: publish base units and _total counter names (#2743)

Signed-off-by: Jan-Otto Kröpke <mail@jkroepke.de>
This commit is contained in:
Jan-Otto Kröpke
2026-10-16 10:48:26 +02:00
committed by GitHub
parent dc8092f46d
commit 3fb18521f6
131 changed files with 1674 additions and 1459 deletions
+2 -1
View File
@@ -28,7 +28,8 @@ Hyper-V guest with 12 logical processors in one processor group.
- `Interrupts/sec`, `DPCs Queued/sec` and `Clock Interrupts/sec`
(`PERF_COUNTER_COUNTER`) and `C1/C2/C3 Transitions/sec`,
`Idle Break Events/sec` (`PERF_COUNTER_BULK_COUNT`) are cumulative counts.
- `Processor Frequency` is a gauge in MHz (3700 here). `Parking Status` is a
- `Processor Frequency` is a gauge in MHz (3700 here); the collector multiplies
it by 1e6 for `windows_cpu_core_frequency_hertz`. `Parking Status` is a
gauge, 0 when the processor is not parked. `% Performance Limit` is a gauge
percentage (100 here). `% C3 Time` and `C3 Transitions/sec` stayed 0 on this
virtual machine.
+7 -7
View File
@@ -57,7 +57,7 @@ type Collector struct {
clockInterruptsTotal *prometheus.Desc
idleBreakEventsTotal *prometheus.Desc
parkingStatus *prometheus.Desc
processorFrequencyMHz *prometheus.Desc
processorFrequencyHertz *prometheus.Desc
processorPerformance *prometheus.Desc
processorMPerf *prometheus.Desc
processorRTC *prometheus.Desc
@@ -107,7 +107,7 @@ func (c *Collector) Build(logger *slog.Logger, _ *mi.Session) error {
nil,
)
c.timeTotal = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "time_total"),
prometheus.BuildFQName(types.Namespace, Name, "time_seconds_total"),
"Time that processor spent in different modes (dpc, idle, interrupt, privileged, user)",
[]string{"core", "mode"},
nil,
@@ -142,9 +142,9 @@ func (c *Collector) Build(logger *slog.Logger, _ *mi.Session) error {
[]string{"core"},
nil,
)
c.processorFrequencyMHz = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "core_frequency_mhz"),
"Core frequency in megahertz",
c.processorFrequencyHertz = prometheus.NewDesc(
prometheus.BuildFQName(types.Namespace, Name, "core_frequency_hertz"),
"Core frequency in hertz",
[]string{"core"},
nil,
)
@@ -321,9 +321,9 @@ func (c *Collector) Collect(ch chan<- prometheus.Metric, _ time.Duration) error
)
ch <- prometheus.MustNewConstMetric(
c.processorFrequencyMHz,
c.processorFrequencyHertz,
prometheus.GaugeValue,
coreData.ProcessorFrequencyMHz,
coreData.ProcessorFrequencyMHz*1e6,
core,
)