You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by wu...@apache.org on 2026/09/29 14:57:42 UTC
(skywalking) branch fix/windows-host-metrics created (now dbe2d54b08)
This is an automated email from the ASF dual-hosted git repository.
wu-sheng pushed a change to branch fix/windows-host-metrics
in repository https://gitbox.apache.org/repos/asf/skywalking.git
at dbe2d54b08 Fix Windows memory metrics on windows_exporter 0.31.0+, and CPU total counting overlapping modes
This branch includes the following new commits:
new dbe2d54b08 Fix Windows memory metrics on windows_exporter 0.31.0+, and CPU total counting overlapping modes
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
(skywalking) 01/01: Fix Windows memory metrics on windows_exporter 0.31.0+, and CPU total counting overlapping modes
Posted by wu...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
wu-sheng pushed a commit to branch fix/windows-host-metrics
in repository https://gitbox.apache.org/repos/asf/skywalking.git
commit dbe2d54b08aefc250e8781a0b04b297fc9bf520f
Author: Wu Sheng <wu...@foxmail.com>
AuthorDate: Tue Sep 29 22:57:21 2026 +0800
Fix Windows memory metrics on windows_exporter 0.31.0+, and CPU total counting overlapping modes
windows_exporter 0.31.0 removed the `cs` collector and the deprecated `os`
memory metrics windows.yaml read, so memory total/available/used and the
commit metrics were empty on current exporters. Read the `memory`
collector's replacements instead; windows_exporter 0.29.0 or later is now
required.
Windows CPU modes overlap: windows_exporter's `privileged` includes
`interrupt` and `dpc`, and the Collector's `system` includes `interrupt`.
cpu_total_percentage summed every non-idle mode and counted that time
twice; it now sums user + privileged / user + system.
The otel-hostmetrics e2e replays growing system.cpu.time counters so
rate() runs on real increases, and both Windows e2e cases assert exact
values. Also correct the process-hostmetrics comment on the scale of
process.memory.utilization, and the Telegraf row in the Linux metrics
table.
---
docs/en/changes/changes.md | 1 +
docs/en/setup/backend/backend-vm-monitoring.md | 2 +-
docs/en/setup/backend/backend-win-monitoring.md | 6 +--
.../process-hostmetrics-linux.data.yaml | 8 ++--
.../process-hostmetrics-windows.data.yaml | 8 ++--
.../scripts/mal/test-otel-rules/windows.data.yaml | 46 ++++++++++++++++------
.../otel-rules/process-hostmetrics-linux.yaml | 8 ++--
.../otel-rules/process-hostmetrics-windows.yaml | 8 ++--
.../src/main/resources/otel-rules/windows.yaml | 28 +++++++------
.../vm/otel-hostmetrics/assert-collector-output.sh | 37 ++++++++++++-----
.../cases/vm/otel-hostmetrics/docker-compose.yml | 12 +++++-
test/e2e-v2/cases/vm/otel-hostmetrics/e2e.yaml | 25 +++++++++++-
.../expected/win-commit-percentage-50.yml} | 26 +++++++-----
.../otel-hostmetrics/expected/win-cpu-cores-4.yml} | 26 +++++++-----
.../expected/win-cpu-load1-50.yml} | 26 +++++++-----
.../otel-hostmetrics/expected/win-cpu-norm-20.yml} | 26 +++++++-----
.../expected/win-cpu-total-80.yml} | 26 +++++++-----
.../expected/win-filehandles-45000.yml} | 26 +++++++-----
.../expected/win-filesystem-percentage-60.yml} | 26 +++++++-----
.../expected/win-memory-used-5368709120.yml} | 26 +++++++-----
.../expected/win-pagefile-percentage-25.yml} | 26 +++++++-----
.../vm/otel-hostmetrics/fixtures/windows-host.json | 2 +-
.../otel-rules/process-hostmetrics-linux.yaml | 8 ++--
.../otel-rules/process-hostmetrics-windows.yaml | 8 ++--
.../vm/otel-hostmetrics/otel-rules/windows.yaml | 28 +++++++------
.../commit-limit-8838758400.yml} | 26 +++++++-----
.../commit-percentage-50.yml} | 26 +++++++-----
.../memory-total-4294967296.yml} | 26 +++++++-----
.../memory-used-3221225472.yml} | 26 +++++++-----
.../cases/win/mock-data/otel-mock-metrics.json | 40 ++++++++++++++++++-
test/e2e-v2/cases/win/win-cases.yaml | 8 +++-
31 files changed, 426 insertions(+), 195 deletions(-)
diff --git a/docs/en/changes/changes.md b/docs/en/changes/changes.md
index 6e0d39842b..3b5c4be39f 100644
--- a/docs/en/changes/changes.md
+++ b/docs/en/changes/changes.md
@@ -28,6 +28,7 @@
* Bring the TraceQL module closer to the Tempo API. Every datasource lists only the spans that matched a search in each span set, capped at `spss`, fills `serviceStats`, filters `span.http.status_code`, honours `scope` and the per-scope `limit` on the tag endpoints, whose `intrinsic` scope lists what each datasource can filter, accepts Tempo's unscoped `.key` tag names on the tag-value endpoints, and answers a tag-name or tag-value lookup filtered by `q` from a sample of the newest 50 ma [...]
* Refuse unsupported TraceQL with `400` instead of dropping the predicate and answering with unfiltered traces: syntax errors (`||` inside a spanset, regex, an attribute without a scope or leading dot), `!=` and other unsupported operators, negation, attribute-existence checks, multiple spansets, unknown intrinsics and values, and conditions a datasource cannot filter (`kind` on Zipkin and SkyWalking, `resource.instance` on Zipkin, `resource.remote.service` and `status = unset` on SkyWal [...]
* Support the OpenTelemetry Collector `hostmetrics` receiver as an alternative source for Linux and Windows host monitoring. `vm.yaml` and `windows.yaml` map it to the same `meter_vm_*` / `meter_win_*` metrics as node-exporter and windows_exporter, whose metrics keep their meaning, and add metrics only hostmetrics provides: CPU core count and normalized CPU usage, plus CPU load, file-system usage, system handle count and pagefile usage on Windows. node-exporter metrics without a matching [...]
+* Windows monitoring through windows_exporter now requires windows_exporter `0.29.0` or later. windows_exporter `0.31.0` removed the `cs` collector and the deprecated `os` memory metrics (`windows_cs_physical_memory_bytes`, `windows_os_physical_memory_free_bytes`, `windows_os_virtual_memory_bytes`, `windows_os_virtual_memory_free_bytes`) that `windows.yaml` read, so on `0.31.0`+ `meter_win_memory_total` / `_available` / `_used` and the `meter_win_memory_virtual_memory_*` commit metrics w [...]
* AI agent conversations adopt AI Sessionizer `130601c`. Calls to MCP servers: the `execution` kind the Sessionizer's Claude Code plugin writes, `streams/<stream>/execution-<stamp>-<seq>.sd`, is stored like any other file; the document lists every `execution/1` record under `tool_executions`, joined to its step by tool-use id and kept once by its own id, a tool step names its records under `executions`, and a call to an MCP server carries `mcp_server` and `mcp_tool` in its `attrs`. The n [...]
* Fix the Elasticsearch `BulkProcessor` treating a bulk write as fully successful whenever the overall HTTP status was 200, even when Elasticsearch rejected individual items in the same response, for example a 429 `cluster_block_exception` when an index is switched to `read_only_allow_delete` by the flood-stage disk watermark. The response body's `errors` flag and per-item `status`/`error` are now decoded and checked on every 200 response; a rejected request's future now completes except [...]
diff --git a/docs/en/setup/backend/backend-vm-monitoring.md b/docs/en/setup/backend/backend-vm-monitoring.md
index 621548c08e..3e6b39312c 100644
--- a/docs/en/setup/backend/backend-vm-monitoring.md
+++ b/docs/en/setup/backend/backend-vm-monitoring.md
@@ -59,7 +59,7 @@ Likewise, `meter_vm_tcp_alloc`, `meter_vm_sockets_used`, and `meter_vm_udp_inuse
| TCP Established / Close-Wait | count | `meter_vm_tcp_curr_estab` | TCP connections in ESTABLISHED or CLOSE-WAIT state | Yes | Yes | Yes |
| TCP Time Wait | count | `meter_vm_tcp_tw` | TCP connections in TIME-WAIT state | Yes | Yes | Yes |
| TCP Allocated | count | `meter_vm_tcp_alloc` | Allocated TCP sockets | Yes | No | Yes |
-| Sockets Used | count | `meter_vm_sockets_used` | Kernel sockets currently in use | Yes | No | Yes |
+| Sockets Used | count | `meter_vm_sockets_used` | Kernel sockets currently in use | Yes | No | — |
| UDP In Use | count | `meter_vm_udp_inuse` | UDP sockets currently in use | Yes | No | Yes |
| Filefd Allocated | count | `meter_vm_filefd_allocated` | Host-level allocated file descriptors from Linux `/proc/sys/fs/file-nr` | Yes | No | — |
diff --git a/docs/en/setup/backend/backend-win-monitoring.md b/docs/en/setup/backend/backend-win-monitoring.md
index c4c901c5c5..52dce576ee 100644
--- a/docs/en/setup/backend/backend-win-monitoring.md
+++ b/docs/en/setup/backend/backend-win-monitoring.md
@@ -9,7 +9,7 @@ Windows entity as a `Service` in OAP and on the `Layer: OS_WINDOWS`.
3. The SkyWalking OAP Server parses the expression with [MAL](../../concepts-and-designs/mal.md) to filter/calculate/aggregate and store the results.
## Setup
**For OpenTelemetry receiver:**
-1. Setup [Prometheus windows_exporter](https://github.com/prometheus-community/windows_exporter).
+1. Setup [Prometheus windows_exporter](https://github.com/prometheus-community/windows_exporter) `0.29.0` or later, with the default `cpu`, `memory`, `logical_disk` and `net` collectors. The memory metrics are read from the `memory` collector; windows_exporter `0.31.0` removed the `cs` collector and the `os` memory metrics older SkyWalking releases read.
2. Setup [OpenTelemetry Collector ](https://opentelemetry.io/docs/collector/). This is an example for OpenTelemetry Collector configuration [otel-collector-config.yaml](../../../../test/e2e-v2/cases/win/prometheus-windows_exporter/otel-collector-config.yaml).
3. Config SkyWalking [OpenTelemetry receiver](opentelemetry-receiver.md).
@@ -29,8 +29,8 @@ The `OTel hostmetrics` column below refers to the complete OpenTelemetry Collect
| Monitoring Panel | Unit | Metric Name | Description | windows_exporter | OTel hostmetrics |
|---|---|---|---|:---:|:---:|
-| CPU Usage | % | `meter_win_cpu_total_percentage` | Total CPU usage across all logical CPUs | Yes | Yes |
-| CPU Average Used | % | `meter_win_cpu_average_used` | CPU usage by mode/state | Yes | Yes |
+| CPU Usage | % | `meter_win_cpu_total_percentage` | Busy CPU across all logical CPUs: `user` + `privileged` (windows_exporter) or `user` + `system` (OTel) | Yes | Yes |
+| CPU Average Used | % | `meter_win_cpu_average_used` | CPU usage by mode/state, summed across logical CPUs. Windows modes overlap: `privileged` (windows_exporter) includes `interrupt` and `dpc` time, and `system` (OTel) includes `interrupt` time | Yes | Yes |
| CPU Cores | count | `meter_win_cpu_cores_num` | Number of logical CPUs | — | Yes |
| Normalized CPU Usage | % | `meter_win_cpu_norm_percentage` | CPU usage normalized by the number of logical CPUs | — | Yes |
| CPU Load | | `meter_win_cpu_load1`<br />`meter_win_cpu_load5`<br />`meter_win_cpu_load15` | CPU load metrics exposed by the Collector hostmetrics load scraper | — | Yes |
diff --git a/oap-server/analyzer/meter-analyzer-scripts-test/src/test/resources/scripts/mal/test-otel-rules/process-hostmetrics-linux.data.yaml b/oap-server/analyzer/meter-analyzer-scripts-test/src/test/resources/scripts/mal/test-otel-rules/process-hostmetrics-linux.data.yaml
index 6f3457dcee..d2a4fcc0db 100644
--- a/oap-server/analyzer/meter-analyzer-scripts-test/src/test/resources/scripts/mal/test-otel-rules/process-hostmetrics-linux.data.yaml
+++ b/oap-server/analyzer/meter-analyzer-scripts-test/src/test/resources/scripts/mal/test-otel-rules/process-hostmetrics-linux.data.yaml
@@ -62,11 +62,11 @@ input:
value: 3000.0
process_memory_utilization:
- labels: {node_identifier_host_name: test-host, process_name: java}
- value: 0.01
+ value: 1.0
- labels: {node_identifier_host_name: test-host, process_name: java}
- value: 0.02
+ value: 2.0
- labels: {node_identifier_host_name: test-host, process_name: java}
- value: 0.03
+ value: 3.0
process_open_handles:
- labels: {node_identifier_host_name: test-host, process_name: java}
value: 5.0
@@ -110,7 +110,7 @@ expected:
mp_process_linux_memory_resident_percent:
samples:
- labels: {node_identifier_host_name: test-host, process_name: java}
- value: 6.0
+ value: 600.0
mp_process_linux_open_handles:
samples:
- labels: {node_identifier_host_name: test-host, process_name: java}
diff --git a/oap-server/analyzer/meter-analyzer-scripts-test/src/test/resources/scripts/mal/test-otel-rules/process-hostmetrics-windows.data.yaml b/oap-server/analyzer/meter-analyzer-scripts-test/src/test/resources/scripts/mal/test-otel-rules/process-hostmetrics-windows.data.yaml
index 62864d7c7e..ed5158ec98 100644
--- a/oap-server/analyzer/meter-analyzer-scripts-test/src/test/resources/scripts/mal/test-otel-rules/process-hostmetrics-windows.data.yaml
+++ b/oap-server/analyzer/meter-analyzer-scripts-test/src/test/resources/scripts/mal/test-otel-rules/process-hostmetrics-windows.data.yaml
@@ -62,11 +62,11 @@ input:
value: 3000.0
process_memory_utilization:
- labels: {node_identifier_host_name: test-host, process_name: svchost.exe}
- value: 0.01
+ value: 1.0
- labels: {node_identifier_host_name: test-host, process_name: svchost.exe}
- value: 0.02
+ value: 2.0
- labels: {node_identifier_host_name: test-host, process_name: svchost.exe}
- value: 0.03
+ value: 3.0
process_open_handles:
- labels: {node_identifier_host_name: test-host, process_name: svchost.exe}
value: 5.0
@@ -110,7 +110,7 @@ expected:
mp_process_windows_memory_resident_percent:
samples:
- labels: {node_identifier_host_name: test-host, process_name: svchost.exe}
- value: 6.0
+ value: 600.0
mp_process_windows_open_handles:
samples:
- labels: {node_identifier_host_name: test-host, process_name: svchost.exe}
diff --git a/oap-server/analyzer/meter-analyzer-scripts-test/src/test/resources/scripts/mal/test-otel-rules/windows.data.yaml b/oap-server/analyzer/meter-analyzer-scripts-test/src/test/resources/scripts/mal/test-otel-rules/windows.data.yaml
index f90570bec5..f373fcdf46 100644
--- a/oap-server/analyzer/meter-analyzer-scripts-test/src/test/resources/scripts/mal/test-otel-rules/windows.data.yaml
+++ b/oap-server/analyzer/meter-analyzer-scripts-test/src/test/resources/scripts/mal/test-otel-rules/windows.data.yaml
@@ -20,6 +20,22 @@ input:
node_identifier_host_name: test-host
mode: user
value: 100.0
+ - labels:
+ node_identifier_host_name: test-host
+ mode: privileged
+ value: 40.0
+ - labels:
+ node_identifier_host_name: test-host
+ mode: interrupt
+ value: 8.0
+ - labels:
+ node_identifier_host_name: test-host
+ mode: dpc
+ value: 4.0
+ - labels:
+ node_identifier_host_name: test-host
+ mode: idle
+ value: 200.0
# Native OpenTelemetry hostmetrics contract after Collector normalization.
# Values are fixed for deterministic MAL assertions.
system_cpu_logical_count:
@@ -81,18 +97,18 @@ input:
device: 'C:\\pagefile.sys'
state: free
value: 70.0
- windows_cs_physical_memory_bytes:
+ windows_memory_physical_total_bytes:
- labels:
value: 100.0
- windows_os_physical_memory_free_bytes:
+ windows_memory_physical_free_bytes:
- labels:
- value: 100.0
- windows_os_virtual_memory_free_bytes:
+ value: 40.0
+ windows_memory_commit_limit:
- labels:
value: 100.0
- windows_os_virtual_memory_bytes:
+ windows_memory_committed_bytes:
- labels:
- value: 100.0
+ value: 40.0
windows_logical_disk_read_bytes_total:
- labels:
node_identifier_host_name: test-host
@@ -118,13 +134,21 @@ expected:
samples:
- labels:
node_identifier_host_name: test-host
- value: 3500.0
+ value: 4300.0
meter_win_cpu_average_used:
entities:
- scope: SERVICE
service: test-host
layer: OS_WINDOWS
samples:
+ - labels:
+ node_identifier_host_name: test-host
+ mode: idle
+ value: 6500.0
+ - labels:
+ node_identifier_host_name: test-host
+ mode: interrupt
+ value: 400.0
- labels:
node_identifier_host_name: test-host
mode: user
@@ -142,21 +166,21 @@ expected:
layer: OS_WINDOWS
samples:
- labels:
- value: 100.0
+ value: 40.0
meter_win_memory_used:
entities:
- scope: SERVICE
layer: OS_WINDOWS
samples:
- labels:
- value: 0.0
+ value: 60.0
meter_win_memory_virtual_memory_free:
entities:
- scope: SERVICE
layer: OS_WINDOWS
samples:
- labels:
- value: 100.0
+ value: 60.0
meter_win_memory_virtual_memory_total:
entities:
- scope: SERVICE
@@ -170,7 +194,7 @@ expected:
layer: OS_WINDOWS
samples:
- labels:
- value: -0.0
+ value: 40.0
meter_win_disk_read:
entities:
- scope: SERVICE
diff --git a/oap-server/server-starter/src/main/resources/otel-rules/process-hostmetrics-linux.yaml b/oap-server/server-starter/src/main/resources/otel-rules/process-hostmetrics-linux.yaml
index 71356da371..8a84c00955 100644
--- a/oap-server/server-starter/src/main/resources/otel-rules/process-hostmetrics-linux.yaml
+++ b/oap-server/server-starter/src/main/resources/otel-rules/process-hostmetrics-linux.yaml
@@ -67,10 +67,10 @@ metricsRules:
- name: memory_resident_bytes
exp: "process_memory_usage.sum(['node_identifier_host_name','process_name'])"
- # process.memory.utilization is emitted as a [0,1] fraction. Multiply by
- # 100 before SkyWalking fixed-point storage to preserve two decimal places
- # of percentage precision (basis points). UI expressions must divide the
- # stored metric by 100.
+ # process.memory.utilization is emitted as a percentage (0-100): the
+ # Collector records gopsutil's MemoryPercent, despite the metric's unit "1".
+ # Multiply by 100 before SkyWalking's integer storage to keep two decimal
+ # places (basis points). UI expressions must divide the stored metric by 100.
- name: memory_resident_percent
exp: >
process_memory_utilization
diff --git a/oap-server/server-starter/src/main/resources/otel-rules/process-hostmetrics-windows.yaml b/oap-server/server-starter/src/main/resources/otel-rules/process-hostmetrics-windows.yaml
index bde9f5b735..86657630e6 100644
--- a/oap-server/server-starter/src/main/resources/otel-rules/process-hostmetrics-windows.yaml
+++ b/oap-server/server-starter/src/main/resources/otel-rules/process-hostmetrics-windows.yaml
@@ -67,10 +67,10 @@ metricsRules:
- name: memory_resident_bytes
exp: "process_memory_usage.sum(['node_identifier_host_name','process_name'])"
- # process.memory.utilization is emitted as a [0,1] fraction. Multiply by
- # 100 before SkyWalking fixed-point storage to preserve two decimal places
- # of percentage precision (basis points). UI expressions must divide the
- # stored metric by 100.
+ # process.memory.utilization is emitted as a percentage (0-100): the
+ # Collector records gopsutil's MemoryPercent, despite the metric's unit "1".
+ # Multiply by 100 before SkyWalking's integer storage to keep two decimal
+ # places (basis points). UI expressions must divide the stored metric by 100.
- name: memory_resident_percent
exp: >
process_memory_utilization
diff --git a/oap-server/server-starter/src/main/resources/otel-rules/windows.yaml b/oap-server/server-starter/src/main/resources/otel-rules/windows.yaml
index c7ad4a4d22..f071c12807 100644
--- a/oap-server/server-starter/src/main/resources/otel-rules/windows.yaml
+++ b/oap-server/server-starter/src/main/resources/otel-rules/windows.yaml
@@ -29,15 +29,18 @@ metricsRules:
# ---------------------------------------------------------------------------
# CPU
+ # Windows modes overlap: windows_exporter's `privileged` already includes
+ # `interrupt` and `dpc` time, and hostmetrics' `system` already includes
+ # `interrupt` time. Busy CPU is therefore user + privileged/system only.
- name: cpu_total_percentage
exp: >
(windows_cpu_time_total * 100)
- .tagNotEqual('mode','idle')
+ .tagMatch('mode','^(user|privileged)$')
.sum(['node_identifier_host_name'])
.rate('PT1M')
+
(system_cpu_time * 100)
- .tagNotEqual('mode','idle')
+ .tagMatch('mode','^(user|system)$')
.sum(['node_identifier_host_name'])
.rate('PT1M')
@@ -51,16 +54,18 @@ metricsRules:
.sum(['node_identifier_host_name','mode'])
.rate('PT1M')
- # Physical memory
+ # Physical memory. The windows_exporter branch reads the `memory` collector
+ # (windows_exporter 0.29.0+); 0.31.0 removed the `cs` collector and the
+ # `os` memory metrics this rule used before.
- name: memory_total
exp: >
- windows_cs_physical_memory_bytes
+ windows_memory_physical_total_bytes
+
system_memory_limit.sum(['node_identifier_host_name'])
- name: memory_available
exp: >
- windows_os_physical_memory_free_bytes
+ windows_memory_physical_free_bytes
+
system_memory_usage
.tagEqual('state','free')
@@ -68,7 +73,7 @@ metricsRules:
- name: memory_used
exp: >
- (windows_cs_physical_memory_bytes - windows_os_physical_memory_free_bytes)
+ (windows_memory_physical_total_bytes - windows_memory_physical_free_bytes)
+
(
system_memory_limit.sum(['node_identifier_host_name'])
@@ -76,13 +81,14 @@ metricsRules:
system_memory_usage.tagEqual('state','free').sum(['node_identifier_host_name'])
)
- # Canonical virtual memory semantics.
- # The hostmetrics branch uses Windows Performance Counters:
+ # Canonical virtual memory semantics: the commit limit and committed bytes.
+ # windows_exporter reads them from its `memory` collector; the hostmetrics
+ # branch uses Windows Performance Counters:
# Memory\\Commit Limit
# Memory\\Committed Bytes
- name: memory_virtual_memory_free
exp: >
- windows_os_virtual_memory_free_bytes
+ (windows_memory_commit_limit - windows_memory_committed_bytes)
+
(
system_virtual_memory_commit_limit.sum(['node_identifier_host_name'])
@@ -92,14 +98,14 @@ metricsRules:
- name: memory_virtual_memory_total
exp: >
- windows_os_virtual_memory_bytes
+ windows_memory_commit_limit
+
system_virtual_memory_commit_limit.sum(['node_identifier_host_name'])
- name: memory_virtual_memory_percentage
exp: >
(
- 100 - ((windows_os_virtual_memory_free_bytes * 100) / windows_os_virtual_memory_bytes)
+ windows_memory_committed_bytes * 100 / windows_memory_commit_limit
)
+
(
diff --git a/test/e2e-v2/cases/vm/otel-hostmetrics/assert-collector-output.sh b/test/e2e-v2/cases/vm/otel-hostmetrics/assert-collector-output.sh
index 9e0b4c8ad3..8e1cdb773d 100755
--- a/test/e2e-v2/cases/vm/otel-hostmetrics/assert-collector-output.sh
+++ b/test/e2e-v2/cases/vm/otel-hostmetrics/assert-collector-output.sh
@@ -105,21 +105,38 @@ END {
# ---------------------------------------------------------------------------
# Windows host normalization:
-# native system.cpu.time state -> canonical mode.
+# native system.cpu.time state -> canonical mode, for all four
+# Windows states. Other host metrics keep their state attribute, so the
+# check is scoped to the CPU metric block.
# ---------------------------------------------------------------------------
-grep -q -- '-> Name: system.cpu.time' \
- "${TMPDIR}/windows-host.log"
+awk '
+/-> Name: / {
+ in_cpu = ($0 ~ /-> Name: system\.cpu\.time[[:space:]]*$/)
+ if (in_cpu) {
+ seen = 1
+ }
+ next
+}
-grep -q -- '-> mode: Str(idle)' \
- "${TMPDIR}/windows-host.log"
+in_cpu && /-> state:/ {
+ bad = 1
+}
-grep -q -- '-> mode: Str(user)' \
- "${TMPDIR}/windows-host.log"
+in_cpu && /-> mode: Str\((user|system|interrupt|idle)\)/ {
+ match($0, /Str\([a-z]+\)/)
+ modes[substr($0, RSTART + 4, RLENGTH - 5)] = 1
+}
-if grep -q -- '-> state:' "${TMPDIR}/windows-host.log"; then
- echo "Windows system.cpu.time still contains state attribute" >&2
+END {
+ if (!seen || bad) {
+ exit 1
+ }
+ exit(("user" in modes) && ("system" in modes) && ("interrupt" in modes) && ("idle" in modes) ? 0 : 1)
+}
+' "${TMPDIR}/windows-host.log" || {
+ echo "Windows system.cpu.time state was not normalized to mode" >&2
exit 1
-fi
+}
# ---------------------------------------------------------------------------
diff --git a/test/e2e-v2/cases/vm/otel-hostmetrics/docker-compose.yml b/test/e2e-v2/cases/vm/otel-hostmetrics/docker-compose.yml
index 88168a2965..6c826cc829 100644
--- a/test/e2e-v2/cases/vm/otel-hostmetrics/docker-compose.yml
+++ b/test/e2e-v2/cases/vm/otel-hostmetrics/docker-compose.yml
@@ -53,14 +53,22 @@ services:
- ./fixtures:/fixtures:ro
networks:
- e2e
+ # windows-host.json carries cumulative system.cpu.time placeholders
+ # (900000001.0 user, 900000002.0 system, 900000003.0 interrupt,
+ # 900000004.0 idle). Each replay sets them from the clock: per second,
+ # user +0.5, system +0.3, interrupt +0.05 (already inside system) and
+ # idle +3.2 CPU-seconds on 4 logical CPUs, so OAP's rate() yields 80% busy
+ # CPU and 20% normalized CPU.
command:
- sh
- -c
- |
while true; do
- TS="$$(date +%s)000000000"
+ NOW="$$(date +%s)"
+ TS="$${NOW}000000000"
+ CPU="$$(awk -v t="$${NOW}" 'BEGIN { printf "s/900000001[.]0/%.1f/g;s/900000002[.]0/%.1f/g;s/900000003[.]0/%.2f/g;s/900000004[.]0/%.1f/g", t*0.5, t*0.3, t*0.05, t*3.2 }')"
echo "Replaying Windows OTLP fixtures timestamp=$${TS}"
- sed "s/1788474000000000000/$${TS}/g" \
+ sed -e "s/1788474000000000000/$${TS}/g" -e "$${CPU}" \
/fixtures/windows-host.json \
| curl -sS \
-o /dev/null \
diff --git a/test/e2e-v2/cases/vm/otel-hostmetrics/e2e.yaml b/test/e2e-v2/cases/vm/otel-hostmetrics/e2e.yaml
index bb3c28839b..9aa86b5de3 100644
--- a/test/e2e-v2/cases/vm/otel-hostmetrics/e2e.yaml
+++ b/test/e2e-v2/cases/vm/otel-hostmetrics/e2e.yaml
@@ -73,7 +73,30 @@ verify:
# Synthetic native-Windows OTLP fixtures are normalized by Collector 0.158
# and then consumed by the production Windows MAL rules.
- query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression=meter_win_cpu_cores_num --service-name=win-fixture
- expected: ../expected/metrics-has-value.yml
+ expected: expected/win-cpu-cores-4.yml
+
+ # CPU from system.cpu.time on 4 logical CPUs. The replay grows user by 0.5,
+ # system by 0.3 and interrupt by 0.05 CPU-seconds per second; `system`
+ # already includes interrupt time, so busy CPU is 80% and normalized 20%.
+ - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression=meter_win_cpu_total_percentage --service-name=win-fixture
+ expected: expected/win-cpu-total-80.yml
+ - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression=meter_win_cpu_norm_percentage --service-name=win-fixture
+ expected: expected/win-cpu-norm-20.yml
+
+ # Memory, commit, pagefile, filesystem, handles and load: exact values the
+ # fixture's fixed gauges produce.
+ - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression=meter_win_memory_used --service-name=win-fixture
+ expected: expected/win-memory-used-5368709120.yml
+ - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression=meter_win_memory_virtual_memory_percentage --service-name=win-fixture
+ expected: expected/win-commit-percentage-50.yml
+ - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression=meter_win_memory_pagefile_percentage --service-name=win-fixture
+ expected: expected/win-pagefile-percentage-25.yml
+ - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression="aggregate_labels(meter_win_filesystem_percentage,avg)" --service-name=win-fixture
+ expected: expected/win-filesystem-percentage-60.yml
+ - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression=meter_win_filehandles_allocated --service-name=win-fixture
+ expected: expected/win-filehandles-45000.yml
+ - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression=meter_win_cpu_load1 --service-name=win-fixture
+ expected: expected/win-cpu-load1-50.yml
- query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression=mp_process_windows_num_procs --service-name=win-fixture --instance-name=svchost.exe
expected: ../expected/metrics-has-value.yml
diff --git a/test/e2e-v2/cases/win/win-cases.yaml b/test/e2e-v2/cases/vm/otel-hostmetrics/expected/win-commit-percentage-50.yml
similarity index 53%
copy from test/e2e-v2/cases/win/win-cases.yaml
copy to test/e2e-v2/cases/vm/otel-hostmetrics/expected/win-commit-percentage-50.yml
index ebfd25223e..34f6c30e3e 100644
--- a/test/e2e-v2/cases/win/win-cases.yaml
+++ b/test/e2e-v2/cases/vm/otel-hostmetrics/expected/win-commit-percentage-50.yml
@@ -1,9 +1,9 @@
# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
+# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You 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
+# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
@@ -13,10 +13,18 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-# This file is used to show how to write configuration files and can be used to test.
-
-cases:
- - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql service ls
- expected: expected/service.yml
- - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression=meter_win_memory_virtual_memory_total --service-name=10.211.55.3
- expected: expected/metrics-has-value.yml
+debuggingtrace: null
+type: TIME_SERIES_VALUES
+results:
+ {{- contains .results }}
+ - metric:
+ labels: []
+ values:
+ {{- contains .values }}
+ - id: {{ notEmpty .id }}
+ value: 50
+ owner: null
+ traceid: null
+ {{- end}}
+ {{- end}}
+error: null
diff --git a/test/e2e-v2/cases/win/win-cases.yaml b/test/e2e-v2/cases/vm/otel-hostmetrics/expected/win-cpu-cores-4.yml
similarity index 53%
copy from test/e2e-v2/cases/win/win-cases.yaml
copy to test/e2e-v2/cases/vm/otel-hostmetrics/expected/win-cpu-cores-4.yml
index ebfd25223e..9f8ffd7592 100644
--- a/test/e2e-v2/cases/win/win-cases.yaml
+++ b/test/e2e-v2/cases/vm/otel-hostmetrics/expected/win-cpu-cores-4.yml
@@ -1,9 +1,9 @@
# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
+# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You 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
+# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
@@ -13,10 +13,18 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-# This file is used to show how to write configuration files and can be used to test.
-
-cases:
- - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql service ls
- expected: expected/service.yml
- - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression=meter_win_memory_virtual_memory_total --service-name=10.211.55.3
- expected: expected/metrics-has-value.yml
+debuggingtrace: null
+type: TIME_SERIES_VALUES
+results:
+ {{- contains .results }}
+ - metric:
+ labels: []
+ values:
+ {{- contains .values }}
+ - id: {{ notEmpty .id }}
+ value: 4
+ owner: null
+ traceid: null
+ {{- end}}
+ {{- end}}
+error: null
diff --git a/test/e2e-v2/cases/win/win-cases.yaml b/test/e2e-v2/cases/vm/otel-hostmetrics/expected/win-cpu-load1-50.yml
similarity index 53%
copy from test/e2e-v2/cases/win/win-cases.yaml
copy to test/e2e-v2/cases/vm/otel-hostmetrics/expected/win-cpu-load1-50.yml
index ebfd25223e..34f6c30e3e 100644
--- a/test/e2e-v2/cases/win/win-cases.yaml
+++ b/test/e2e-v2/cases/vm/otel-hostmetrics/expected/win-cpu-load1-50.yml
@@ -1,9 +1,9 @@
# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
+# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You 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
+# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
@@ -13,10 +13,18 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-# This file is used to show how to write configuration files and can be used to test.
-
-cases:
- - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql service ls
- expected: expected/service.yml
- - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression=meter_win_memory_virtual_memory_total --service-name=10.211.55.3
- expected: expected/metrics-has-value.yml
+debuggingtrace: null
+type: TIME_SERIES_VALUES
+results:
+ {{- contains .results }}
+ - metric:
+ labels: []
+ values:
+ {{- contains .values }}
+ - id: {{ notEmpty .id }}
+ value: 50
+ owner: null
+ traceid: null
+ {{- end}}
+ {{- end}}
+error: null
diff --git a/test/e2e-v2/cases/win/win-cases.yaml b/test/e2e-v2/cases/vm/otel-hostmetrics/expected/win-cpu-norm-20.yml
similarity index 53%
copy from test/e2e-v2/cases/win/win-cases.yaml
copy to test/e2e-v2/cases/vm/otel-hostmetrics/expected/win-cpu-norm-20.yml
index ebfd25223e..c78042b2bf 100644
--- a/test/e2e-v2/cases/win/win-cases.yaml
+++ b/test/e2e-v2/cases/vm/otel-hostmetrics/expected/win-cpu-norm-20.yml
@@ -1,9 +1,9 @@
# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
+# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You 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
+# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
@@ -13,10 +13,18 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-# This file is used to show how to write configuration files and can be used to test.
-
-cases:
- - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql service ls
- expected: expected/service.yml
- - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression=meter_win_memory_virtual_memory_total --service-name=10.211.55.3
- expected: expected/metrics-has-value.yml
+debuggingtrace: null
+type: TIME_SERIES_VALUES
+results:
+ {{- contains .results }}
+ - metric:
+ labels: []
+ values:
+ {{- contains .values }}
+ - id: {{ notEmpty .id }}
+ value: 20
+ owner: null
+ traceid: null
+ {{- end}}
+ {{- end}}
+error: null
diff --git a/test/e2e-v2/cases/win/win-cases.yaml b/test/e2e-v2/cases/vm/otel-hostmetrics/expected/win-cpu-total-80.yml
similarity index 53%
copy from test/e2e-v2/cases/win/win-cases.yaml
copy to test/e2e-v2/cases/vm/otel-hostmetrics/expected/win-cpu-total-80.yml
index ebfd25223e..7fe0a1d2aa 100644
--- a/test/e2e-v2/cases/win/win-cases.yaml
+++ b/test/e2e-v2/cases/vm/otel-hostmetrics/expected/win-cpu-total-80.yml
@@ -1,9 +1,9 @@
# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
+# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You 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
+# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
@@ -13,10 +13,18 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-# This file is used to show how to write configuration files and can be used to test.
-
-cases:
- - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql service ls
- expected: expected/service.yml
- - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression=meter_win_memory_virtual_memory_total --service-name=10.211.55.3
- expected: expected/metrics-has-value.yml
+debuggingtrace: null
+type: TIME_SERIES_VALUES
+results:
+ {{- contains .results }}
+ - metric:
+ labels: []
+ values:
+ {{- contains .values }}
+ - id: {{ notEmpty .id }}
+ value: 80
+ owner: null
+ traceid: null
+ {{- end}}
+ {{- end}}
+error: null
diff --git a/test/e2e-v2/cases/win/win-cases.yaml b/test/e2e-v2/cases/vm/otel-hostmetrics/expected/win-filehandles-45000.yml
similarity index 53%
copy from test/e2e-v2/cases/win/win-cases.yaml
copy to test/e2e-v2/cases/vm/otel-hostmetrics/expected/win-filehandles-45000.yml
index ebfd25223e..934d2225b9 100644
--- a/test/e2e-v2/cases/win/win-cases.yaml
+++ b/test/e2e-v2/cases/vm/otel-hostmetrics/expected/win-filehandles-45000.yml
@@ -1,9 +1,9 @@
# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
+# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You 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
+# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
@@ -13,10 +13,18 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-# This file is used to show how to write configuration files and can be used to test.
-
-cases:
- - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql service ls
- expected: expected/service.yml
- - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression=meter_win_memory_virtual_memory_total --service-name=10.211.55.3
- expected: expected/metrics-has-value.yml
+debuggingtrace: null
+type: TIME_SERIES_VALUES
+results:
+ {{- contains .results }}
+ - metric:
+ labels: []
+ values:
+ {{- contains .values }}
+ - id: {{ notEmpty .id }}
+ value: 45000
+ owner: null
+ traceid: null
+ {{- end}}
+ {{- end}}
+error: null
diff --git a/test/e2e-v2/cases/win/win-cases.yaml b/test/e2e-v2/cases/vm/otel-hostmetrics/expected/win-filesystem-percentage-60.yml
similarity index 53%
copy from test/e2e-v2/cases/win/win-cases.yaml
copy to test/e2e-v2/cases/vm/otel-hostmetrics/expected/win-filesystem-percentage-60.yml
index ebfd25223e..da31428400 100644
--- a/test/e2e-v2/cases/win/win-cases.yaml
+++ b/test/e2e-v2/cases/vm/otel-hostmetrics/expected/win-filesystem-percentage-60.yml
@@ -1,9 +1,9 @@
# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
+# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You 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
+# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
@@ -13,10 +13,18 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-# This file is used to show how to write configuration files and can be used to test.
-
-cases:
- - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql service ls
- expected: expected/service.yml
- - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression=meter_win_memory_virtual_memory_total --service-name=10.211.55.3
- expected: expected/metrics-has-value.yml
+debuggingtrace: null
+type: TIME_SERIES_VALUES
+results:
+ {{- contains .results }}
+ - metric:
+ labels: []
+ values:
+ {{- contains .values }}
+ - id: {{ notEmpty .id }}
+ value: 60
+ owner: null
+ traceid: null
+ {{- end}}
+ {{- end}}
+error: null
diff --git a/test/e2e-v2/cases/win/win-cases.yaml b/test/e2e-v2/cases/vm/otel-hostmetrics/expected/win-memory-used-5368709120.yml
similarity index 53%
copy from test/e2e-v2/cases/win/win-cases.yaml
copy to test/e2e-v2/cases/vm/otel-hostmetrics/expected/win-memory-used-5368709120.yml
index ebfd25223e..8d522919bf 100644
--- a/test/e2e-v2/cases/win/win-cases.yaml
+++ b/test/e2e-v2/cases/vm/otel-hostmetrics/expected/win-memory-used-5368709120.yml
@@ -1,9 +1,9 @@
# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
+# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You 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
+# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
@@ -13,10 +13,18 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-# This file is used to show how to write configuration files and can be used to test.
-
-cases:
- - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql service ls
- expected: expected/service.yml
- - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression=meter_win_memory_virtual_memory_total --service-name=10.211.55.3
- expected: expected/metrics-has-value.yml
+debuggingtrace: null
+type: TIME_SERIES_VALUES
+results:
+ {{- contains .results }}
+ - metric:
+ labels: []
+ values:
+ {{- contains .values }}
+ - id: {{ notEmpty .id }}
+ value: 5368709120
+ owner: null
+ traceid: null
+ {{- end}}
+ {{- end}}
+error: null
diff --git a/test/e2e-v2/cases/win/win-cases.yaml b/test/e2e-v2/cases/vm/otel-hostmetrics/expected/win-pagefile-percentage-25.yml
similarity index 53%
copy from test/e2e-v2/cases/win/win-cases.yaml
copy to test/e2e-v2/cases/vm/otel-hostmetrics/expected/win-pagefile-percentage-25.yml
index ebfd25223e..d74025d15a 100644
--- a/test/e2e-v2/cases/win/win-cases.yaml
+++ b/test/e2e-v2/cases/vm/otel-hostmetrics/expected/win-pagefile-percentage-25.yml
@@ -1,9 +1,9 @@
# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
+# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You 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
+# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
@@ -13,10 +13,18 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-# This file is used to show how to write configuration files and can be used to test.
-
-cases:
- - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql service ls
- expected: expected/service.yml
- - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression=meter_win_memory_virtual_memory_total --service-name=10.211.55.3
- expected: expected/metrics-has-value.yml
+debuggingtrace: null
+type: TIME_SERIES_VALUES
+results:
+ {{- contains .results }}
+ - metric:
+ labels: []
+ values:
+ {{- contains .values }}
+ - id: {{ notEmpty .id }}
+ value: 25
+ owner: null
+ traceid: null
+ {{- end}}
+ {{- end}}
+error: null
diff --git a/test/e2e-v2/cases/vm/otel-hostmetrics/fixtures/windows-host.json b/test/e2e-v2/cases/vm/otel-hostmetrics/fixtures/windows-host.json
index 048391f899..6f66ed3fdc 100644
--- a/test/e2e-v2/cases/vm/otel-hostmetrics/fixtures/windows-host.json
+++ b/test/e2e-v2/cases/vm/otel-hostmetrics/fixtures/windows-host.json
@@ -1 +1 @@
-{"resourceMetrics":[{"resource":{"attributes":[{"key":"host.name","value":{"stringValue":"win-fixture"}}]},"scopeMetrics":[{"scope":{"name":"windows-host-fixture"},"metrics":[{"name":"system.cpu.logical.count","unit":"{cpu}","gauge":{"dataPoints":[{"timeUnixNano":"1788474000000000000","asInt":"4"}]}},{"name":"system.cpu.time","unit":"s","sum":{"dataPoints":[{"attributes":[{"key":"state","value":{"stringValue":"idle"}}],"timeUnixNano":"1788474000000000000","asDouble":100.0},{"attributes": [...]
+{"resourceMetrics":[{"resource":{"attributes":[{"key":"host.name","value":{"stringValue":"win-fixture"}}]},"scopeMetrics":[{"scope":{"name":"windows-host-fixture"},"metrics":[{"name":"system.cpu.logical.count","unit":"{cpu}","sum":{"dataPoints":[{"timeUnixNano":"1788474000000000000","asInt":"4"}],"aggregationTemporality":2,"isMonotonic":false}},{"name":"system.cpu.time","unit":"s","sum":{"dataPoints":[{"attributes":[{"key":"state","value":{"stringValue":"user"}}],"timeUnixNano":"17884740 [...]
diff --git a/test/e2e-v2/cases/vm/otel-hostmetrics/otel-rules/process-hostmetrics-linux.yaml b/test/e2e-v2/cases/vm/otel-hostmetrics/otel-rules/process-hostmetrics-linux.yaml
index 71356da371..8a84c00955 100644
--- a/test/e2e-v2/cases/vm/otel-hostmetrics/otel-rules/process-hostmetrics-linux.yaml
+++ b/test/e2e-v2/cases/vm/otel-hostmetrics/otel-rules/process-hostmetrics-linux.yaml
@@ -67,10 +67,10 @@ metricsRules:
- name: memory_resident_bytes
exp: "process_memory_usage.sum(['node_identifier_host_name','process_name'])"
- # process.memory.utilization is emitted as a [0,1] fraction. Multiply by
- # 100 before SkyWalking fixed-point storage to preserve two decimal places
- # of percentage precision (basis points). UI expressions must divide the
- # stored metric by 100.
+ # process.memory.utilization is emitted as a percentage (0-100): the
+ # Collector records gopsutil's MemoryPercent, despite the metric's unit "1".
+ # Multiply by 100 before SkyWalking's integer storage to keep two decimal
+ # places (basis points). UI expressions must divide the stored metric by 100.
- name: memory_resident_percent
exp: >
process_memory_utilization
diff --git a/test/e2e-v2/cases/vm/otel-hostmetrics/otel-rules/process-hostmetrics-windows.yaml b/test/e2e-v2/cases/vm/otel-hostmetrics/otel-rules/process-hostmetrics-windows.yaml
index bde9f5b735..86657630e6 100644
--- a/test/e2e-v2/cases/vm/otel-hostmetrics/otel-rules/process-hostmetrics-windows.yaml
+++ b/test/e2e-v2/cases/vm/otel-hostmetrics/otel-rules/process-hostmetrics-windows.yaml
@@ -67,10 +67,10 @@ metricsRules:
- name: memory_resident_bytes
exp: "process_memory_usage.sum(['node_identifier_host_name','process_name'])"
- # process.memory.utilization is emitted as a [0,1] fraction. Multiply by
- # 100 before SkyWalking fixed-point storage to preserve two decimal places
- # of percentage precision (basis points). UI expressions must divide the
- # stored metric by 100.
+ # process.memory.utilization is emitted as a percentage (0-100): the
+ # Collector records gopsutil's MemoryPercent, despite the metric's unit "1".
+ # Multiply by 100 before SkyWalking's integer storage to keep two decimal
+ # places (basis points). UI expressions must divide the stored metric by 100.
- name: memory_resident_percent
exp: >
process_memory_utilization
diff --git a/test/e2e-v2/cases/vm/otel-hostmetrics/otel-rules/windows.yaml b/test/e2e-v2/cases/vm/otel-hostmetrics/otel-rules/windows.yaml
index c7ad4a4d22..f071c12807 100644
--- a/test/e2e-v2/cases/vm/otel-hostmetrics/otel-rules/windows.yaml
+++ b/test/e2e-v2/cases/vm/otel-hostmetrics/otel-rules/windows.yaml
@@ -29,15 +29,18 @@ metricsRules:
# ---------------------------------------------------------------------------
# CPU
+ # Windows modes overlap: windows_exporter's `privileged` already includes
+ # `interrupt` and `dpc` time, and hostmetrics' `system` already includes
+ # `interrupt` time. Busy CPU is therefore user + privileged/system only.
- name: cpu_total_percentage
exp: >
(windows_cpu_time_total * 100)
- .tagNotEqual('mode','idle')
+ .tagMatch('mode','^(user|privileged)$')
.sum(['node_identifier_host_name'])
.rate('PT1M')
+
(system_cpu_time * 100)
- .tagNotEqual('mode','idle')
+ .tagMatch('mode','^(user|system)$')
.sum(['node_identifier_host_name'])
.rate('PT1M')
@@ -51,16 +54,18 @@ metricsRules:
.sum(['node_identifier_host_name','mode'])
.rate('PT1M')
- # Physical memory
+ # Physical memory. The windows_exporter branch reads the `memory` collector
+ # (windows_exporter 0.29.0+); 0.31.0 removed the `cs` collector and the
+ # `os` memory metrics this rule used before.
- name: memory_total
exp: >
- windows_cs_physical_memory_bytes
+ windows_memory_physical_total_bytes
+
system_memory_limit.sum(['node_identifier_host_name'])
- name: memory_available
exp: >
- windows_os_physical_memory_free_bytes
+ windows_memory_physical_free_bytes
+
system_memory_usage
.tagEqual('state','free')
@@ -68,7 +73,7 @@ metricsRules:
- name: memory_used
exp: >
- (windows_cs_physical_memory_bytes - windows_os_physical_memory_free_bytes)
+ (windows_memory_physical_total_bytes - windows_memory_physical_free_bytes)
+
(
system_memory_limit.sum(['node_identifier_host_name'])
@@ -76,13 +81,14 @@ metricsRules:
system_memory_usage.tagEqual('state','free').sum(['node_identifier_host_name'])
)
- # Canonical virtual memory semantics.
- # The hostmetrics branch uses Windows Performance Counters:
+ # Canonical virtual memory semantics: the commit limit and committed bytes.
+ # windows_exporter reads them from its `memory` collector; the hostmetrics
+ # branch uses Windows Performance Counters:
# Memory\\Commit Limit
# Memory\\Committed Bytes
- name: memory_virtual_memory_free
exp: >
- windows_os_virtual_memory_free_bytes
+ (windows_memory_commit_limit - windows_memory_committed_bytes)
+
(
system_virtual_memory_commit_limit.sum(['node_identifier_host_name'])
@@ -92,14 +98,14 @@ metricsRules:
- name: memory_virtual_memory_total
exp: >
- windows_os_virtual_memory_bytes
+ windows_memory_commit_limit
+
system_virtual_memory_commit_limit.sum(['node_identifier_host_name'])
- name: memory_virtual_memory_percentage
exp: >
(
- 100 - ((windows_os_virtual_memory_free_bytes * 100) / windows_os_virtual_memory_bytes)
+ windows_memory_committed_bytes * 100 / windows_memory_commit_limit
)
+
(
diff --git a/test/e2e-v2/cases/win/win-cases.yaml b/test/e2e-v2/cases/win/expected/commit-limit-8838758400.yml
similarity index 53%
copy from test/e2e-v2/cases/win/win-cases.yaml
copy to test/e2e-v2/cases/win/expected/commit-limit-8838758400.yml
index ebfd25223e..a5169b5dc6 100644
--- a/test/e2e-v2/cases/win/win-cases.yaml
+++ b/test/e2e-v2/cases/win/expected/commit-limit-8838758400.yml
@@ -1,9 +1,9 @@
# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
+# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You 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
+# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
@@ -13,10 +13,18 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-# This file is used to show how to write configuration files and can be used to test.
-
-cases:
- - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql service ls
- expected: expected/service.yml
- - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression=meter_win_memory_virtual_memory_total --service-name=10.211.55.3
- expected: expected/metrics-has-value.yml
+debuggingtrace: null
+type: TIME_SERIES_VALUES
+results:
+ {{- contains .results }}
+ - metric:
+ labels: []
+ values:
+ {{- contains .values }}
+ - id: {{ notEmpty .id }}
+ value: 8838758400
+ owner: null
+ traceid: null
+ {{- end}}
+ {{- end}}
+error: null
diff --git a/test/e2e-v2/cases/win/win-cases.yaml b/test/e2e-v2/cases/win/expected/commit-percentage-50.yml
similarity index 53%
copy from test/e2e-v2/cases/win/win-cases.yaml
copy to test/e2e-v2/cases/win/expected/commit-percentage-50.yml
index ebfd25223e..34f6c30e3e 100644
--- a/test/e2e-v2/cases/win/win-cases.yaml
+++ b/test/e2e-v2/cases/win/expected/commit-percentage-50.yml
@@ -1,9 +1,9 @@
# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
+# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You 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
+# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
@@ -13,10 +13,18 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-# This file is used to show how to write configuration files and can be used to test.
-
-cases:
- - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql service ls
- expected: expected/service.yml
- - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression=meter_win_memory_virtual_memory_total --service-name=10.211.55.3
- expected: expected/metrics-has-value.yml
+debuggingtrace: null
+type: TIME_SERIES_VALUES
+results:
+ {{- contains .results }}
+ - metric:
+ labels: []
+ values:
+ {{- contains .values }}
+ - id: {{ notEmpty .id }}
+ value: 50
+ owner: null
+ traceid: null
+ {{- end}}
+ {{- end}}
+error: null
diff --git a/test/e2e-v2/cases/win/win-cases.yaml b/test/e2e-v2/cases/win/expected/memory-total-4294967296.yml
similarity index 53%
copy from test/e2e-v2/cases/win/win-cases.yaml
copy to test/e2e-v2/cases/win/expected/memory-total-4294967296.yml
index ebfd25223e..d2c12f7f42 100644
--- a/test/e2e-v2/cases/win/win-cases.yaml
+++ b/test/e2e-v2/cases/win/expected/memory-total-4294967296.yml
@@ -1,9 +1,9 @@
# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
+# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You 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
+# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
@@ -13,10 +13,18 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-# This file is used to show how to write configuration files and can be used to test.
-
-cases:
- - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql service ls
- expected: expected/service.yml
- - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression=meter_win_memory_virtual_memory_total --service-name=10.211.55.3
- expected: expected/metrics-has-value.yml
+debuggingtrace: null
+type: TIME_SERIES_VALUES
+results:
+ {{- contains .results }}
+ - metric:
+ labels: []
+ values:
+ {{- contains .values }}
+ - id: {{ notEmpty .id }}
+ value: 4294967296
+ owner: null
+ traceid: null
+ {{- end}}
+ {{- end}}
+error: null
diff --git a/test/e2e-v2/cases/win/win-cases.yaml b/test/e2e-v2/cases/win/expected/memory-used-3221225472.yml
similarity index 53%
copy from test/e2e-v2/cases/win/win-cases.yaml
copy to test/e2e-v2/cases/win/expected/memory-used-3221225472.yml
index ebfd25223e..d42257bdaa 100644
--- a/test/e2e-v2/cases/win/win-cases.yaml
+++ b/test/e2e-v2/cases/win/expected/memory-used-3221225472.yml
@@ -1,9 +1,9 @@
# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
+# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You 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
+# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
@@ -13,10 +13,18 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-# This file is used to show how to write configuration files and can be used to test.
-
-cases:
- - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql service ls
- expected: expected/service.yml
- - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression=meter_win_memory_virtual_memory_total --service-name=10.211.55.3
- expected: expected/metrics-has-value.yml
+debuggingtrace: null
+type: TIME_SERIES_VALUES
+results:
+ {{- contains .results }}
+ - metric:
+ labels: []
+ values:
+ {{- contains .values }}
+ - id: {{ notEmpty .id }}
+ value: 3221225472
+ owner: null
+ traceid: null
+ {{- end}}
+ {{- end}}
+error: null
diff --git a/test/e2e-v2/cases/win/mock-data/otel-mock-metrics.json b/test/e2e-v2/cases/win/mock-data/otel-mock-metrics.json
index 4cb9c82d67..bc30304c05 100644
--- a/test/e2e-v2/cases/win/mock-data/otel-mock-metrics.json
+++ b/test/e2e-v2/cases/win/mock-data/otel-mock-metrics.json
@@ -123,8 +123,8 @@
"scope": {},
"metrics": [
{
- "name": "windows_os_virtual_memory_bytes",
- "description": "OperatingSystem.TotalVirtualMemorySize",
+ "name": "windows_memory_commit_limit",
+ "description": "Amount of virtual memory, in bytes, that can be committed without having to extend the paging file(s)",
"gauge": {
"dataPoints": [
{
@@ -134,6 +134,42 @@
]
}
},
+ {
+ "name": "windows_memory_committed_bytes",
+ "description": "Amount of committed virtual memory, in bytes",
+ "gauge": {
+ "dataPoints": [
+ {
+ "timeUnixNano": "1676140375004000000",
+ "asDouble": 4.4193792E9
+ }
+ ]
+ }
+ },
+ {
+ "name": "windows_memory_physical_total_bytes",
+ "description": "Total bytes of physical memory available to the operating system",
+ "gauge": {
+ "dataPoints": [
+ {
+ "timeUnixNano": "1676140375004000000",
+ "asDouble": 4.294967296E9
+ }
+ ]
+ }
+ },
+ {
+ "name": "windows_memory_physical_free_bytes",
+ "description": "Bytes of physical memory currently unused and available",
+ "gauge": {
+ "dataPoints": [
+ {
+ "timeUnixNano": "1676140375004000000",
+ "asDouble": 1.073741824E9
+ }
+ ]
+ }
+ },
{
"name": "windows_logical_disk_write_seconds_total",
"description": "Seconds that the disk was busy servicing write requests (LogicalDisk.PercentDiskWriteTime)",
diff --git a/test/e2e-v2/cases/win/win-cases.yaml b/test/e2e-v2/cases/win/win-cases.yaml
index ebfd25223e..422c4e8c65 100644
--- a/test/e2e-v2/cases/win/win-cases.yaml
+++ b/test/e2e-v2/cases/win/win-cases.yaml
@@ -18,5 +18,11 @@
cases:
- query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql service ls
expected: expected/service.yml
+ - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression=meter_win_memory_total --service-name=10.211.55.3
+ expected: expected/memory-total-4294967296.yml
+ - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression=meter_win_memory_used --service-name=10.211.55.3
+ expected: expected/memory-used-3221225472.yml
- query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression=meter_win_memory_virtual_memory_total --service-name=10.211.55.3
- expected: expected/metrics-has-value.yml
+ expected: expected/commit-limit-8838758400.yml
+ - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression=meter_win_memory_virtual_memory_percentage --service-name=10.211.55.3
+ expected: expected/commit-percentage-50.yml