Repository: dotnet/aspnetcore
File: src/Shared/Buffers.MemoryPool/MemoryPoolMetrics.cs (C#)

Code before:

namespace Microsoft.AspNetCore;

internal sealed class MemoryPoolMetrics
{
    public const string MeterName = "Microsoft.AspNetCore.MemoryPool";

    public const string PooledMemoryName = "aspnetcore.memory_pool.pooled";
    public const string AllocatedMemoryName = "aspnetcore.memory_pool.allocated";
    public const string EvictedMemoryName = "aspnetcore.memory_pool.evicted";
    public const string RentedMemoryName = "aspnetcore.memory_pool.rented";

    private readonly Meter _meter;
    private readonly UpDownCounter<long> _pooledMemoryCounter;
    private readonly Counter<long> _allocatedMemoryCounter;
    private readonly Counter<long> _evictedMemoryCounter;
    private readonly Counter<long> _rentedMemoryCounter;

    public MemoryPoolMetrics(IMeterFactory meterFactory)
    {
        _meter = meterFactory.Create(MeterName);

        _pooledMemoryCounter = _meter.CreateUpDownCounter<long>(
            PooledMemoryName,
            unit: "By",
            description: "Number of bytes currently held by the memory pool and available for reuse.");

        _allocatedMemoryCounter = _meter.CreateCounter<long>(
            AllocatedMemoryName,
            unit: "By",
            description: "Total number of allocations made by the memory pool.");

        _evictedMemoryCounter = _meter.CreateCounter<long>(
            EvictedMemoryName,
            unit: "By",
            description: "Total number of bytes that have been evicted from the memory pool.");

        _rentedMemoryCounter = _meter.CreateCounter<long>(
            RentedMemoryName,
            unit: "By",
            description: "Total number of bytes rented from the memory pool.");
    }

    public void UpdatePooledMemory(int bytes, string? owner)
    {
        if (_pooledMemoryCounter.Enabled)
        {
            UpdatePooledMemoryCore(bytes, owner);
        }
    }


Review comment (suggestion):
```suggestion
            description: "Number of bytes currently pooled and available for reuse.");
```

Code after:

namespace Microsoft.AspNetCore;

internal sealed class MemoryPoolMetrics
{
    public const string MeterName = "Microsoft.AspNetCore.MemoryPool";

    public const string PooledMemoryName = "aspnetcore.memory_pool.pooled";
    public const string AllocatedMemoryName = "aspnetcore.memory_pool.allocated";
    public const string EvictedMemoryName = "aspnetcore.memory_pool.evicted";
    public const string RentedMemoryName = "aspnetcore.memory_pool.rented";

    private readonly Meter _meter;
    private readonly UpDownCounter<long> _pooledMemoryCounter;
    private readonly Counter<long> _allocatedMemoryCounter;
    private readonly Counter<long> _evictedMemoryCounter;
    private readonly Counter<long> _rentedMemoryCounter;

    public MemoryPoolMetrics(IMeterFactory meterFactory)
    {
        _meter = meterFactory.Create(MeterName);

        _pooledMemoryCounter = _meter.CreateUpDownCounter<long>(
            PooledMemoryName,
            unit: "By",
            description: "Number of bytes currently pooled and available for reuse.");

        _allocatedMemoryCounter = _meter.CreateCounter<long>(
            AllocatedMemoryName,
            unit: "By",
            description: "Total number of bytes allocated by the memory pool. Allocation occurs when a memory rental request exceeds the available pooled memory.");

        _evictedMemoryCounter = _meter.CreateCounter<long>(
            EvictedMemoryName,
            unit: "By",
            description: "Total number of bytes evicted from the memory pool. Eviction occurs when idle pooled memory is reclaimed. Evicted memory is available for garbage collection.");

        _rentedMemoryCounter = _meter.CreateCounter<long>(
            RentedMemoryName,
            unit: "By",
            description: "Total number of bytes rented from the memory pool.");
    }

    public void UpdatePooledMemory(int bytes, string? owner)
    {
        if (_pooledMemoryCounter.Enabled)
        {
            UpdatePooledMemoryCore(bytes, owner);
        }
    }