Skip to content

Commit 3b13ed9

Browse files
committed
Add ASP.NET Core memory pool metrics
1 parent 15ff0ab commit 3b13ed9

File tree

5 files changed

+187
-0
lines changed

5 files changed

+187
-0
lines changed

.chloggen/2532.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
change_type: enhancement
2+
component: aspnetcore
3+
note: Add ASP.NET Core memory pool metrics and update the registry.
4+
issues: [2532]

docs/dotnet/dotnet-aspnetcore-metrics.md

Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@ This article defines semantic conventions for ASP.NET Core metrics.
2121
- [Metric: `aspnetcore.rate_limiting.queued_requests`](#metric-aspnetcorerate_limitingqueued_requests)
2222
- [Metric: `aspnetcore.rate_limiting.request.time_in_queue`](#metric-aspnetcorerate_limitingrequesttime_in_queue)
2323
- [Metric: `aspnetcore.rate_limiting.requests`](#metric-aspnetcorerate_limitingrequests)
24+
- [Memory pool](#memory-pool)
25+
- [Metric: `aspnetcore.memory_pool.pooled`](#metric-aspnetcorememory_poolpooled)
26+
- [Metric: `aspnetcore.memory_pool.evicted`](#metric-aspnetcorememory_poolevicted)
27+
- [Metric: `aspnetcore.memory_pool.allocated`](#metric-aspnetcorememory_poolallocated)
28+
- [Metric: `aspnetcore.memory_pool.rented`](#metric-aspnetcorememory_poolrented)
2429

2530
<!-- tocstop -->
2631

@@ -310,4 +315,112 @@ Meter name: `Microsoft.AspNetCore.RateLimiting`; Added in: ASP.NET Core 8.0
310315
<!-- END AUTOGENERATED TEXT -->
311316
<!-- endsemconv -->
312317

318+
## Memory pool
319+
320+
All memory pool metrics are reported by the `Microsoft.AspNetCore.MemoryPool` meter.
321+
322+
### Metric: `aspnetcore.memory_pool.pooled`
323+
324+
<!-- semconv metric.aspnetcore.memory_pool.pooled -->
325+
<!-- NOTE: THIS TEXT IS AUTOGENERATED. DO NOT EDIT BY HAND. -->
326+
<!-- see templates/registry/markdown/snippet.md.j2 -->
327+
<!-- prettier-ignore-start -->
328+
<!-- markdownlint-capture -->
329+
<!-- markdownlint-disable -->
330+
331+
| Name | Instrument Type | Unit (UCUM) | Description | Stability | Entity Associations |
332+
| -------- | --------------- | ----------- | -------------- | --------- | ------ |
333+
| `aspnetcore.memory_pool.pooled` | UpDownCounter | `By` | Number of bytes currently pooled and available for reuse. [1] | ![Development](https://img.shields.io/badge/-development-blue) | |
334+
335+
**[1]:** Meter name: `Microsoft.AspNetCore.MemoryPool`; Added in: ASP.NET Core 10.0
336+
337+
| Attribute | Type | Description | Examples | [Requirement Level](https://opentelemetry.io/docs/specs/semconv/general/attribute-requirement-level/) | Stability |
338+
|---|---|---|---|---|---|
339+
| [`aspnetcore.memory_pool.owner`](/docs/registry/attributes/aspnetcore.md) | string | The name of the library or subsystem using the memory pool instance. | `kestrel`; `iis` | `Conditionally Required` [1] | ![Development](https://img.shields.io/badge/-development-blue) |
340+
341+
**[1] `aspnetcore.memory_pool.owner`:** if owner is specified when the memory pool is created.
342+
343+
<!-- markdownlint-restore -->
344+
<!-- prettier-ignore-end -->
345+
<!-- END AUTOGENERATED TEXT -->
346+
<!-- endsemconv -->
347+
348+
### Metric: `aspnetcore.memory_pool.evicted`
349+
350+
<!-- semconv metric.aspnetcore.memory_pool.evicted -->
351+
<!-- NOTE: THIS TEXT IS AUTOGENERATED. DO NOT EDIT BY HAND. -->
352+
<!-- see templates/registry/markdown/snippet.md.j2 -->
353+
<!-- prettier-ignore-start -->
354+
<!-- markdownlint-capture -->
355+
<!-- markdownlint-disable -->
356+
357+
| Name | Instrument Type | Unit (UCUM) | Description | Stability | Entity Associations |
358+
| -------- | --------------- | ----------- | -------------- | --------- | ------ |
359+
| `aspnetcore.memory_pool.evicted` | Counter | `By` | Total number of bytes evicted from the memory pool. Eviction occurs when idle pooled memory is reclaimed. [1] | ![Development](https://img.shields.io/badge/-development-blue) | |
360+
361+
**[1]:** Meter name: `Microsoft.AspNetCore.MemoryPool`; Added in: ASP.NET Core 10.0
362+
363+
| Attribute | Type | Description | Examples | [Requirement Level](https://opentelemetry.io/docs/specs/semconv/general/attribute-requirement-level/) | Stability |
364+
|---|---|---|---|---|---|
365+
| [`aspnetcore.memory_pool.owner`](/docs/registry/attributes/aspnetcore.md) | string | The name of the library or subsystem using the memory pool instance. | `kestrel`; `iis` | `Conditionally Required` [1] | ![Development](https://img.shields.io/badge/-development-blue) |
366+
367+
**[1] `aspnetcore.memory_pool.owner`:** if owner is specified when the memory pool is created.
368+
369+
<!-- markdownlint-restore -->
370+
<!-- prettier-ignore-end -->
371+
<!-- END AUTOGENERATED TEXT -->
372+
<!-- endsemconv -->
373+
374+
### Metric: `aspnetcore.memory_pool.allocated`
375+
376+
<!-- semconv metric.aspnetcore.memory_pool.allocated -->
377+
<!-- NOTE: THIS TEXT IS AUTOGENERATED. DO NOT EDIT BY HAND. -->
378+
<!-- see templates/registry/markdown/snippet.md.j2 -->
379+
<!-- prettier-ignore-start -->
380+
<!-- markdownlint-capture -->
381+
<!-- markdownlint-disable -->
382+
383+
| Name | Instrument Type | Unit (UCUM) | Description | Stability | Entity Associations |
384+
| -------- | --------------- | ----------- | -------------- | --------- | ------ |
385+
| `aspnetcore.memory_pool.allocated` | Counter | `By` | Total number of bytes allocated by the memory pool. Allocation occurs when a memory rental request exceeds the available pooled memory. [1] | ![Development](https://img.shields.io/badge/-development-blue) | |
386+
387+
**[1]:** Meter name: `Microsoft.AspNetCore.MemoryPool`; Added in: ASP.NET Core 10.0
388+
389+
| Attribute | Type | Description | Examples | [Requirement Level](https://opentelemetry.io/docs/specs/semconv/general/attribute-requirement-level/) | Stability |
390+
|---|---|---|---|---|---|
391+
| [`aspnetcore.memory_pool.owner`](/docs/registry/attributes/aspnetcore.md) | string | The name of the library or subsystem using the memory pool instance. | `kestrel`; `iis` | `Conditionally Required` [1] | ![Development](https://img.shields.io/badge/-development-blue) |
392+
393+
**[1] `aspnetcore.memory_pool.owner`:** if owner is specified when the memory pool is created.
394+
395+
<!-- markdownlint-restore -->
396+
<!-- prettier-ignore-end -->
397+
<!-- END AUTOGENERATED TEXT -->
398+
<!-- endsemconv -->
399+
400+
### Metric: `aspnetcore.memory_pool.rented`
401+
402+
<!-- semconv metric.aspnetcore.memory_pool.rented -->
403+
<!-- NOTE: THIS TEXT IS AUTOGENERATED. DO NOT EDIT BY HAND. -->
404+
<!-- see templates/registry/markdown/snippet.md.j2 -->
405+
<!-- prettier-ignore-start -->
406+
<!-- markdownlint-capture -->
407+
<!-- markdownlint-disable -->
408+
409+
| Name | Instrument Type | Unit (UCUM) | Description | Stability | Entity Associations |
410+
| -------- | --------------- | ----------- | -------------- | --------- | ------ |
411+
| `aspnetcore.memory_pool.rented` | Counter | `By` | Total number of bytes rented from the memory pool. [1] | ![Development](https://img.shields.io/badge/-development-blue) | |
412+
413+
**[1]:** Meter name: `Microsoft.AspNetCore.MemoryPool`; Added in: ASP.NET Core 10.0
414+
415+
| Attribute | Type | Description | Examples | [Requirement Level](https://opentelemetry.io/docs/specs/semconv/general/attribute-requirement-level/) | Stability |
416+
|---|---|---|---|---|---|
417+
| [`aspnetcore.memory_pool.owner`](/docs/registry/attributes/aspnetcore.md) | string | The name of the library or subsystem using the memory pool instance. | `kestrel`; `iis` | `Conditionally Required` [1] | ![Development](https://img.shields.io/badge/-development-blue) |
418+
419+
**[1] `aspnetcore.memory_pool.owner`:** if owner is specified when the memory pool is created.
420+
421+
<!-- markdownlint-restore -->
422+
<!-- prettier-ignore-end -->
423+
<!-- END AUTOGENERATED TEXT -->
424+
<!-- endsemconv -->
425+
313426
[DocumentStatus]: https://opentelemetry.io/docs/specs/otel/document-status

docs/registry/attributes/aspnetcore.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ ASP.NET Core attributes
1111
|---|---|---|---|---|
1212
| <a id="aspnetcore-diagnostics-exception-result" href="#aspnetcore-diagnostics-exception-result">`aspnetcore.diagnostics.exception.result`</a> | string | ASP.NET Core exception middleware handling result | `handled`; `unhandled` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) |
1313
| <a id="aspnetcore-diagnostics-handler-type" href="#aspnetcore-diagnostics-handler-type">`aspnetcore.diagnostics.handler.type`</a> | string | Full type name of the [`IExceptionHandler`](https://learn.microsoft.com/dotnet/api/microsoft.aspnetcore.diagnostics.iexceptionhandler) implementation that handled the exception. | `Contoso.MyHandler` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) |
14+
| <a id="aspnetcore-memory-pool-owner" href="#aspnetcore-memory-pool-owner">`aspnetcore.memory_pool.owner`</a> | string | The name of the library or subsystem using the memory pool instance. | `kestrel`; `iis` | ![Development](https://img.shields.io/badge/-development-blue) |
1415
| <a id="aspnetcore-rate-limiting-policy" href="#aspnetcore-rate-limiting-policy">`aspnetcore.rate_limiting.policy`</a> | string | Rate limiting policy name. | `fixed`; `sliding`; `token` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) |
1516
| <a id="aspnetcore-rate-limiting-result" href="#aspnetcore-rate-limiting-result">`aspnetcore.rate_limiting.result`</a> | string | Rate-limiting result, shows whether the lease was acquired or contains a rejection reason | `acquired`; `request_canceled` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) |
1617
| <a id="aspnetcore-request-is-unhandled" href="#aspnetcore-request-is-unhandled">`aspnetcore.request.is_unhandled`</a> | boolean | Flag indicating if request was handled by the application pipeline. | `true` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) |

model/aspnetcore/metrics.yaml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,13 @@ groups:
66
- ref: aspnetcore.rate_limiting.policy
77
requirement_level:
88
conditionally_required: if the matched endpoint for the request had a rate-limiting policy.
9+
- id: aspnetcore.common.memory_pool.metrics.attributes
10+
type: attribute_group
11+
brief: Common ASP.NET Core memory pool metrics attributes
12+
attributes:
13+
- ref: aspnetcore.memory_pool.owner
14+
requirement_level:
15+
conditionally_required: if owner is specified when the memory pool is created.
916

1017
# routing
1118
- id: metric.aspnetcore.routing.match_attempts
@@ -135,3 +142,60 @@ groups:
135142
attributes:
136143
- ref: aspnetcore.rate_limiting.result
137144
requirement_level: required
145+
146+
# memory_pool
147+
- id: metric.aspnetcore.memory_pool.pooled
148+
type: metric
149+
metric_name: aspnetcore.memory_pool.pooled
150+
annotations:
151+
code_generation:
152+
metric_value_type: int
153+
stability: development
154+
brief: Number of bytes currently pooled and available for reuse.
155+
instrument: updowncounter
156+
unit: "By"
157+
note: |
158+
Meter name: `Microsoft.AspNetCore.MemoryPool`; Added in: ASP.NET Core 10.0
159+
extends: aspnetcore.common.memory_pool.metrics.attributes
160+
161+
- id: metric.aspnetcore.memory_pool.allocated
162+
type: metric
163+
metric_name: aspnetcore.memory_pool.allocated
164+
annotations:
165+
code_generation:
166+
metric_value_type: int
167+
stability: development
168+
brief: Total number of bytes allocated by the memory pool. Allocation occurs when a memory rental request exceeds the available pooled memory.
169+
instrument: counter
170+
unit: "By"
171+
note: |
172+
Meter name: `Microsoft.AspNetCore.MemoryPool`; Added in: ASP.NET Core 10.0
173+
extends: aspnetcore.common.memory_pool.metrics.attributes
174+
175+
- id: metric.aspnetcore.memory_pool.evicted
176+
type: metric
177+
metric_name: aspnetcore.memory_pool.evicted
178+
annotations:
179+
code_generation:
180+
metric_value_type: int
181+
stability: development
182+
brief: Total number of bytes evicted from the memory pool. Eviction occurs when idle pooled memory is reclaimed.
183+
instrument: counter
184+
unit: "By"
185+
note: |
186+
Meter name: `Microsoft.AspNetCore.MemoryPool`; Added in: ASP.NET Core 10.0
187+
extends: aspnetcore.common.memory_pool.metrics.attributes
188+
189+
- id: metric.aspnetcore.memory_pool.rented
190+
type: metric
191+
metric_name: aspnetcore.memory_pool.rented
192+
annotations:
193+
code_generation:
194+
metric_value_type: int
195+
stability: development
196+
brief: Total number of bytes rented from the memory pool.
197+
instrument: counter
198+
unit: "By"
199+
note: |
200+
Meter name: `Microsoft.AspNetCore.MemoryPool`; Added in: ASP.NET Core 10.0
201+
extends: aspnetcore.common.memory_pool.metrics.attributes

model/aspnetcore/registry.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,3 +83,8 @@ groups:
8383
stability: stable
8484
brief: ASP.NET Core exception middleware handling result
8585
examples: ["handled", "unhandled"]
86+
- id: aspnetcore.memory_pool.owner
87+
type: string
88+
stability: development
89+
brief: The name of the library or subsystem using the memory pool instance.
90+
examples: ["kestrel", "iis"]

0 commit comments

Comments
 (0)