Search in sources :

Example 1 with Tags

use of io.micrometer.api.instrument.Tags in project reactor-netty by reactor.

the class ByteBufAllocatorMetrics method registerMetrics.

void registerMetrics(String allocType, ByteBufAllocatorMetric metrics, ByteBufAllocator alloc) {
    MapUtils.computeIfAbsent(cache, metrics.hashCode() + "", key -> {
        Tags tags = Tags.of(ID.getKey(), key, TYPE.getKey(), allocType);
        Gauge.builder(USED_HEAP_MEMORY.getName(), metrics, ByteBufAllocatorMetric::usedHeapMemory).tags(tags).register(REGISTRY);
        Gauge.builder(USED_DIRECT_MEMORY.getName(), metrics, ByteBufAllocatorMetric::usedDirectMemory).tags(tags).register(REGISTRY);
        if (metrics instanceof PooledByteBufAllocatorMetric) {
            PooledByteBufAllocatorMetric pooledMetrics = (PooledByteBufAllocatorMetric) metrics;
            PooledByteBufAllocator pooledAlloc = (PooledByteBufAllocator) alloc;
            Gauge.builder(HEAP_ARENAS.getName(), pooledMetrics, PooledByteBufAllocatorMetric::numHeapArenas).tags(tags).register(REGISTRY);
            Gauge.builder(DIRECT_ARENAS.getName(), pooledMetrics, PooledByteBufAllocatorMetric::numDirectArenas).tags(tags).register(REGISTRY);
            Gauge.builder(THREAD_LOCAL_CACHES.getName(), pooledMetrics, PooledByteBufAllocatorMetric::numThreadLocalCaches).tags(tags).register(REGISTRY);
            Gauge.builder(SMALL_CACHE_SIZE.getName(), pooledMetrics, PooledByteBufAllocatorMetric::smallCacheSize).tags(tags).register(REGISTRY);
            Gauge.builder(NORMAL_CACHE_SIZE.getName(), pooledMetrics, PooledByteBufAllocatorMetric::normalCacheSize).tags(tags).register(REGISTRY);
            Gauge.builder(CHUNK_SIZE.getName(), pooledMetrics, PooledByteBufAllocatorMetric::chunkSize).tags(tags).register(REGISTRY);
            Gauge.builder(ACTIVE_HEAP_MEMORY.getName(), pooledAlloc, PooledByteBufAllocator::pinnedHeapMemory).tags(tags).register(REGISTRY);
            Gauge.builder(ACTIVE_DIRECT_MEMORY.getName(), pooledAlloc, PooledByteBufAllocator::pinnedDirectMemory).tags(tags).register(REGISTRY);
        }
        return metrics;
    });
}
Also used : PooledByteBufAllocatorMetric(io.netty.buffer.PooledByteBufAllocatorMetric) ByteBufAllocatorMetric(io.netty.buffer.ByteBufAllocatorMetric) PooledByteBufAllocatorMetric(io.netty.buffer.PooledByteBufAllocatorMetric) Tags(io.micrometer.api.instrument.Tags) PooledByteBufAllocator(io.netty.buffer.PooledByteBufAllocator)

Example 2 with Tags

use of io.micrometer.api.instrument.Tags in project reactor-netty by reactor.

the class MicrometerPooledConnectionProviderMeterRegistrar method registerMetrics.

void registerMetrics(String poolName, String id, SocketAddress remoteAddress, InstrumentedPool.PoolMetrics metrics) {
    String addressAsString = Metrics.formatSocketAddress(remoteAddress);
    Tags tags = Tags.of(ID.getKey(), id, REMOTE_ADDRESS.getKey(), addressAsString, NAME.getKey(), poolName);
    Gauge.builder(TOTAL_CONNECTIONS.getName(), metrics, InstrumentedPool.PoolMetrics::allocatedSize).tags(tags).register(REGISTRY);
    Gauge.builder(ACTIVE_CONNECTIONS.getName(), metrics, InstrumentedPool.PoolMetrics::acquiredSize).tags(tags).register(REGISTRY);
    Gauge.builder(IDLE_CONNECTIONS.getName(), metrics, InstrumentedPool.PoolMetrics::idleSize).tags(tags).register(REGISTRY);
    Gauge.builder(PENDING_CONNECTIONS.getName(), metrics, InstrumentedPool.PoolMetrics::pendingAcquireSize).tags(tags).register(REGISTRY);
    Gauge.builder(MAX_CONNECTIONS.getName(), metrics, InstrumentedPool.PoolMetrics::getMaxAllocatedSize).tags(tags).register(REGISTRY);
    Gauge.builder(MAX_PENDING_CONNECTIONS.getName(), metrics, InstrumentedPool.PoolMetrics::getMaxPendingAcquireSize).tags(tags).register(REGISTRY);
}
Also used : Tags(io.micrometer.api.instrument.Tags)

Example 3 with Tags

use of io.micrometer.api.instrument.Tags in project reactor-netty by reactor.

the class MicrometerHttp2ConnectionProviderMeterRegistrar method registerMetrics.

void registerMetrics(String poolName, String id, SocketAddress remoteAddress, InstrumentedPool.PoolMetrics metrics) {
    String addressAsString = Metrics.formatSocketAddress(remoteAddress);
    Tags tags = Tags.of(ID.getKey(), id, REMOTE_ADDRESS.getKey(), addressAsString, NAME.getKey(), poolName);
    Gauge.builder(ACTIVE_STREAMS.getName(), metrics, InstrumentedPool.PoolMetrics::acquiredSize).tags(tags).register(REGISTRY);
    Gauge.builder(PENDING_STREAMS.getName(), metrics, InstrumentedPool.PoolMetrics::pendingAcquireSize).tags(tags).register(REGISTRY);
}
Also used : Tags(io.micrometer.api.instrument.Tags)

Aggregations

Tags (io.micrometer.api.instrument.Tags)3 ByteBufAllocatorMetric (io.netty.buffer.ByteBufAllocatorMetric)1 PooledByteBufAllocator (io.netty.buffer.PooledByteBufAllocator)1 PooledByteBufAllocatorMetric (io.netty.buffer.PooledByteBufAllocatorMetric)1