Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

d.Provides its own start and stop methods.

2.1.3

...

CompositeReporter

Push the collector's data to other systems, such as Prometheus, JMX, IoTDB, etc.

...

  MetricManager provides interfaces for new, deleted, modified, and querying function for MetricReporter CompositeReporter andMetric, as well as switches for data acquisition that are exposed.

Code Block
public interface MetricManager {
  /**
   * Get Counter
   * If exists, then return
   * or create one to return
   * @param metric
   * @param tags string appear in pairs, like sg="ln" will be "sg", "ln"
   * @return
   */
  Counter getOrCreateCounter(String metric, String... tags);

  /**
   * Get Guage
   * If exists, then return
   * or create one to return
   * @param metric
   * @param tags string appear in pairs, like sg="ln" will be "sg", "ln"
   * @return
   */
  Gauge getOrCreatGauge(String metric, String... tags);

  /**
   * Get Rate
   * If exists, then return
   * or create one to return
   * @param metric
   * @param tags string appear in pairs, like sg="ln" will be "sg", "ln"
   * @return
   */
  Rate getOrCreatRate(String metric, String... tags);

  /**
   * Get Histogram
   * If exists, then return
   * or create one to return
   * @param metric
   * @param tags string appear in pairs, like sg="ln" will be "sg", "ln"
   * @return
   */
  Histogram getOrCreateHistogram(String metric, String... tags);

  /**
   * Get Timer
   * If exists, then return
   * or create one to return
   * @param metric
   * @param tags string appear in pairs, like sg="ln" will be "sg", "ln"
   * @return
   */
  Timer getOrCreateTimer(String metric, String... tags);

  /**
   * Update Counter
   * @param delta
   * @param metric
   * @param tags
   */
  void count(int delta, String metric, String... tags);

  /**
   * Update Counter
   * @param delta
   * @param metric
   * @param tags
   */
  void count(long delta, String metric, String... tags);

  /**
   * update Gauge
   * @param value
   * @param metric
   * @param tags
   */
  void gauge(int value, String metric, String... tags);

  /**
   * update Gauge
   * @param value
   * @param metric
   * @param tags
   */
  void gauge(long value, String metric, String... tags);

  /**
   * update Rate
   * @param value
   * @param metric
   * @param tags
   */
  void rate(int value, String metric, String... tags);

  /**
   * update Rate
   * @param value
   * @param metric
   * @param tags
   */
  void rate(long value, String metric, String... tags);

  /**
   * update Histogram
   * @param value
   * @param metric
   * @param tags
   */
  void histogram(int value, String metric, String... tags);

  /**
   * update Histogram
   * @param value
   * @param metric
   * @param tags
   */
  void histogram(long value, String metric, String... tags);

  /**
   * update Timer
   * @param delta
   * @param timeUnit
   * @param metric
   * @param tags
   */
  void timer(long delta, TimeUnit timeUnit, String metric, String... tags);

  /**
   * remove counter
   * @param metric
   * @param tags
   */
  void removeCounter(String metric, String... tags);

  /**
   * remove gauge
   * @param metric
   * @param tags
   */
  void removeGauge(String metric, String... tags);

  /**
   * remove rate
   * @param metric
   * @param tags
   */
  void removeRate(String metric, String... tags);

  /**
   * remove histogram
   * @param metric
   * @param tags
   */
  void removeHistogram(String metric, String... tags);

  /**
   * update timer
   * @param metric
   * @param tags
   */
  void removeTimer(String metric, String... tags);

  /**
   * get all metric keys.
   *
   * @return all MetricKeys, key is metric name, value is tags, which is a string array.
   */
  List<String[]> getAllMetricKeys();

  /**
   * Get all counters
   * @return [name, tags...] -> counter
   */
  Map<String[], Counter> getAllCounters();

  /**
   * Get all gauges
   * @return [name, tags...] -> gauge
   */
  Map<String[], Gauge> getAllGauges();

  /**
   * Get all rates
   * @return [name, tags...] -> rate
   */
  Map<String[], Rate> getAllRates();

  /**
   * Get all histogram
   * @return [name, tags...] -> histogram
   */
  Map<String[], Histogram> getAllHistograms();

  /**
   * Get all timers
   * @return [name, tags...] -> timer
   */
  Map<String[], Timer> getAllTimers();

  /**
   * whether is enable monitor
   * @return
   */
  boolean isEnable();

  /**
   * enable pre-defined metric set.
   *
   * @param metric which metric set we want to collect
   */
  void enablePredefinedMetric(PredefinedMetric metric);

  /**
   * init something.
   *
   * @return whether success
   */
  boolean init();

  /**
   * stop everything and clear
   *
   * @return
   */
  boolean stop();

  /**
   * Get name of manager
   * @return
   */
  String getName();
}

2.5

...

CompositeReporter

MetricReporter CompositeReporter is a data push interface.

...