public class DefaultMetrics extends io.micrometer.core.instrument.composite.CompositeMeterRegistry implements Metrics
Modifier and Type | Field and Description |
---|---|
protected java.util.HashMap<java.lang.Class<? extends io.micrometer.core.instrument.binder.MeterBinder>,io.micrometer.core.instrument.binder.MeterBinder> |
binders |
protected int |
distributionStatisticBufferLength |
protected static org.slf4j.Logger |
logger |
protected int |
percentilePrecision |
protected double[] |
percentiles |
protected boolean |
publishPercentileHistogram |
protected java.util.concurrent.locks.ReentrantReadWriteLock.ReadLock |
readLock |
protected java.util.HashMap<java.lang.String,java.lang.Object> |
registry |
protected DropwizardReporters |
reporters |
protected java.util.concurrent.locks.ReentrantReadWriteLock.WriteLock |
writeLock |
ONE_SECOND
Constructor and Description |
---|
DefaultMetrics() |
DefaultMetrics(io.micrometer.core.instrument.MeterRegistry... registries) |
Modifier and Type | Method and Description |
---|---|
void |
addClassLoaderMetrics() |
void |
addExecutorServiceMetrics(java.util.concurrent.ExecutorService executor,
java.lang.String executorServiceName,
java.lang.String... tags) |
void |
addJvmGcMetrics() |
void |
addJvmMemoryMetrics() |
void |
addJvmThreadMetrics() |
void |
addMetrics(io.micrometer.core.instrument.binder.MeterBinder binder) |
void |
addProcessorMetrics() |
int |
getDistributionStatisticBufferLength() |
protected <T> T |
getMetric(java.lang.String name,
java.lang.String[] tags,
java.util.function.Supplier<T> factory) |
int |
getPercentilePrecision() |
double[] |
getPercentiles() |
MetricCounter |
increment(java.lang.String name,
java.lang.String description,
double delta,
java.lang.String... tags) |
boolean |
isPublishPercentileHistogram() |
protected DropwizardReporters |
reporters() |
MetricGauge |
set(java.lang.String name,
java.lang.String description,
double value,
java.lang.String... tags) |
void |
setDistributionStatisticBufferLength(int distributionStatisticBufferLength) |
void |
setPercentilePrecision(int percentilePrecision) |
void |
setPercentiles(double[] percentiles) |
void |
setPublishPercentileHistogram(boolean publishPercentileHistogram) |
void |
startConsoleReporter()
Starts ConsoleReporter.
|
void |
startConsoleReporter(long period,
java.util.concurrent.TimeUnit periodUnit)
Starts ConsoleReporter.
|
void |
startCsvReporter(long period,
java.util.concurrent.TimeUnit periodUnit,
java.lang.String directory)
Starts CsvReporter.
|
void |
startCsvReporter(java.lang.String directory)
Starts CsvReporter.
|
void |
started(ServiceBroker broker) |
void |
startSlf4jReporter()
Starts Slf4jReporter.
|
void |
startSlf4jReporter(long period,
java.util.concurrent.TimeUnit periodUnit)
Starts Slf4jReporter.
|
void |
startSlf4jReporter(long period,
java.util.concurrent.TimeUnit periodUnit,
java.lang.String loggerName)
Starts Slf4jReporter.
|
void |
stopped() |
StoppableTimer |
timer(java.lang.String name,
java.lang.String description,
java.time.Duration duration,
java.lang.String... tags) |
add, close, defaultHistogramConfig, getBaseTimeUnit, getRegistries, newCounter, newDistributionSummary, newFunctionCounter, newFunctionTimer, newGauge, newLongTaskTimer, newMeter, newTimeGauge, newTimer, remove
clear, config, counter, counter, find, forEachMeter, gauge, gauge, gauge, gauge, gaugeCollectionSize, gaugeMapSize, get, getConventionName, getConventionTags, getMeters, isClosed, meterRegistrationFailed, more, newLongTaskTimer, remove, remove, removeByPreFilterId, summary, summary, timer, timer
protected static final org.slf4j.Logger logger
protected final java.util.HashMap<java.lang.String,java.lang.Object> registry
protected final java.util.HashMap<java.lang.Class<? extends io.micrometer.core.instrument.binder.MeterBinder>,io.micrometer.core.instrument.binder.MeterBinder> binders
protected DropwizardReporters reporters
protected final java.util.concurrent.locks.ReentrantReadWriteLock.ReadLock readLock
protected final java.util.concurrent.locks.ReentrantReadWriteLock.WriteLock writeLock
protected boolean publishPercentileHistogram
protected int percentilePrecision
protected int distributionStatisticBufferLength
protected double[] percentiles
public DefaultMetrics()
public DefaultMetrics(io.micrometer.core.instrument.MeterRegistry... registries)
public void started(ServiceBroker broker) throws java.lang.Exception
started
in interface MoleculerLifecycle
java.lang.Exception
public MetricCounter increment(java.lang.String name, java.lang.String description, double delta, java.lang.String... tags)
public MetricGauge set(java.lang.String name, java.lang.String description, double value, java.lang.String... tags)
public StoppableTimer timer(java.lang.String name, java.lang.String description, java.time.Duration duration, java.lang.String... tags)
protected <T> T getMetric(java.lang.String name, java.lang.String[] tags, java.util.function.Supplier<T> factory)
public void startConsoleReporter()
public void startConsoleReporter(long period, java.util.concurrent.TimeUnit periodUnit)
period
- the amount of time between pollsperiodUnit
- the unit for period
public void startCsvReporter(java.lang.String directory)
directory
- directory the directory in which the .csv
files will
be createdpublic void startCsvReporter(long period, java.util.concurrent.TimeUnit periodUnit, java.lang.String directory)
period
- the amount of time between pollsperiodUnit
- the unit for period
directory
- directory the directory in which the .csv
files will
be createdpublic void startSlf4jReporter()
public void startSlf4jReporter(long period, java.util.concurrent.TimeUnit periodUnit)
period
- the amount of time between pollsperiodUnit
- the unit for period
public void startSlf4jReporter(long period, java.util.concurrent.TimeUnit periodUnit, java.lang.String loggerName)
period
- the amount of time between pollsperiodUnit
- the unit for period
loggerName
- name of the logger (eg. "moleculer.metrics" or null)protected DropwizardReporters reporters()
public void addClassLoaderMetrics()
public void addJvmMemoryMetrics()
public void addJvmGcMetrics()
public void addProcessorMetrics()
public void addJvmThreadMetrics()
public void addExecutorServiceMetrics(java.util.concurrent.ExecutorService executor, java.lang.String executorServiceName, java.lang.String... tags)
public void addMetrics(io.micrometer.core.instrument.binder.MeterBinder binder)
public void stopped()
stopped
in interface MoleculerLifecycle
public boolean isPublishPercentileHistogram()
public void setPublishPercentileHistogram(boolean publishPercentileHistogram)
public int getPercentilePrecision()
public void setPercentilePrecision(int percentilePrecision)
public int getDistributionStatisticBufferLength()
public void setDistributionStatisticBufferLength(int distributionStatisticBufferLength)
public double[] getPercentiles()
public void setPercentiles(double[] percentiles)