From bf56e99ad25ae1f44d5f721792b33744cc6c9bfb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan-Otto=20Kr=C3=B6pke?= Date: Sun, 6 Apr 2025 11:26:56 +0200 Subject: [PATCH] chore: Update Copyright (#1981) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Jan-Otto Kröpke --- .editorconfig | 3 ++ .github/workflows/lint.yml | 6 ++-- .golangci.yaml | 21 ++++++++++++++ .run/all.run.xml | 19 +++++++++++- cmd/windows_exporter/0_service.go | 17 +++++++++++ cmd/windows_exporter/doc.go | 4 ++- cmd/windows_exporter/main.go | 29 ++++++++++++------- cmd/windows_exporter/main_test.go | 4 ++- installer/files.wxs | 4 ++- installer/main.wxs | 4 ++- internal/collector/ad/ad.go | 4 ++- internal/collector/ad/ad_test.go | 4 ++- internal/collector/ad/types.go | 4 ++- internal/collector/adcs/adcs.go | 4 ++- internal/collector/adcs/adcs_test.go | 4 ++- internal/collector/adcs/types.go | 4 ++- internal/collector/adfs/adfs.go | 4 ++- internal/collector/adfs/adfs_test.go | 4 ++- internal/collector/adfs/types.go | 4 ++- internal/collector/cache/cache.go | 4 ++- internal/collector/cache/cache_test.go | 4 ++- internal/collector/cache/types.go | 4 ++- internal/collector/container/container.go | 4 ++- .../collector/container/container_test.go | 4 ++- internal/collector/cpu/cpu.go | 4 ++- internal/collector/cpu/cpu_test.go | 4 ++- internal/collector/cpu/types.go | 4 ++- internal/collector/cpu_info/cpu_info.go | 4 ++- internal/collector/cpu_info/cpu_info_test.go | 4 ++- internal/collector/cs/cs.go | 4 ++- internal/collector/cs/cs_test.go | 4 ++- internal/collector/dfsr/dfsr.go | 4 ++- internal/collector/dfsr/dfsr_test.go | 4 ++- internal/collector/dfsr/types.go | 4 ++- internal/collector/dhcp/dhcp.go | 4 ++- internal/collector/dhcp/dhcp_test.go | 4 ++- internal/collector/dhcp/types.go | 4 ++- internal/collector/diskdrive/diskdrive.go | 4 ++- .../collector/diskdrive/diskdrive_test.go | 4 ++- internal/collector/dns/dns.go | 4 ++- internal/collector/dns/dns_test.go | 4 ++- internal/collector/dns/types.go | 4 ++- internal/collector/exchange/exchange.go | 4 ++- .../exchange/exchange_active_sync.go | 4 ++- .../exchange/exchange_ad_access_processes.go | 4 ++- .../exchange/exchange_autodiscover.go | 4 ++- .../exchange/exchange_availability_service.go | 4 ++- .../collector/exchange/exchange_http_proxy.go | 4 ++- .../exchange/exchange_mapi_http_emsmdb.go | 4 ++- .../exchange/exchange_outlook_web_access.go | 4 ++- .../exchange/exchange_rpc_client_access.go | 4 ++- internal/collector/exchange/exchange_test.go | 4 ++- .../exchange/exchange_transport_queues.go | 4 ++- .../exchange/exchange_workload_management.go | 4 ++- internal/collector/filetime/filetime.go | 4 ++- internal/collector/filetime/filetime_test.go | 4 ++- internal/collector/fsrmquota/fsrmquota.go | 4 ++- .../collector/fsrmquota/fsrmquota_test.go | 4 ++- internal/collector/hyperv/hyperv.go | 4 ++- internal/collector/hyperv/hyperv_datastore.go | 4 ++- .../hyperv/hyperv_dynamic_memory_balancer.go | 4 ++- .../hyperv/hyperv_dynamic_memory_vm.go | 4 ++- .../hyperv_hypervisor_logical_processor.go | 4 ++- .../hyperv_hypervisor_root_partition.go | 4 ++- ...yperv_hypervisor_root_virtual_processor.go | 4 ++- .../hyperv_hypervisor_virtual_processor.go | 4 ++- .../hyperv/hyperv_legacy_network_adapter.go | 4 ++- internal/collector/hyperv/hyperv_test.go | 4 ++- .../hyperv_virtual_machine_health_summary.go | 4 ++- .../hyperv_virtual_machine_vid_partition.go | 4 ++- .../hyperv/hyperv_virtual_network_adapter.go | 4 ++- ...rv_virtual_network_adapter_drop_reasons.go | 4 ++- .../collector/hyperv/hyperv_virtual_smb.go | 4 ++- .../hyperv/hyperv_virtual_storage_device.go | 4 ++- .../collector/hyperv/hyperv_virtual_switch.go | 4 ++- internal/collector/iis/iis.go | 4 ++- internal/collector/iis/iis_app_pool_was.go | 4 ++- internal/collector/iis/iis_bench_test.go | 4 ++- internal/collector/iis/iis_w3svc_w3wp.go | 4 ++- internal/collector/iis/iis_web_service.go | 4 ++- .../collector/iis/iis_web_service_cache.go | 4 ++- internal/collector/license/license.go | 4 ++- internal/collector/license/license_test.go | 4 ++- .../collector/logical_disk/logical_disk.go | 4 ++- .../logical_disk/logical_disk_test.go | 4 ++- internal/collector/logical_disk/types.go | 4 ++- internal/collector/logon/logon.go | 8 +++-- internal/collector/logon/logon_test.go | 4 ++- internal/collector/memory/memory.go | 4 ++- internal/collector/memory/memory_test.go | 4 ++- internal/collector/memory/types.go | 4 ++- internal/collector/mscluster/mscluster.go | 4 ++- .../collector/mscluster/mscluster_cluster.go | 4 ++- .../collector/mscluster/mscluster_network.go | 4 ++- .../collector/mscluster/mscluster_node.go | 4 ++- .../collector/mscluster/mscluster_resource.go | 4 ++- .../mscluster/mscluster_resourcegroup.go | 4 ++- .../collector/mscluster/mscluster_test.go | 4 ++- internal/collector/msmq/msmq.go | 4 ++- internal/collector/msmq/msmq_test.go | 4 ++- internal/collector/msmq/types.go | 4 ++- internal/collector/mssql/mssql.go | 4 ++- .../collector/mssql/mssql_access_methods.go | 4 ++- .../mssql/mssql_availability_replica.go | 4 ++- .../collector/mssql/mssql_buffer_manager.go | 4 ++- internal/collector/mssql/mssql_database.go | 4 ++- .../collector/mssql/mssql_database_replica.go | 4 ++- .../mssql/mssql_general_statistics.go | 4 ++- internal/collector/mssql/mssql_instance.go | 4 ++- internal/collector/mssql/mssql_locks.go | 4 ++- .../collector/mssql/mssql_memory_manager.go | 4 ++- internal/collector/mssql/mssql_sql_errors.go | 4 ++- internal/collector/mssql/mssql_sql_stats.go | 4 ++- internal/collector/mssql/mssql_test.go | 4 ++- .../collector/mssql/mssql_transactions.go | 4 ++- internal/collector/mssql/mssql_wait_stats.go | 4 ++- internal/collector/mssql/types.go | 17 +++++++++++ internal/collector/net/net.go | 4 ++- internal/collector/net/net_bench_test.go | 4 ++- internal/collector/net/net_test.go | 4 ++- internal/collector/net/types.go | 4 ++- .../collector/netframework/netframework.go | 4 ++- .../netframework_clrexceptions.go | 4 ++- .../netframework/netframework_clrinterop.go | 4 ++- .../netframework/netframework_clrjit.go | 4 ++- .../netframework/netframework_clrloading.go | 4 ++- .../netframework_clrlocksandthreads.go | 4 ++- .../netframework/netframework_clrmemory.go | 4 ++- .../netframework/netframework_clrremoting.go | 4 ++- .../netframework/netframework_clrsecurity.go | 4 ++- .../netframework/netframework_test.go | 4 ++- internal/collector/nps/nps.go | 4 ++- internal/collector/nps/nps_test.go | 4 ++- internal/collector/nps/types.go | 4 ++- internal/collector/os/os.go | 4 ++- internal/collector/os/os_test.go | 4 ++- internal/collector/pagefile/pagefile.go | 4 ++- internal/collector/pagefile/pagefile_test.go | 4 ++- internal/collector/pagefile/types.go | 4 ++- .../performancecounter/performancecounter.go | 4 ++- .../performancecounter_test.go | 4 ++- .../performancecounter_test_test.go | 4 ++- .../collector/performancecounter/types.go | 4 ++- .../collector/physical_disk/physical_disk.go | 4 ++- .../physical_disk/physical_disk_test.go | 4 ++- internal/collector/physical_disk/types.go | 4 ++- internal/collector/printer/printer.go | 4 ++- internal/collector/printer/printer_test.go | 4 ++- internal/collector/process/process.go | 4 ++- internal/collector/process/process_test.go | 4 ++- internal/collector/process/process_v1.go | 4 ++- internal/collector/process/process_v2.go | 4 ++- internal/collector/process/types.go | 4 ++- internal/collector/remote_fx/remote_fx.go | 4 ++- .../collector/remote_fx/remote_fx_test.go | 4 ++- internal/collector/remote_fx/types.go | 4 ++- .../scheduled_task/scheduled_task.go | 4 ++- .../scheduled_task/scheduled_task_test.go | 4 ++- internal/collector/service/service.go | 4 ++- internal/collector/service/service_test.go | 4 ++- internal/collector/smb/smb.go | 4 ++- internal/collector/smb/smb_test.go | 4 ++- internal/collector/smb/types.go | 4 ++- internal/collector/smbclient/smbclient.go | 4 ++- .../collector/smbclient/smbclient_test.go | 4 ++- internal/collector/smbclient/types.go | 4 ++- internal/collector/smtp/smtp.go | 4 ++- internal/collector/smtp/smtp_test.go | 4 ++- internal/collector/smtp/types.go | 4 ++- internal/collector/system/system.go | 4 ++- internal/collector/system/system_test.go | 4 ++- internal/collector/system/types.go | 4 ++- internal/collector/tcp/tcp.go | 4 ++- internal/collector/tcp/tcp_test.go | 4 ++- internal/collector/tcp/types.go | 4 ++- .../terminal_services/terminal_services.go | 4 ++- .../terminal_services_test.go | 4 ++- internal/collector/terminal_services/types.go | 4 ++- internal/collector/textfile/textfile.go | 4 ++- internal/collector/textfile/textfile_test.go | 4 ++- .../collector/textfile/textfile_test_test.go | 4 ++- internal/collector/thermalzone/thermalzone.go | 4 ++- .../collector/thermalzone/thermalzone_test.go | 4 ++- internal/collector/thermalzone/types.go | 6 +++- internal/collector/time/time.go | 4 ++- internal/collector/time/time_test.go | 4 ++- internal/collector/time/types.go | 4 ++- internal/collector/udp/types.go | 4 ++- internal/collector/udp/udp.go | 4 ++- internal/collector/udp/udp_test.go | 4 ++- internal/collector/update/update.go | 4 ++- internal/collector/update/update_test.go | 4 ++- internal/collector/vmware/types.go | 4 ++- internal/collector/vmware/vmware.go | 4 ++- internal/collector/vmware/vmware_test.go | 4 ++- internal/config/config.go | 4 ++- internal/config/flatten.go | 4 ++- internal/config/flatten_test.go | 4 ++- internal/headers/dhcpsapi/dhcpsapi.go | 17 +++++++++++ internal/headers/dhcpsapi/dhcpsapi_test.go | 17 +++++++++++ internal/headers/dhcpsapi/types.go | 17 +++++++++++ internal/headers/iphlpapi/const.go | 4 ++- internal/headers/iphlpapi/iphlpapi.go | 4 ++- internal/headers/iphlpapi/iphlpapi_test.go | 4 ++- internal/headers/iphlpapi/types.go | 4 ++- internal/headers/kernel32/kernel32.go | 4 ++- internal/headers/netapi32/netapi32.go | 4 ++- internal/headers/psapi/psapi.go | 4 ++- .../schedule_service/schedule_service.go | 6 +++- internal/headers/secur32/secur32.go | 4 ++- internal/headers/secur32/secur32_test.go | 4 ++- internal/headers/secur32/types.go | 4 ++- internal/headers/slc/slc.go | 4 ++- internal/headers/sysinfoapi/sysinfoapi.go | 4 ++- internal/headers/win32api/types.go | 17 +++++++++++ internal/headers/wtsapi32/wtsapi32.go | 4 ++- internal/httphandler/health.go | 4 ++- internal/httphandler/httphandler.go | 4 ++- internal/httphandler/version.go | 4 ++- internal/log/eventlog/eventlog.go | 4 ++- internal/log/flag/flag.go | 4 ++- internal/log/logger.go | 4 ++- internal/mi/application.go | 16 +++++----- internal/mi/callbacks.go | 4 ++- internal/mi/doc.go | 4 ++- internal/mi/errors.go | 4 ++- internal/mi/instance.go | 4 ++- internal/mi/mi_bench_test.go | 4 ++- internal/mi/mi_test.go | 4 ++- internal/mi/operation.go | 4 ++- internal/mi/result.go | 4 ++- internal/mi/session.go | 4 ++- internal/mi/types.go | 4 ++- internal/mi/value.go | 4 ++- internal/pdh/collector.go | 4 ++- internal/pdh/collector_bench_test.go | 4 ++- internal/pdh/collector_test.go | 4 ++- internal/pdh/const.go | 4 ++- internal/pdh/error.go | 4 ++- internal/pdh/pdh.go | 15 ++++++++++ internal/pdh/registry/collector.go | 17 +++++++++++ internal/pdh/registry/nametable.go | 17 +++++++++++ internal/pdh/registry/perflib.go | 17 +++++++++++ internal/pdh/registry/perflib_test.go | 17 +++++++++++ internal/pdh/registry/raw_types.go | 17 +++++++++++ internal/pdh/registry/utf16.go | 17 +++++++++++ internal/pdh/registry/utils.go | 17 +++++++++++ internal/pdh/types.go | 4 ++- internal/pdh/types/types.go | 17 +++++++++++ internal/types/const.go | 4 ++- internal/types/errors.go | 6 +++- internal/types/regexp.go | 4 ++- internal/utils/counter.go | 4 ++- internal/utils/counter_test.go | 4 ++- internal/utils/testutils/testutils.go | 4 ++- internal/utils/utils.go | 15 ++++++++++ pkg/collector/collect.go | 6 +++- pkg/collector/collection.go | 4 ++- pkg/collector/config.go | 4 ++- pkg/collector/handler.go | 4 ++- pkg/collector/map.go | 4 ++- pkg/collector/types.go | 4 ++- renovate.json | 14 +++++---- 263 files changed, 1079 insertions(+), 269 deletions(-) diff --git a/.editorconfig b/.editorconfig index 13e98bb9..ac1d1b1a 100644 --- a/.editorconfig +++ b/.editorconfig @@ -11,6 +11,9 @@ tab_width = 4 indent_style = space indent_size = 4 +[renovate.json] +indent_size = 2 + [*.{yml,yaml}] indent_style = space indent_size = 2 diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 75a3e680..9e3b2e84 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -8,11 +8,9 @@ on: - master - next - main + - "0.*" + - "1.*" pull_request: - branches: - - master - - next - - main env: VERSION_PROMU: '0.14.0' diff --git a/.golangci.yaml b/.golangci.yaml index d976070c..44bf3c0d 100644 --- a/.golangci.yaml +++ b/.golangci.yaml @@ -29,6 +29,27 @@ linters: msg: use golang.org/x/sys/windows instead of syscall - pattern: ^windows\.NewLazyDLL$ msg: use NewLazySystemDLL instead NewLazyDLL + goheader: + values: + const: + COMPANY: The Prometheus Authors + template: |- + SPDX-License-Identifier: Apache-2.0 + + Copyright {{ YEAR }} {{ COMPANY }} + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + gomoddirectives: + toolchain-forbidden: true gosec: excludes: - G101 diff --git a/.run/all.run.xml b/.run/all.run.xml index 7773cac1..8c52f200 100644 --- a/.run/all.run.xml +++ b/.run/all.run.xml @@ -1,3 +1,20 @@ + + @@ -10,4 +27,4 @@ - \ No newline at end of file + diff --git a/cmd/windows_exporter/0_service.go b/cmd/windows_exporter/0_service.go index 9707a29b..a2260370 100644 --- a/cmd/windows_exporter/0_service.go +++ b/cmd/windows_exporter/0_service.go @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: Apache-2.0 +// // Copyright 2025 The Prometheus Authors // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -11,6 +13,21 @@ // See the License for the specific language governing permissions and // limitations under the License. +// Copyright 2025 The Prometheus Authors +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//go:build windows + package main import ( diff --git a/cmd/windows_exporter/doc.go b/cmd/windows_exporter/doc.go index 244aa7fa..c3155c2b 100644 --- a/cmd/windows_exporter/doc.go +++ b/cmd/windows_exporter/doc.go @@ -1,4 +1,6 @@ -// Copyright 2024 The Prometheus Authors +// SPDX-License-Identifier: Apache-2.0 +// +// Copyright 2025 The Prometheus Authors // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at diff --git a/cmd/windows_exporter/main.go b/cmd/windows_exporter/main.go index 5c549d7f..146aaa03 100644 --- a/cmd/windows_exporter/main.go +++ b/cmd/windows_exporter/main.go @@ -1,4 +1,6 @@ -// Copyright 2024 The Prometheus Authors +// SPDX-License-Identifier: Apache-2.0 +// +// Copyright 2025 The Prometheus Authors // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at @@ -144,7 +146,7 @@ func run(ctx context.Context, args []string) int { logger.LogAttrs(ctx, slog.LevelDebug, "logging has Started") if configFile != nil && *configFile != "" { - logger.InfoContext(ctx, "using configuration file: "+*configFile) + logger.LogAttrs(ctx, slog.LevelInfo, "using configuration file: "+*configFile) } if err = setPriorityWindows(ctx, logger, os.Getpid(), *processPriority); err != nil { @@ -175,7 +177,7 @@ func run(ctx context.Context, args []string) int { } } - logCurrentUser(logger) + logCurrentUser(ctx, logger) logger.InfoContext(ctx, "Enabled collectors: "+strings.Join(enabledCollectorList, ", ")) @@ -240,27 +242,34 @@ func run(ctx context.Context, args []string) int { ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second) defer cancel() - _ = server.Shutdown(ctx) //nolint:contextcheck // create a new context for server shutdown - - logger.LogAttrs(ctx, slog.LevelInfo, "windows_exporter has shut down") //nolint:contextcheck + //nolint:contextcheck // create a new context for server shutdown + if err = server.Shutdown(ctx); err != nil { + //nolint:contextcheck + logger.LogAttrs(ctx, slog.LevelError, "Failed to shutdown windows_exporter", + slog.Any("err", err), + ) + } else { + //nolint:contextcheck + logger.LogAttrs(ctx, slog.LevelInfo, "windows_exporter has shut down") + } return 0 } -func logCurrentUser(logger *slog.Logger) { +func logCurrentUser(ctx context.Context, logger *slog.Logger) { u, err := user.Current() if err != nil { - logger.Warn("Unable to determine which user is running this exporter. More info: https://github.com/golang/go/issues/37348", + logger.LogAttrs(ctx, slog.LevelWarn, "Unable to determine which user is running this exporter. More info: https://github.com/golang/go/issues/37348", slog.Any("err", err), ) return } - logger.Info("Running as " + u.Username) + logger.LogAttrs(ctx, slog.LevelInfo, "Running as "+u.Username) if strings.Contains(u.Username, "ContainerAdministrator") || strings.Contains(u.Username, "ContainerUser") { - logger.Warn("Running as a preconfigured Windows Container user. This may mean you do not have Windows HostProcess containers configured correctly and some functionality will not work as expected.") + logger.LogAttrs(ctx, slog.LevelWarn, "Running as a preconfigured Windows Container user. This may mean you do not have Windows HostProcess containers configured correctly and some functionality will not work as expected.") } } diff --git a/cmd/windows_exporter/main_test.go b/cmd/windows_exporter/main_test.go index af81f454..938f0eb9 100644 --- a/cmd/windows_exporter/main_test.go +++ b/cmd/windows_exporter/main_test.go @@ -1,4 +1,6 @@ -// Copyright 2024 The Prometheus Authors +// SPDX-License-Identifier: Apache-2.0 +// +// Copyright 2025 The Prometheus Authors // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at diff --git a/installer/files.wxs b/installer/files.wxs index e011b6c6..ee668a26 100644 --- a/installer/files.wxs +++ b/installer/files.wxs @@ -1,5 +1,7 @@