Package org.apache.iotdb.metrics
Class AbstractMetricService
- java.lang.Object
-
- org.apache.iotdb.metrics.AbstractMetricService
-
- Direct Known Subclasses:
DoNothingMetricService
public abstract class AbstractMetricService extends Object
MetricService is the entry to get all metric features.
-
-
Field Summary
Fields Modifier and Type Field Description protected CompositeReportercompositeReporterThe metric reporter of metric service.protected IoTDBInternalReporterinternalReporterThe internal reporter of metric service.protected static MetricConfigMETRIC_CONFIGThe config of metric service.protected AbstractMetricManagermetricManagerThe metric manager of metric service.protected Set<IMetricSet>metricSetsThe list of metric sets.
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractMetricService()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidaddMetricSet(IMetricSet metricSet)Bind metrics and store metric set.voidcount(long delta, String metric, MetricLevel metricLevel, String... tags)voidcountWithInternalReportAsync(long delta, String metric, MetricLevel metricLevel, long time, String... tags)Count with internal report.<T> AutoGaugecreateAutoGauge(String metric, MetricLevel metricLevel, T obj, ToDoubleFunction<T> mapper, String... tags)<T> AutoGaugecreateAutoGaugeWithInternalReport(String metric, MetricLevel metricLevel, T obj, ToDoubleFunction<T> mapper, String... tags)GetOrCreateAutoGauge with internal report.voidgauge(long value, String metric, MetricLevel metricLevel, String... tags)voidgaugeWithInternalReportAsync(long value, String metric, MetricLevel metricLevel, long time, String... tags)Gauge value with internal report.List<Pair<String,String[]>>getAllMetricKeys()Map<MetricInfo,IMetric>getAllMetrics()AutoGaugegetAutoGauge(String metric, MetricLevel metricLevel, String... tags)AbstractMetricManagergetMetricManager()Map<MetricInfo,IMetric>getMetricsByType(MetricType metricType)CountergetOrCreateCounter(String metric, MetricLevel metricLevel, String... tags)CountergetOrCreateCounterWithInternalReport(String metric, MetricLevel metricLevel, long time, String... tags)GetOrCreateCounter with internal report.GaugegetOrCreateGauge(String metric, MetricLevel metricLevel, String... tags)GaugegetOrCreateGaugeWithInternalReport(String metric, MetricLevel metricLevel, long time, String... tags)GetOrCreateGauge with internal report.HistogramgetOrCreateHistogram(String metric, MetricLevel metricLevel, String... tags)HistogramgetOrCreateHistogramWithInternalReport(String metric, MetricLevel metricLevel, long time, String... tags)GetOrCreateHistogram with internal report.RategetOrCreateRate(String metric, MetricLevel metricLevel, String... tags)RategetOrCreateRateWithInternalReport(String metric, MetricLevel metricLevel, long time, String... tags)GetOrCreateRate with internal report.TimergetOrCreateTimer(String metric, MetricLevel metricLevel, String... tags)TimergetOrCreateTimerWithInternalReport(String metric, MetricLevel metricLevel, long time, String... tags)GetOrCreateTimer with internal report.voidhistogram(long value, String metric, MetricLevel metricLevel, String... tags)voidhistogramWithInternalReportAsync(long value, String metric, MetricLevel metricLevel, long time, String... tags)Histogram with internal report.protected abstract voidloadManager()Load metric manager according to configuration.protected abstract voidloadReporter()Load metric reporters according to configuration.voidrate(long value, String metric, MetricLevel metricLevel, String... tags)voidrateWithInternalReportAsync(long value, String metric, MetricLevel metricLevel, long time, String... tags)Rate with internal report.abstract voidreloadInternalReporter(IoTDBInternalReporter internalReporter)Reload internal reporter.protected abstract voidreloadService(ReloadLevel reloadLevel)Reload metric service.voidremove(MetricType type, String metric, String... tags)voidremoveMetricSet(IMetricSet metricSet)Remove metrics.voidstart(ReporterType type)Start reporter according to type.voidstartAllReporter()Start all reporters.protected voidstartCoreModule()Start metric core module.voidstartService()Start metric service.voidstop(ReporterType type)Stop reporter according to type.voidstopAllReporter()Stop all reporters.protected voidstopCoreModule()Stop metric core module.voidstopService()Stop metric service.voidtimer(long delta, TimeUnit timeUnit, String metric, MetricLevel metricLevel, String... tags)voidtimerWithInternalReportAsync(long delta, TimeUnit timeUnit, String metric, MetricLevel metricLevel, long time, String... tags)Timer with internal report.
-
-
-
Field Detail
-
METRIC_CONFIG
protected static final MetricConfig METRIC_CONFIG
The config of metric service.
-
metricManager
protected AbstractMetricManager metricManager
The metric manager of metric service.
-
compositeReporter
protected CompositeReporter compositeReporter
The metric reporter of metric service.
-
internalReporter
protected IoTDBInternalReporter internalReporter
The internal reporter of metric service.
-
metricSets
protected Set<IMetricSet> metricSets
The list of metric sets.
-
-
Method Detail
-
startService
public void startService()
Start metric service.
-
stopService
public void stopService()
Stop metric service.
-
startCoreModule
protected void startCoreModule()
Start metric core module.
-
stopCoreModule
protected void stopCoreModule()
Stop metric core module.
-
loadManager
protected abstract void loadManager()
Load metric manager according to configuration.
-
loadReporter
protected abstract void loadReporter()
Load metric reporters according to configuration.
-
reloadInternalReporter
public abstract void reloadInternalReporter(IoTDBInternalReporter internalReporter)
Reload internal reporter.- Parameters:
internalReporter- the new internal reporter
-
reloadService
protected abstract void reloadService(ReloadLevel reloadLevel)
Reload metric service.- Parameters:
reloadLevel- the level of reload
-
startAllReporter
public void startAllReporter()
Start all reporters.
-
stopAllReporter
public void stopAllReporter()
Stop all reporters.
-
start
public void start(ReporterType type)
Start reporter according to type.
-
stop
public void stop(ReporterType type)
Stop reporter according to type.
-
getOrCreateCounter
public Counter getOrCreateCounter(String metric, MetricLevel metricLevel, String... tags)
-
createAutoGauge
public <T> AutoGauge createAutoGauge(String metric, MetricLevel metricLevel, T obj, ToDoubleFunction<T> mapper, String... tags)
-
getAutoGauge
public AutoGauge getAutoGauge(String metric, MetricLevel metricLevel, String... tags)
-
getOrCreateGauge
public Gauge getOrCreateGauge(String metric, MetricLevel metricLevel, String... tags)
-
getOrCreateRate
public Rate getOrCreateRate(String metric, MetricLevel metricLevel, String... tags)
-
getOrCreateHistogram
public Histogram getOrCreateHistogram(String metric, MetricLevel metricLevel, String... tags)
-
getOrCreateTimer
public Timer getOrCreateTimer(String metric, MetricLevel metricLevel, String... tags)
-
count
public void count(long delta, String metric, MetricLevel metricLevel, String... tags)
-
gauge
public void gauge(long value, String metric, MetricLevel metricLevel, String... tags)
-
rate
public void rate(long value, String metric, MetricLevel metricLevel, String... tags)
-
histogram
public void histogram(long value, String metric, MetricLevel metricLevel, String... tags)
-
timer
public void timer(long delta, TimeUnit timeUnit, String metric, MetricLevel metricLevel, String... tags)
-
getOrCreateCounterWithInternalReport
public Counter getOrCreateCounterWithInternalReport(String metric, MetricLevel metricLevel, long time, String... tags)
GetOrCreateCounter with internal report.
-
createAutoGaugeWithInternalReport
public <T> AutoGauge createAutoGaugeWithInternalReport(String metric, MetricLevel metricLevel, T obj, ToDoubleFunction<T> mapper, String... tags)
GetOrCreateAutoGauge with internal report.
-
getOrCreateGaugeWithInternalReport
public Gauge getOrCreateGaugeWithInternalReport(String metric, MetricLevel metricLevel, long time, String... tags)
GetOrCreateGauge with internal report.
-
getOrCreateRateWithInternalReport
public Rate getOrCreateRateWithInternalReport(String metric, MetricLevel metricLevel, long time, String... tags)
GetOrCreateRate with internal report.
-
getOrCreateHistogramWithInternalReport
public Histogram getOrCreateHistogramWithInternalReport(String metric, MetricLevel metricLevel, long time, String... tags)
GetOrCreateHistogram with internal report.
-
getOrCreateTimerWithInternalReport
public Timer getOrCreateTimerWithInternalReport(String metric, MetricLevel metricLevel, long time, String... tags)
GetOrCreateTimer with internal report.
-
countWithInternalReportAsync
public void countWithInternalReportAsync(long delta, String metric, MetricLevel metricLevel, long time, String... tags)Count with internal report.
-
gaugeWithInternalReportAsync
public void gaugeWithInternalReportAsync(long value, String metric, MetricLevel metricLevel, long time, String... tags)Gauge value with internal report.
-
rateWithInternalReportAsync
public void rateWithInternalReportAsync(long value, String metric, MetricLevel metricLevel, long time, String... tags)Rate with internal report.
-
histogramWithInternalReportAsync
public void histogramWithInternalReportAsync(long value, String metric, MetricLevel metricLevel, long time, String... tags)Histogram with internal report.
-
timerWithInternalReportAsync
public void timerWithInternalReportAsync(long delta, TimeUnit timeUnit, String metric, MetricLevel metricLevel, long time, String... tags)Timer with internal report.
-
getAllMetrics
public Map<MetricInfo,IMetric> getAllMetrics()
-
getMetricsByType
public Map<MetricInfo,IMetric> getMetricsByType(MetricType metricType)
-
remove
public void remove(MetricType type, String metric, String... tags)
-
getMetricManager
public AbstractMetricManager getMetricManager()
-
addMetricSet
public void addMetricSet(IMetricSet metricSet)
Bind metrics and store metric set.
-
removeMetricSet
public void removeMetricSet(IMetricSet metricSet)
Remove metrics.
-
-