From 332b0a8a1c1f1892cd911a6b4bbef00efdcdc97d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan-Otto=20Kr=C3=B6pke?= Date: Tue, 15 Oct 2024 13:55:16 +0200 Subject: [PATCH] update: rename `updates` collector to `update` (#1692) --- internal/collector/{updates/updates.go => update/update.go} | 4 ++-- .../{updates/updates_test.go => update/update_test.go} | 6 +++--- pkg/collector/collector.go | 4 ++-- pkg/collector/config.go | 6 +++--- pkg/collector/map.go | 4 ++-- 5 files changed, 12 insertions(+), 12 deletions(-) rename internal/collector/{updates/updates.go => update/update.go} (99%) rename internal/collector/{updates/updates_test.go => update/update_test.go} (65%) diff --git a/internal/collector/updates/updates.go b/internal/collector/update/update.go similarity index 99% rename from internal/collector/updates/updates.go rename to internal/collector/update/update.go index be4f5880..f32591c0 100644 --- a/internal/collector/updates/updates.go +++ b/internal/collector/update/update.go @@ -1,6 +1,6 @@ //go:build windows -package updates +package update import ( "errors" @@ -20,7 +20,7 @@ import ( "github.com/yusufpapurcu/wmi" ) -const Name = "updates" +const Name = "update" type Config struct { online bool `yaml:"online"` diff --git a/internal/collector/updates/updates_test.go b/internal/collector/update/update_test.go similarity index 65% rename from internal/collector/updates/updates_test.go rename to internal/collector/update/update_test.go index 5393b422..498eb0d1 100644 --- a/internal/collector/updates/updates_test.go +++ b/internal/collector/update/update_test.go @@ -1,12 +1,12 @@ -package updates_test +package update_test import ( "testing" - "github.com/prometheus-community/windows_exporter/internal/collector/updates" + "github.com/prometheus-community/windows_exporter/internal/collector/update" "github.com/prometheus-community/windows_exporter/internal/testutils" ) func BenchmarkCollector(b *testing.B) { - testutils.FuncBenchmarkCollector(b, "printer", updates.NewWithFlags) + testutils.FuncBenchmarkCollector(b, "printer", update.NewWithFlags) } diff --git a/pkg/collector/collector.go b/pkg/collector/collector.go index 9414fb42..9773570f 100644 --- a/pkg/collector/collector.go +++ b/pkg/collector/collector.go @@ -55,7 +55,7 @@ import ( "github.com/prometheus-community/windows_exporter/internal/collector/textfile" "github.com/prometheus-community/windows_exporter/internal/collector/thermalzone" "github.com/prometheus-community/windows_exporter/internal/collector/time" - "github.com/prometheus-community/windows_exporter/internal/collector/updates" + "github.com/prometheus-community/windows_exporter/internal/collector/update" "github.com/prometheus-community/windows_exporter/internal/collector/vmware" v1 "github.com/prometheus-community/windows_exporter/internal/perfdata/v1" "github.com/prometheus-community/windows_exporter/internal/types" @@ -122,7 +122,7 @@ func NewWithConfig(config Config) *MetricCollectors { collectors[textfile.Name] = textfile.New(&config.Textfile) collectors[thermalzone.Name] = thermalzone.New(&config.ThermalZone) collectors[time.Name] = time.New(&config.Time) - collectors[updates.Name] = updates.New(&config.Updates) + collectors[update.Name] = update.New(&config.Update) collectors[vmware.Name] = vmware.New(&config.Vmware) return New(collectors) diff --git a/pkg/collector/config.go b/pkg/collector/config.go index f62e25d5..f9e67276 100644 --- a/pkg/collector/config.go +++ b/pkg/collector/config.go @@ -45,7 +45,7 @@ import ( "github.com/prometheus-community/windows_exporter/internal/collector/textfile" "github.com/prometheus-community/windows_exporter/internal/collector/thermalzone" "github.com/prometheus-community/windows_exporter/internal/collector/time" - "github.com/prometheus-community/windows_exporter/internal/collector/updates" + "github.com/prometheus-community/windows_exporter/internal/collector/update" "github.com/prometheus-community/windows_exporter/internal/collector/vmware" ) @@ -94,7 +94,7 @@ type Config struct { Textfile textfile.Config `yaml:"textfile"` ThermalZone thermalzone.Config `yaml:"thermal_zone"` Time time.Config `yaml:"time"` - Updates updates.Config `yaml:"updates"` + Update update.Config `yaml:"update"` Vmware vmware.Config `yaml:"vmware"` } @@ -146,6 +146,6 @@ var ConfigDefaults = Config{ Textfile: textfile.ConfigDefaults, ThermalZone: thermalzone.ConfigDefaults, Time: time.ConfigDefaults, - Updates: updates.ConfigDefaults, + Update: update.ConfigDefaults, Vmware: vmware.ConfigDefaults, } diff --git a/pkg/collector/map.go b/pkg/collector/map.go index c78d3923..3fcdf25c 100644 --- a/pkg/collector/map.go +++ b/pkg/collector/map.go @@ -49,7 +49,7 @@ import ( "github.com/prometheus-community/windows_exporter/internal/collector/textfile" "github.com/prometheus-community/windows_exporter/internal/collector/thermalzone" "github.com/prometheus-community/windows_exporter/internal/collector/time" - "github.com/prometheus-community/windows_exporter/internal/collector/updates" + "github.com/prometheus-community/windows_exporter/internal/collector/update" "github.com/prometheus-community/windows_exporter/internal/collector/vmware" ) @@ -104,7 +104,7 @@ var BuildersWithFlags = map[string]BuilderWithFlags[Collector]{ textfile.Name: NewBuilderWithFlags(textfile.NewWithFlags), thermalzone.Name: NewBuilderWithFlags(thermalzone.NewWithFlags), time.Name: NewBuilderWithFlags(time.NewWithFlags), - updates.Name: NewBuilderWithFlags(updates.NewWithFlags), + update.Name: NewBuilderWithFlags(update.NewWithFlags), vmware.Name: NewBuilderWithFlags(vmware.NewWithFlags), }