Wizzie metrics library

The Wizzie metrics library project

Лицензия

Лицензия

Категории

Категории

Metrics Тестирование приложения и мониторинг Monitoring
Группа

Группа

io.wizzie.metrics
Идентификатор

Идентификатор

metrics-library
Последняя версия

Последняя версия

0.0.7
Дата

Дата

Тип

Тип

jar
Описание

Описание

Wizzie metrics library
The Wizzie metrics library project
Ссылка на сайт

Ссылка на сайт

https://github.com/wizzie-io/metrics-library
Система контроля версий

Система контроля версий

https://github.com/wizzie-io/metrics-library.git

Скачать metrics-library

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/io.wizzie.metrics/metrics-library/ -->
<dependency>
    <groupId>io.wizzie.metrics</groupId>
    <artifactId>metrics-library</artifactId>
    <version>0.0.7</version>
</dependency>
// https://jarcasting.com/artifacts/io.wizzie.metrics/metrics-library/
implementation 'io.wizzie.metrics:metrics-library:0.0.7'
// https://jarcasting.com/artifacts/io.wizzie.metrics/metrics-library/
implementation ("io.wizzie.metrics:metrics-library:0.0.7")
'io.wizzie.metrics:metrics-library:jar:0.0.7'
<dependency org="io.wizzie.metrics" name="metrics-library" rev="0.0.7">
  <artifact name="metrics-library" type="jar" />
</dependency>
@Grapes(
@Grab(group='io.wizzie.metrics', module='metrics-library', version='0.0.7')
)
libraryDependencies += "io.wizzie.metrics" % "metrics-library" % "0.0.7"
[io.wizzie.metrics/metrics-library "0.0.7"]

Зависимости

compile (4)

Идентификатор библиотеки Тип Версия
io.dropwizard.metrics : metrics-core jar 4.0.3
io.dropwizard.metrics : metrics-jvm jar 4.0.3
org.apache.kafka : kafka-clients jar 2.1.0
com.fasterxml.jackson.core : jackson-databind jar 2.9.5

test (2)

Идентификатор библиотеки Тип Версия
org.mockito : mockito-all jar 1.10.19
junit : junit jar 4.12

Модули Проекта

Данный проект не имеет модулей.

CircleCI Maintainability GitHub release Maven Central wizzie-io

metrics-library

This library allows you to register custom and JVM metrics on java applications. It uses listeners to send this metrics to different backends, by default the metrics-library register the common JVM metrics (heap, gc count, gc time ...).

Properties

Listener class Description Default Type
metric.enable Enable or disable the metric library true boolean
metric.verbose.mode Enable verbose metrics (1min, 5min, 15min ...) false boolean
metric.listeners The listeners that metric library should be use to export metrics ["io.wizzie.metrics.listeners.ConsoleMetricListener"] List
metric.interval The interval to configure when the metric are sent (milliseconds) 60000 Long
application.id Identifier to specific what application is exporting the metrics Depends of the listener String
metric.databag Static data to add to all exported metrics. Map[String, Object]

Listeners

The listeners are the process that listen the reported metrics and do something with them. You can have multiple listeners at the same time.

Listener class Description
io.wizzie.metrics.listeners.ConsoleMetricListener Log the metrics ussing log4j-slf4j
io.wizzie.metrics.listeners.KafkaMetricListener Send metrics to Kafka topic

KafkaMetricListener

Properties

Listener class Description Default Type
metric.kafka.topic     Topic to send metrics                             __metrics String
bootstrap.servers Kafka brokers (ip111:9092,ip222:9092) String
application.id Identifier to specific what application is exporting the metrics Thread.currentThread().getName() String 

Work with library

To work with this library you need to add this dependency to your pom.xml:

<dependency>
    <groupId>io.wizzie.metrics</groupId>
    <artifactId>metrics-library</artifactId>
    <version>0.0.4</version>
</dependency>

Later you can init the MetricsManager class and register your metrics:

  Map<String, Object> config = new HashMap<>();

  config.put(METRIC_ENABLE, true);
  config.put(METRIC_INTERVAL, 2000);
  config.put(APPLICATION_ID, "testing-metric-manager");
  config.put(METRIC_LISTENERS, Collections.singletonList("io.wizzie.metrics.listeners.ConsoleMetricListener"));

  MetricsManager metricsManager = new MetricsManager(config);
  
  Counter myCounter = new Counter();
  Timer myTimer = new Timer();
  
  metricsManager.registerMetric("myCounterMetric", myCounter);
  metricsManager.registerMetric("myTimerMetric", myTimer);
  
  metricsManager.start();
  
  // Now you can use the metric instances.

  myCounter.inc();
  myCounter.dec();
  myCounter.inc(10);
  
  myTimer.update(1, TimeUnit.SECONDS);

Custom Listeners

You can made new listeners to do this you need to implement the MetricListener Class. On this class you receive the metric on the method void updateMetric(String metricName, Object metricValue);

io.wizzie.metrics

Wizzie

Wizzie Data Platform (WDP) will revolutionize the way equipment is monitored, acted upon and monetized with real‑time open source analytics.

Версии библиотеки

Версия
0.0.7
0.0.6
0.0.5
0.0.4