performancecounter: Add the possibility to request formatted values (#1830)

This commit is contained in:
Jan-Otto Kröpke
2025-01-14 23:32:44 +01:00
committed by GitHub
parent 4cd9627ebf
commit 86e6d12518
80 changed files with 354 additions and 132 deletions

View File

@@ -59,6 +59,7 @@ YAML:
state: idle
- name: memory
object: "Memory"
type: "formatted"
counters:
- name: "Cache Faults/sec"
type: "counter" # optional
@@ -98,6 +99,7 @@ YAML:
{
"name": "memory",
"object": "Memory",
"type": "formatted",
"counters": [
{
"name": "Cache Faults/sec",
@@ -120,6 +122,33 @@ ObjectName is the Object to query for, like Processor, DirectoryServices, Logica
The collector supports only english named counter. Localized counter-names are not supported.
#### type
The counter-type. The value can be `raw` or `formatted`. Optional and defaults to `raw`.
- `raw` returns the raw value of the counter. This is the default.
- `formatted` returns the formatted value of the counter. This is useful for counters like `Processor Information` where the value is a percentage.
The difference between a raw Windows Performance Counter and a formatted Windows Performance Counter is about how the data is presented and processed:
1. Raw Windows Performance Counter:
This provides the counter's data in its basic, unprocessed form.
The values may represent cumulative counts, time intervals, or other uncalibrated metrics.
Interpreting these values often requires more calculations or context, such as calculating deltas or normalizing values over time.
2. Formatted Windows Performance Counter:
This presents data that has already been processed and interpreted according to the counter type (e.g., rates per second, averages, percentages).
Formatted counters are easier to understand directly since the necessary calculations have been applied.
These are often what monitoring tools display to users because they are meaningful at a glance.
For example:
* A raw counter for CPU time might give the total number of clock ticks used since the system started.
* A formatted counter would convert this into a percentage of CPU utilization over a specific time interval.
#### instances
The instances key (this is an array) declares the instances of a counter you would like returned, it can be one or more values.