metrics-opentsdb

metrics reporter for OpenTSDB

Лицензия

Лицензия

Категории

Категории

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

Группа

com.github.thinker0.metrics
Идентификатор

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

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

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

1.1.5
Дата

Дата

Тип

Тип

jar
Описание

Описание

metrics-opentsdb
metrics reporter for OpenTSDB
Ссылка на сайт

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

http://github.com/sps/metrics-opentsdb
Система контроля версий

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

http://github.com/sps/metrics-opentsdb/

Скачать metrics-opentsdb

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

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

Зависимости

compile (4)

Идентификатор библиотеки Тип Версия
io.dropwizard.metrics : metrics-core jar 3.2.0
org.glassfish.jersey.core : jersey-client jar 2.22.2
org.glassfish.jersey.media : jersey-media-json-jackson jar 2.22.2
com.google.guava : guava jar 24.1-jre

test (3)

Идентификатор библиотеки Тип Версия
junit : junit jar 4.12
org.mockito : mockito-core jar 1.10.17
org.slf4j : slf4j-simple jar 1.7.5

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

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

Metrics OpenTSDB Build Status Coverage Status

A Coda Hale Metrics Reporter.

OpenTsdbReporter allows your application to constantly stream metric values to an opentsdb server via the 2.0 HTTP API or the Telnet API.

This reporter also supports per-metric tags in addition to a global set of tags.

Example Usage

dropwizard 3.0.1 app:

@Override
public void run(T configuration, Environment environment) throws Exception {
...
    OpenTsdb opentsdb = OpenTsdb.forService("http://opentsdb/")
                                      .withGzipEnabled(true) // optional: compress requests to tsd
                                      .create();

    OpenTsdbReporter.forRegistry(environment.metrics())
                    .prefixedWith(environment.getName())
                    .withTags(ImmutableMap.of("other", "tags")) // static tags included with every metric
                    // .withBatchSize(10) // optional batching. unbounded by default. likely need to tune this.
                    .build(opentsdb)
                    .start(15L, TimeUnit.SECONDS); // tune your reporting interval

Tagged Metric Registry

// setup
TaggedMetricRegistry metrics = new TaggedMetricRegistry();
Map<String, String> tags = new HashMap<String, String>();
tags.put("host", "localhost");
tags.put("foo", "bar");

OpenTsdbReporter.forRegistry(metrics)
    .withTags(tags)
    .withBatchSize(5)
	.build(OpenTsdb.forService("http://opentsdb/")
	.create())
	.start(30L, TimeUnit.SECONDS);

// using metric with tags
Map<String, String> counterTags = new HashMap<String, String>(tags);
counterTags.put("trigger", trigger);

TaggedCounter counter = metrics.taggedCounter("my.tagged.counter", counterTags);
counter.inc();
  • Completely backwords compatible with existing Coda Hale metrics
  • All Coda Hale metrics have a Tagged<metric> counterpart (e.g. TaggedCounter, TaggedMeter, etc.)
  • Registry can have default tags that can be overridden at the metric level
  • Metrics can have additional tags not in the registry
  • Calling a tagged<metric> function (e.g. taggedCounter(), taggedMeter(), etc.) on the TaggedMetric registry will perform a get or create operation. If the same type of metric with the same name and tags is already registered in the registry, it will be returned, otherwise it will be created and returned. There is no need to check for name or tag collisions.

The Telnet API is identical to the above, except with

OpenTsdbTelnet.forService("mycollector.example.com", 4243)

For per-metric tags, encode the tags into the metric name using

Map<String, String> myCounterTags;
String name = OpenTsdbMetric.encodeTagsInName('mycounter', myCounterTags);

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

Версия
1.1.5
1.1.4
1.1.1