-
Couldn't load subscription status.
- Fork 753
Description
Current Behavior
I am experiencing some issues using performance counters for multiple w3wp processes.
This issue was reporter to alloy but I can replicate it using the latest version of windows_exporter.
I configured a windows machine using windows server 2019. On this machine I configured 3 sites in IIS each using it's own application pool running this:
<%@ Page Language="C#" %>
<!DOCTYPE html>
<html>
<body>
<h1> ASP.NET </h1>
<%
var data = new byte[5 * 1024 * 1024];
Response.Write("Allocated: " + data.Length + " Time: " + DateTime.Now);
%>
</body>
</html>
I checked the counter in windows and selected Process ID and #Bytes in all Heaps and can see them there correctly
I then started the exporter with this config
collectors:
enabled: performancecounter
collector:
performancecounter:
objects:
- name: netclrmemory
object: ".NET CLR Memory"
instances: ["w3wp*"]
counters:
- name: "# Bytes in all Heaps"
- name: "Process ID"
log:
level: debugI expected performance counter to collecto metrics for all running w3wp procsees (w3wp, w3wp#1 and w3wp#2) but instead I only got metrics from the last one but with incorrect instance name
# HELP windows_performancecounter_net_clr_memory__bytes_in_all_heaps windows_exporter: custom Performance Counter metric
# TYPE windows_performancecounter_net_clr_memory__bytes_in_all_heaps gauge
windows_performancecounter_net_clr_memory__bytes_in_all_heaps{instance="w3wp"} 1.466048e+06
# HELP windows_performancecounter_net_clr_memory_process_id windows_exporter: custom Performance Counter metric
# TYPE windows_performancecounter_net_clr_memory_process_id gauge
windows_performancecounter_net_clr_memory_process_id{instance="w3wp"} 5108
process_id and bytes_in_all_heaps matches the third process running (w3wp#2).
I also tried manually specifying all instances
collectors:
enabled: performancecounter
collector:
performancecounter:
objects:
- name: netclrmemory
object: ".NET CLR Memory"
instances: ["w3wp", "w3wp#1", "w3wp#2"]
counters:
- name: "# Bytes in all Heaps"
- name: "Process ID"
log:
level: debugBut I still only got merics for the last one, same result as when using w3wp*.
Just selecting e.g w3wp#1 works but instance name is set to w.
Expected Behavior
I expect performance counters to be collected for all instances specified, both then specifying all instances or when using the wildcard.
Environment
- windows_exporter Version: 0.31.3
- Windows Server Version: Windows server 2019
windows_exporter logs
PS C:\Program Files\windows_exporter> .\windows_exporter.exe --config.file="config.yaml"
time=2025-10-01T01:27:27.731-07:00 level=DEBUG source=main.go:150 msg="logging has started"
time=2025-10-01T01:27:27.733-07:00 level=INFO source=main.go:153 msg="using configuration file: config.yaml"
time=2025-10-01T01:27:27.849-07:00 level=INFO source=main.go:277 msg="running as WIN-8C66HGU3PJH\\Administrator"
time=2025-10-01T01:27:27.851-07:00 level=INFO source=main.go:280 msg="enabled collectors: performancecounter"
time=2025-10-01T01:27:27.852-07:00 level=INFO source=main.go:288 msg="starting windows_exporter in 122.0525ms" version=0.31.3 branch=HEAD revision=fcf21bb0008579edab438661ae88320c7f27386 goversion=go1.25.1 builddate=20250906-06:52:57 maxprocs=1
time=2025-10-01T01:27:27.853-07:00 level=INFO source=tls_config.go:347 msg="listening on" address=[::]:9182
time=2025-10-01T01:27:27.854-07:00 level=INFO source=tls_config.go:358 msg="TLS is disabled." http2=false address=[::]:9182
time=2025-10-01T01:27:29.293-07:00 level=DEBUG source=performancecounter.go:268 msg="performancecounter collector netclrmemory succeeded after 0s" collector=performancecounter
time=2025-10-01T01:27:29.301-07:00 level=DEBUG source=collect.go:233 msg="collector performancecounter succeeded after 8.4091ms, resulting in 4 metrics"Anything else?
No response