Skip to content

Commit 84e0b37

Browse files
authored
Adding support for versioned events and counters (#54)
- Added mechanism to support declaring the runtime version a set of counters or events can be used from - Added `net50` specific JIT counters - Updated documentation generator + exposed metrics documentation to reflect different metrics available on different runtimes
1 parent 7ef1d94 commit 84e0b37

File tree

20 files changed

+458
-165
lines changed

20 files changed

+458
-165
lines changed

docs/metrics-exposed-3.1.md

Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
# `.net 3.1` metrics
2+
3+
Each subheading details the metrics produced by calling builder methods with the specified `CaptureLevel`.
4+
5+
## Default metrics
6+
7+
Metrics that are included by default, regardless of what stats collectors are enabled.
8+
9+
| Name | Type | Description | Labels |
10+
| ------------------- | ------- | ------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- |
11+
| `dotnet_build_info` | `Gauge` | Build information about prometheus\-net.DotNetRuntime and the environment | `version`, `target_framework`, `runtime_version`, `os_version`, `process_architecture`, `gc_mode` |
12+
| `process_cpu_count` | `Gauge` | The number of processor cores available to this process. | |
13+
14+
## `.WithJitStats()`
15+
16+
Include metrics summarizing the volume of methods being compiled
17+
by the Just\-In\-Time compiler.
18+
19+
### `CaptureLevel.Verbose`
20+
21+
Includes metrics generated by `CaptureLevel.Counters` plus:
22+
23+
| Name | Type | Description | Labels |
24+
| --------------------------------- | --------- | ------------------------------------------------------------------------------------------------- | --------- |
25+
| `dotnet_jit_cpu_ratio` | `Gauge` | The amount of total CPU time consumed spent JIT'ing | |
26+
| `dotnet_jit_method_total` | `Counter` | Total number of methods compiled by the JIT compiler, broken down by compilation for dynamic code | `dynamic` |
27+
| `dotnet_jit_method_seconds_total` | `Counter` | Total number of seconds spent in the JIT compiler, broken down by compilation for dynamic code | `dynamic` |
28+
29+
## `.WithGcStats()`
30+
31+
Include metrics recording the frequency and duration of garbage collections\/ pauses, heap sizes and
32+
volume of allocations.
33+
34+
### `CaptureLevel.Counters`
35+
36+
| Name | Type | Description | Labels |
37+
| ---------------------------------------- | --------- | ---------------------------------------------------------------------------------------------- | --------------- |
38+
| `dotnet_gc_collection_count_total` | `Counter` | Counts the number of garbage collections that have occurred, broken down by generation number. | `gc_generation` |
39+
| `dotnet_gc_heap_size_bytes` | `Gauge` | The current size of all heaps (only updated after a garbage collection) | `gc_generation` |
40+
| `dotnet_gc_pause_ratio` | `Gauge` | The percentage of time the process spent paused for garbage collection | |
41+
| `dotnet_gc_memory_total_available_bytes` | `Gauge` | The upper limit on the amount of physical memory .NET can allocate to | |
42+
| `dotnet_gc_allocated_bytes_total` | `Counter` | The total number of bytes allocated on the managed heap | |
43+
44+
### `CaptureLevel.Informational`
45+
46+
Includes metrics generated by `CaptureLevel.Counters` plus:
47+
48+
| Name | Type | Description | Labels |
49+
| ------------------------------------- | ----------- | -------------------------------------------------------------------------------------------------------------------------------- | ---------------------------- |
50+
| `dotnet_gc_finalization_queue_length` | `Gauge` | The number of objects waiting to be finalized | |
51+
| `dotnet_gc_collection_count_total` | `Counter` | Counts the number of garbage collections that have occurred, broken down by generation number and the reason for the collection. | `gc_generation`, `gc_reason` |
52+
| `dotnet_gc_pause_seconds` | `Histogram` | The amount of time execution was paused for garbage collection | |
53+
| `dotnet_gc_cpu_ratio` | `Gauge` | The percentage of process CPU time spent running garbage collections | |
54+
| `dotnet_gc_collection_seconds` | `Histogram` | The amount of time spent running garbage collections | `gc_generation`, `gc_type` |
55+
| `dotnet_gc_pinned_objects` | `Gauge` | The number of pinned objects | |
56+
57+
### `CaptureLevel.Verbose`
58+
59+
Includes metrics generated by `CaptureLevel.Counters`, `CaptureLevel.Informational` plus:
60+
61+
| Name | Type | Description | Labels |
62+
| --------------------------------- | --------- | ------------------------------------------------------- | --------- |
63+
| `dotnet_gc_allocated_bytes_total` | `Counter` | The total number of bytes allocated on the managed heap | `gc_heap` |
64+
65+
## `.WithExceptionStats()`
66+
67+
Include metrics that measure the number of exceptions thrown.
68+
69+
### `CaptureLevel.Counters`
70+
71+
| Name | Type | Description | Labels |
72+
| ------------------------- | --------- | -------------------------- | ------ |
73+
| `dotnet_exceptions_total` | `Counter` | Count of exceptions thrown | |
74+
75+
### `CaptureLevel.Errors`
76+
77+
Includes metrics generated by `CaptureLevel.Counters` plus:
78+
79+
| Name | Type | Description | Labels |
80+
| ------------------------- | --------- | ----------------------------------------------- | ------ |
81+
| `dotnet_exceptions_total` | `Counter` | Count of exceptions thrown, broken down by type | `type` |
82+
83+
## `.WithContentionStats()`
84+
85+
Include metrics around volume of locks contended.
86+
87+
### `CaptureLevel.Counters`
88+
89+
| Name | Type | Description | Labels |
90+
| ------------------------- | --------- | ----------------------------- | ------ |
91+
| `dotnet_contention_total` | `Counter` | The number of locks contended | |
92+
93+
### `CaptureLevel.Informational`
94+
95+
Includes metrics generated by `CaptureLevel.Counters` plus:
96+
97+
| Name | Type | Description | Labels |
98+
| --------------------------------- | --------- | ----------------------------------------------- | ------ |
99+
| `dotnet_contention_seconds_total` | `Counter` | The total amount of time spent contending locks | |
100+
101+
## `.WithThreadPoolStats()`
102+
103+
Include metrics around the size of the worker and IO thread pools and reasons
104+
for worker thread pool changes.
105+
106+
### `CaptureLevel.Counters`
107+
108+
| Name | Type | Description | Labels |
109+
| ------------------------------------ | ----------- | ----------------------------------------------------------------------------------------------------------------------------- | ------ |
110+
| `dotnet_threadpool_timer_count` | `Gauge` | The number of timers active | |
111+
| `dotnet_threadpool_queue_length` | `Histogram` | Measures the queue length of the thread pool. Values greater than 0 indicate a backlog of work for the threadpool to process. | |
112+
| `dotnet_threadpool_throughput_total` | `Counter` | The total number of work items that have finished execution in the thread pool | |
113+
| `dotnet_threadpool_num_threads` | `Gauge` | The number of active threads in the thread pool | |
114+
115+
### `CaptureLevel.Informational`
116+
117+
Includes metrics generated by `CaptureLevel.Counters` plus:
118+
119+
| Name | Type | Description | Labels |
120+
| ------------------------------------- | --------- | ------------------------------------------------------------------------------------------------- | ------------------- |
121+
| `dotnet_threadpool_adjustments_total` | `Counter` | The total number of changes made to the size of the thread pool, labeled by the reason for change | `adjustment_reason` |
122+
| `dotnet_threadpool_io_num_threads` | `Gauge` | The number of active threads in the IO thread pool | |

docs/metrics-exposed-5.0.md

Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
# `.net 5.0` metrics
2+
3+
Each subheading details the metrics produced by calling builder methods with the specified `CaptureLevel`.
4+
5+
## Default metrics
6+
7+
Metrics that are included by default, regardless of what stats collectors are enabled.
8+
9+
| Name | Type | Description | Labels |
10+
| ------------------------------- | --------- | --------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- |
11+
| `dotnet_build_info` | `Gauge` | Build information about prometheus\-net.DotNetRuntime and the environment | `version`, `target_framework`, `runtime_version`, `os_version`, `process_architecture`, `gc_mode` |
12+
| `dotnet_internal_recycle_count` | `Counter` | prometheus\-net.DotNetRuntime internal metric. Counts the number of times the underlying event listeners have been recycled | |
13+
| `process_cpu_count` | `Gauge` | The number of processor cores available to this process. | |
14+
15+
## `.WithJitStats()`
16+
17+
Include metrics summarizing the volume of methods being compiled
18+
by the Just\-In\-Time compiler.
19+
20+
### `CaptureLevel.Counters`
21+
22+
| Name | Type | Description | Labels |
23+
| ------------------------- | --------- | ---------------------------------------------------- | ------ |
24+
| `dotnet_jit_il_bytes` | `Gauge` | Total bytes of IL compiled by the JIT compiler | |
25+
| `dotnet_jit_method_total` | `Counter` | Total number of methods compiled by the JIT compiler | |
26+
27+
### `CaptureLevel.Verbose`
28+
29+
Includes metrics generated by `CaptureLevel.Counters` plus:
30+
31+
| Name | Type | Description | Labels |
32+
| --------------------------------- | --------- | ------------------------------------------------------------------------------------------------- | --------- |
33+
| `dotnet_jit_cpu_ratio` | `Gauge` | The amount of total CPU time consumed spent JIT'ing | |
34+
| `dotnet_jit_method_total` | `Counter` | Total number of methods compiled by the JIT compiler, broken down by compilation for dynamic code | `dynamic` |
35+
| `dotnet_jit_method_seconds_total` | `Counter` | Total number of seconds spent in the JIT compiler, broken down by compilation for dynamic code | `dynamic` |
36+
37+
## `.WithGcStats()`
38+
39+
Include metrics recording the frequency and duration of garbage collections\/ pauses, heap sizes and
40+
volume of allocations.
41+
42+
### `CaptureLevel.Counters`
43+
44+
| Name | Type | Description | Labels |
45+
| ---------------------------------------- | --------- | ---------------------------------------------------------------------------------------------- | --------------- |
46+
| `dotnet_gc_allocated_bytes_total` | `Counter` | The total number of bytes allocated on the managed heap | |
47+
| `dotnet_gc_collection_count_total` | `Counter` | Counts the number of garbage collections that have occurred, broken down by generation number. | `gc_generation` |
48+
| `dotnet_gc_memory_total_available_bytes` | `Gauge` | The upper limit on the amount of physical memory .NET can allocate to | |
49+
| `dotnet_gc_pause_ratio` | `Gauge` | The percentage of time the process spent paused for garbage collection | |
50+
| `dotnet_gc_heap_size_bytes` | `Gauge` | The current size of all heaps (only updated after a garbage collection) | `gc_generation` |
51+
52+
### `CaptureLevel.Informational`
53+
54+
Includes metrics generated by `CaptureLevel.Counters` plus:
55+
56+
| Name | Type | Description | Labels |
57+
| ------------------------------------- | ----------- | -------------------------------------------------------------------------------------------------------------------------------- | ---------------------------- |
58+
| `dotnet_gc_pause_seconds` | `Histogram` | The amount of time execution was paused for garbage collection | |
59+
| `dotnet_gc_cpu_ratio` | `Gauge` | The percentage of process CPU time spent running garbage collections | |
60+
| `dotnet_gc_collection_count_total` | `Counter` | Counts the number of garbage collections that have occurred, broken down by generation number and the reason for the collection. | `gc_generation`, `gc_reason` |
61+
| `dotnet_gc_collection_seconds` | `Histogram` | The amount of time spent running garbage collections | `gc_generation`, `gc_type` |
62+
| `dotnet_gc_finalization_queue_length` | `Gauge` | The number of objects waiting to be finalized | |
63+
| `dotnet_gc_pinned_objects` | `Gauge` | The number of pinned objects | |
64+
65+
### `CaptureLevel.Verbose`
66+
67+
Includes metrics generated by `CaptureLevel.Counters`, `CaptureLevel.Informational` plus:
68+
69+
| Name | Type | Description | Labels |
70+
| --------------------------------- | --------- | ------------------------------------------------------- | --------- |
71+
| `dotnet_gc_allocated_bytes_total` | `Counter` | The total number of bytes allocated on the managed heap | `gc_heap` |
72+
73+
## `.WithExceptionStats()`
74+
75+
Include metrics that measure the number of exceptions thrown.
76+
77+
### `CaptureLevel.Counters`
78+
79+
| Name | Type | Description | Labels |
80+
| ------------------------- | --------- | -------------------------- | ------ |
81+
| `dotnet_exceptions_total` | `Counter` | Count of exceptions thrown | |
82+
83+
### `CaptureLevel.Errors`
84+
85+
Includes metrics generated by `CaptureLevel.Counters` plus:
86+
87+
| Name | Type | Description | Labels |
88+
| ------------------------- | --------- | ----------------------------------------------- | ------ |
89+
| `dotnet_exceptions_total` | `Counter` | Count of exceptions thrown, broken down by type | `type` |
90+
91+
## `.WithContentionStats()`
92+
93+
Include metrics around volume of locks contended.
94+
95+
### `CaptureLevel.Counters`
96+
97+
| Name | Type | Description | Labels |
98+
| ------------------------- | --------- | ----------------------------- | ------ |
99+
| `dotnet_contention_total` | `Counter` | The number of locks contended | |
100+
101+
### `CaptureLevel.Informational`
102+
103+
Includes metrics generated by `CaptureLevel.Counters` plus:
104+
105+
| Name | Type | Description | Labels |
106+
| --------------------------------- | --------- | ----------------------------------------------- | ------ |
107+
| `dotnet_contention_seconds_total` | `Counter` | The total amount of time spent contending locks | |
108+
109+
## `.WithThreadPoolStats()`
110+
111+
Include metrics around the size of the worker and IO thread pools and reasons
112+
for worker thread pool changes.
113+
114+
### `CaptureLevel.Counters`
115+
116+
| Name | Type | Description | Labels |
117+
| ------------------------------------ | ----------- | ----------------------------------------------------------------------------------------------------------------------------- | ------ |
118+
| `dotnet_threadpool_queue_length` | `Histogram` | Measures the queue length of the thread pool. Values greater than 0 indicate a backlog of work for the threadpool to process. | |
119+
| `dotnet_threadpool_timer_count` | `Gauge` | The number of timers active | |
120+
| `dotnet_threadpool_throughput_total` | `Counter` | The total number of work items that have finished execution in the thread pool | |
121+
| `dotnet_threadpool_num_threads` | `Gauge` | The number of active threads in the thread pool | |
122+
123+
### `CaptureLevel.Informational`
124+
125+
Includes metrics generated by `CaptureLevel.Counters` plus:
126+
127+
| Name | Type | Description | Labels |
128+
| ------------------------------------- | --------- | ------------------------------------------------------------------------------------------------- | ------------------- |
129+
| `dotnet_threadpool_io_num_threads` | `Gauge` | The number of active threads in the IO thread pool | |
130+
| `dotnet_threadpool_adjustments_total` | `Counter` | The total number of changes made to the size of the thread pool, labeled by the reason for change | `adjustment_reason` |

0 commit comments

Comments
 (0)