Skip to content

Commit 5cc3532

Browse files
JamesNKShipraJain01
authored andcommitted
Add ASP.NET Core memory pool metrics (open-telemetry#2533)
1 parent cb19636 commit 5cc3532

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
- [Identity](#identity)
2530
- [Metric: `aspnetcore.identity.user.create.duration`](#metric-aspnetcoreidentityusercreateduration)
2631
- [Metric: `aspnetcore.identity.user.update.duration`](#metric-aspnetcoreidentityuserupdateduration)
@@ -303,6 +308,114 @@ Meter name: `Microsoft.AspNetCore.RateLimiting`; Added in: ASP.NET Core 8.0
303308
<!-- END AUTOGENERATED TEXT -->
304309
<!-- endsemconv -->
305310

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

308421
All ASP.NET Core Identity metrics are reported by the `Microsoft.AspNetCore.Identity` meter.

docs/registry/attributes/aspnetcore.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ ASP.NET Core attributes
2121
| <a id="aspnetcore-identity-token-verified" href="#aspnetcore-identity-token-verified">`aspnetcore.identity.token_verified`</a> | string | The result of token verification. | `success`; `failure` | ![Development](https://img.shields.io/badge/-development-blue) |
2222
| <a id="aspnetcore-identity-user-update-type" href="#aspnetcore-identity-user-update-type">`aspnetcore.identity.user.update_type`</a> | string | The user update type. | `update`; `user_name`; `reset_password` | ![Development](https://img.shields.io/badge/-development-blue) |
2323
| <a id="aspnetcore-identity-user-type" href="#aspnetcore-identity-user-type">`aspnetcore.identity.user_type`</a> | string | The full name of the identity user type. | `Contoso.ContosoUser` | ![Development](https://img.shields.io/badge/-development-blue) |
24+
| <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) |
2425
| <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) |
2526
| <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) |
2627
| <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
@@ -12,6 +12,13 @@ groups:
1212
attributes:
1313
- ref: aspnetcore.identity.user_type
1414
requirement_level: required
15+
- id: aspnetcore.common.memory_pool.metrics.attributes
16+
type: attribute_group
17+
brief: Common ASP.NET Core memory pool metrics attributes
18+
attributes:
19+
- ref: aspnetcore.memory_pool.owner
20+
requirement_level:
21+
conditionally_required: if owner is specified when the memory pool is created.
1522

1623
# routing
1724
- id: metric.aspnetcore.routing.match_attempts
@@ -143,6 +150,63 @@ groups:
143150
- ref: aspnetcore.rate_limiting.result
144151
requirement_level: required
145152

153+
# memory_pool
154+
- id: metric.aspnetcore.memory_pool.pooled
155+
type: metric
156+
metric_name: aspnetcore.memory_pool.pooled
157+
annotations:
158+
code_generation:
159+
metric_value_type: int
160+
stability: development
161+
brief: Number of bytes currently pooled and available for reuse.
162+
instrument: updowncounter
163+
unit: "By"
164+
note: |
165+
Meter name: `Microsoft.AspNetCore.MemoryPool`; Added in: ASP.NET Core 10.0
166+
extends: aspnetcore.common.memory_pool.metrics.attributes
167+
168+
- id: metric.aspnetcore.memory_pool.allocated
169+
type: metric
170+
metric_name: aspnetcore.memory_pool.allocated
171+
annotations:
172+
code_generation:
173+
metric_value_type: int
174+
stability: development
175+
brief: Total number of bytes allocated by the memory pool. Allocation occurs when a memory rental request exceeds the available pooled memory.
176+
instrument: counter
177+
unit: "By"
178+
note: |
179+
Meter name: `Microsoft.AspNetCore.MemoryPool`; Added in: ASP.NET Core 10.0
180+
extends: aspnetcore.common.memory_pool.metrics.attributes
181+
182+
- id: metric.aspnetcore.memory_pool.evicted
183+
type: metric
184+
metric_name: aspnetcore.memory_pool.evicted
185+
annotations:
186+
code_generation:
187+
metric_value_type: int
188+
stability: development
189+
brief: Total number of bytes evicted from the memory pool. Eviction occurs when idle pooled memory is reclaimed.
190+
instrument: counter
191+
unit: "By"
192+
note: |
193+
Meter name: `Microsoft.AspNetCore.MemoryPool`; Added in: ASP.NET Core 10.0
194+
extends: aspnetcore.common.memory_pool.metrics.attributes
195+
196+
- id: metric.aspnetcore.memory_pool.rented
197+
type: metric
198+
metric_name: aspnetcore.memory_pool.rented
199+
annotations:
200+
code_generation:
201+
metric_value_type: int
202+
stability: development
203+
brief: Total number of bytes rented from the memory pool.
204+
instrument: counter
205+
unit: "By"
206+
note: |
207+
Meter name: `Microsoft.AspNetCore.MemoryPool`; Added in: ASP.NET Core 10.0
208+
extends: aspnetcore.common.memory_pool.metrics.attributes
209+
146210
# identity
147211
- id: metric.aspnetcore.identity.user.create.duration
148212
type: metric

model/aspnetcore/registry.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,11 @@ 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"]
8691
- id: aspnetcore.identity.user_type
8792
type: string
8893
brief: The full name of the identity user type.

0 commit comments

Comments
 (0)