Search in sources :

Example 1 with WAITING_THREADS

use of io.github.resilience4j.ratelimiter.utils.MetricNames.WAITING_THREADS in project resilience4j by resilience4j.

the class RateLimiterMetrics method bindTo.

@Override
public void bindTo(MeterRegistry registry) {
    for (RateLimiter rateLimiter : rateLimiters) {
        final String name = rateLimiter.getName();
        Gauge.builder(getName(prefix, name, AVAILABLE_PERMISSIONS), rateLimiter, (cb) -> cb.getMetrics().getAvailablePermissions()).register(registry);
        Gauge.builder(getName(prefix, name, WAITING_THREADS), rateLimiter, (cb) -> cb.getMetrics().getNumberOfWaitingThreads()).register(registry);
    }
}
Also used : Gauge(io.micrometer.core.instrument.Gauge) MetricUtils.getName(io.github.resilience4j.micrometer.MetricUtils.getName) RateLimiter(io.github.resilience4j.ratelimiter.RateLimiter) MeterRegistry(io.micrometer.core.instrument.MeterRegistry) Objects.requireNonNull(java.util.Objects.requireNonNull) MeterBinder(io.micrometer.core.instrument.binder.MeterBinder) WAITING_THREADS(io.github.resilience4j.ratelimiter.utils.MetricNames.WAITING_THREADS) AVAILABLE_PERMISSIONS(io.github.resilience4j.ratelimiter.utils.MetricNames.AVAILABLE_PERMISSIONS) RateLimiterRegistry(io.github.resilience4j.ratelimiter.RateLimiterRegistry) DEFAULT_PREFIX(io.github.resilience4j.ratelimiter.utils.MetricNames.DEFAULT_PREFIX) RateLimiter(io.github.resilience4j.ratelimiter.RateLimiter)

Aggregations

MetricUtils.getName (io.github.resilience4j.micrometer.MetricUtils.getName)1 RateLimiter (io.github.resilience4j.ratelimiter.RateLimiter)1 RateLimiterRegistry (io.github.resilience4j.ratelimiter.RateLimiterRegistry)1 AVAILABLE_PERMISSIONS (io.github.resilience4j.ratelimiter.utils.MetricNames.AVAILABLE_PERMISSIONS)1 DEFAULT_PREFIX (io.github.resilience4j.ratelimiter.utils.MetricNames.DEFAULT_PREFIX)1 WAITING_THREADS (io.github.resilience4j.ratelimiter.utils.MetricNames.WAITING_THREADS)1 Gauge (io.micrometer.core.instrument.Gauge)1 MeterRegistry (io.micrometer.core.instrument.MeterRegistry)1 MeterBinder (io.micrometer.core.instrument.binder.MeterBinder)1 Objects.requireNonNull (java.util.Objects.requireNonNull)1