io.soffa.foundation.core.metrics.NoopMetricsRegistryImpl Maven / Gradle / Ivy
The newest version!
package io.soffa.foundation.core.metrics;
import java.time.Duration;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.function.Supplier;
public class NoopMetricsRegistryImpl implements MetricsRegistry {
private static final Map REG = new ConcurrentHashMap<>();
@Override
public void increment(String counter, double value, Map tags) {
REG.put(counter, REG.getOrDefault(counter, 0d) + 1);
}
@Override
public double counter(String name) {
return 0;
}
@Override
public double globalCounter(String name) {
return 0;
}
@Override
public void timed(String name, Duration duration, Map tags) {
// Add a dummy implementation
}
@Override
public void timed(String name, Map tags, Runnable runnable) {
runnable.run();
}
@Override
public F timed(String name, Map tags, Supplier supplier) {
return supplier.get();
}
}