metrics-parent

A metrics engine with different backends (eg: statsd-netty)

Лицензия

Лицензия

Категории

Категории

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

Группа

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

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

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

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

0.3.0
Дата

Дата

Тип

Тип

pom
Описание

Описание

metrics-parent
A metrics engine with different backends (eg: statsd-netty)
Ссылка на сайт

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

https://github.com/flozano/statsd-netty
Система контроля версий

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

https://github.com/flozano/statsd-netty/

Скачать metrics-parent

Имя Файла Размер
metrics-parent-0.3.0.pom 9 KB
Обзор

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

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

Зависимости

compile (2)

Идентификатор библиотеки Тип Версия
org.slf4j : slf4j-api jar 1.7.14
com.google.guava : guava jar 19.0

test (4)

Идентификатор библиотеки Тип Версия
junit : junit jar 4.12
org.mockito : mockito-all jar 1.10.17
ch.qos.logback : logback-classic jar 1.1.3
com.jayway.awaitility : awaitility jar 1.7.0

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

  • metrics-statsd
  • metrics-core

statsd-netty

Build Status

A Netty-based statsd client with Apache 2.0 License.

It requires Java 8, netty and SLF4J.

How to use:

Maven dependency:

		<dependency>
			<groupId>com.flozano.statsd-netty</groupId>
			<artifactId>statsd-netty</artifactId>
			<version>0.1.4</version>
		</dependency>

Example code:

		try (Metrics metrics = MetricsBuilder.create()
				.withClient((clientBuilder) -> //
						clientBuilder.withHost("127.0.0.1") //
								.withPort(8125) //
								.withSampleRate(0.5) // send 50% of metrics only
				).withClock(Clock.systemUTC()).build()) {

			// Send a counter metric immediately
			metrics.counter("visitors").hit();

			// Create a batch of metrics that will be sent at the end of the try
			// block.
			try (Metrics batch = metrics.batch()) {
				batch.gauge("activeDatabaseConnections").value(
						getConnectionsFromPool());
				batch.gauge("activeSessions").delta(-1);
			}

			// Schedule a couple of gauges to be reported every 60 seconds
			metrics.gauge("databaseConnectionPool", "activeConnections")
					.supply(60, TimeUnit.SECONDS,
							() -> getConnectionsFromPool());

			metrics.gauge("databaseConnectionPool", "waitingForConnection")
					.supply(1, TimeUnit.MINUTES,
							() -> getWaitingForConnection());

			// Measure the time spent inside the try block
			try (TimeKeeping o = metrics.timer("timeSpentSavingData").time()) {
				saveData();
			}
		}

(note that you should keep the "Metrics" instance open for the whole lifecycle of your application).

Copyright 2014 Francisco A. Lozano López

Bitdeli Badge

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

Версия
0.3.0
0.2.1