Skip to content

Commit

Permalink
performancecounter: rename collector
Browse files Browse the repository at this point in the history
Signed-off-by: Jan-Otto Kröpke <[email protected]>
  • Loading branch information
jkroepke committed Nov 30, 2024
1 parent f48f699 commit 57d125f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions internal/collector/performancecounter/performancecounter.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ func (c *Collector) Collect(ch chan<- prometheus.Metric) error {
ch <- prometheus.MustNewConstMetric(
prometheus.NewDesc(
counter.Metric,
"",
"windows_exporter: custom Performance Counter metric",
nil,
labels,
),
Expand All @@ -182,7 +182,7 @@ func (c *Collector) Collect(ch chan<- prometheus.Metric) error {
ch <- prometheus.MustNewConstMetric(
prometheus.NewDesc(
counter.Metric+"_second",
"",
"windows_exporter: custom Performance Counter metric",
nil,
labels,
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,20 +59,20 @@ func TestCollector(t *testing.T) {
object: "Memory",
instances: nil,
counters: []performancecounter.Counter{{Name: "Available Bytes", Type: "gauge"}},
expectedMetrics: regexp.MustCompile(`^# HELP windows_performancecounter_memory_available_bytes \S*\s*# TYPE windows_performancecounter_memory_available_bytes gauge\s*windows_performancecounter_memory_available_bytes \d`),
expectedMetrics: regexp.MustCompile(`^# HELP windows_performancecounter_memory_available_bytes windows_exporter: custom Performance Counter metric\S*\s*# TYPE windows_performancecounter_memory_available_bytes gauge\s*windows_performancecounter_memory_available_bytes \d`),
},
{
object: "Process",
instances: []string{"*"},
counters: []performancecounter.Counter{{Name: "Thread Count", Type: "counter"}},
expectedMetrics: regexp.MustCompile(`^# HELP windows_performancecounter_process_thread_count \S*\s*# TYPE windows_performancecounter_process_thread_count counter\s*windows_performancecounter_process_thread_count\{instance=".+"} \d`),
expectedMetrics: regexp.MustCompile(`^# HELP windows_performancecounter_process_thread_count windows_exporter: custom Performance Counter metric\S*\s*# TYPE windows_performancecounter_process_thread_count counter\s*windows_performancecounter_process_thread_count\{instance=".+"} \d`),
},
{
object: "Processor Information",
instances: []string{"*"},
instanceLabel: "core",
counters: []performancecounter.Counter{{Name: "% Processor Time", Metric: "windows_performancecounter_processor_information_processor_time", Labels: map[string]string{"state": "active"}}, {Name: "% Idle Time", Metric: "windows_performancecounter_processor_information_processor_time", Labels: map[string]string{"state": "idle"}}},
expectedMetrics: regexp.MustCompile(`^# HELP windows_performancecounter_processor_information_processor_time\s+# TYPE windows_performancecounter_processor_information_processor_time counter\s+windows_performancecounter_processor_information_processor_time\{core="0,0",state="active"} [0-9.e+]+\s+windows_performancecounter_processor_information_processor_time\{core="0,0",state="idle"} [0-9.e+]+`),
expectedMetrics: regexp.MustCompile(`^# HELP windows_performancecounter_processor_information_processor_time windows_exporter: custom Performance Counter metric\s+# TYPE windows_performancecounter_processor_information_processor_time counter\s+windows_performancecounter_processor_information_processor_time\{core="0,0",state="active"} [0-9.e+]+\s+windows_performancecounter_processor_information_processor_time\{core="0,0",state="idle"} [0-9.e+]+`),
},
} {
t.Run(tc.object, func(t *testing.T) {
Expand Down
4 changes: 2 additions & 2 deletions tools/e2e-output.txt
Original file line number Diff line number Diff line change
Expand Up @@ -319,9 +319,9 @@ windows_exporter_collector_timeout{collector="udp"} 0
# TYPE windows_pagefile_free_bytes gauge
# HELP windows_pagefile_limit_bytes Number of bytes that can be stored in the operating system paging files. 0 (zero) indicates that there are no paging files
# TYPE windows_pagefile_limit_bytes gauge
# HELP windows_performancecounter_memory_cache_faults_sec
# HELP windows_performancecounter_memory_cache_faults_sec windows_exporter: custom Performance Counter metric
# TYPE windows_performancecounter_memory_cache_faults_sec counter
# HELP windows_performancecounter_processor_information_processor_time
# HELP windows_performancecounter_processor_information_processor_time windows_exporter: custom Performance Counter metric
# TYPE windows_performancecounter_processor_information_processor_time counter
# HELP windows_physical_disk_idle_seconds_total Seconds that the disk was idle (PhysicalDisk.PercentIdleTime)
# TYPE windows_physical_disk_idle_seconds_total counter
Expand Down

0 comments on commit 57d125f

Please sign in to comment.