Repository: prometheus-community/windows_exporter (Go)

Issue:
The windows_os_processes does not back any result
### Current Behavior

The windows_os_processes does not back any result . it is just work on 0.29.2.

### Expected Behavior

it should back Number Of Process on windows

### Steps To Reproduce

```Markdown

```

### Environment

- windows_exporter Version: 0.30.5
- Windows Server Version: 2019


### windows_exporter logs

```shell
.
```

### Anything else?

_No response_


Discussion:
https://github.com/prometheus-community/windows_exporter/pull/1596 - looks like windows_os_processes is slated for removal for windows_system_processes. I didn't see anything that this has happened already but confirmed my 0.30.6 version also no longer has windows_os_processes



Patch:
diff --git a/internal/collector/os/os.go b/internal/collector/os/os.go
index bf02442e4..276f49bce 100644
--- a/internal/collector/os/os.go
+++ b/internal/collector/os/os.go
@@ -28,6 +28,7 @@ import (
 	"github.com/alecthomas/kingpin/v2"
 	"github.com/prometheus-community/windows_exporter/internal/headers/kernel32"
 	"github.com/prometheus-community/windows_exporter/internal/headers/netapi32"
+	"github.com/prometheus-community/windows_exporter/internal/headers/psapi"
 	"github.com/prometheus-community/windows_exporter/internal/headers/sysinfoapi"
 	"github.com/prometheus-community/windows_exporter/internal/mi"
 	"github.com/prometheus-community/windows_exporter/internal/osversion"
@@ -51,7 +52,9 @@ type Collector struct {
 	hostname      *prometheus.Desc
 	osInformation *prometheus.Desc
 
-	// users
+	// Deprecated: Use windows_system_processes instead.
+	processes *prometheus.Desc
+
 	// Deprecated: Use windows_system_process_limit instead.
 	processesLimit *prometheus.Desc
 
@@ -169,6 +172,12 @@ func (c *Collector) Build(logger *slog.Logger, _ *mi.Session) error {
 		nil,
 	)
 
+	c.processes = prometheus.NewDesc(
+		prometheus.BuildFQName(types.Namespace, Name, "processes"),
+		"Deprecated: Use `windows_system_processes` instead.",
+		nil,
+		nil,
+	)
 	c.processesLimit = prometheus.NewDesc(
 		prometheus.BuildFQName(types.Namespace, Name, "processes_limit"),
 		"Deprecated: Use `windows_system_process_limit` instead.",
@@ -216,6 +225,10 @@ func (c *Collector) Collect(ch chan<- prometheus.Metric) error {
 
 	c.collect(ch)
 
+	if err := c.collectProcessCount(ch); err != nil {
+		errs = append(errs, fmt.Errorf("failed to collect process count metrics: %w", err))
+	}
+
 	if err := c.collectHostname(ch); err != nil {
 		errs = append(errs, fmt.Errorf("failed to collect hostname metrics: %w", err))
 	}
@@ -278,6 +291,20 @@ func (c *Collector) collectHostname(ch chan<- prometheus.Metric) error {
 	return nil
 }
 
+func (c *Collector) collectProcessCount(ch chan<- prometheus.Metric) error {
+	gpi, err := psapi.GetPerformanceInfo()
+	if err != nil {
+		return err
+	}
+
+	ch <- prometheus.MustNewConstMetric(c.processes,
+		prometheus.GaugeValue,
+		float64(gpi.ProcessCount),
+	)
+
+	return nil
+}
+
 func (c *Collector) collectTime(ch chan<- prometheus.Metric) error {
 	timeZoneInfo, err := kernel32.GetDynamicTimeZoneInformation()
 	if err != nil {


Test patch:
diff --git a/tools/e2e-output.txt b/tools/e2e-output.txt
index 8582c870d..0c28795ad 100644
--- a/tools/e2e-output.txt
+++ b/tools/e2e-output.txt
@@ -303,6 +303,8 @@ windows_exporter_collector_timeout{collector="udp"} 0
 # TYPE windows_os_physical_memory_free_bytes gauge
 # HELP windows_os_process_memory_limit_bytes Deprecated: Use `windows_memory_process_memory_limit_bytes` instead.
 # TYPE windows_os_process_memory_limit_bytes gauge
+# HELP windows_os_processes Deprecated: Use `windows_system_processes` instead.
+# TYPE windows_os_processes gauge
 # HELP windows_os_processes_limit Deprecated: Use `windows_system_process_limit` instead.
 # TYPE windows_os_processes_limit gauge
 # HELP windows_os_time Deprecated: Use windows_time_current_timestamp_seconds instead.