spring-boot-starter-prometheus

Metrics endpoint prometheus.io format for Spring Boot

Лицензия

Лицензия

Категории

Категории

Spring Boot Контейнер Микросервисы Prometheus Тестирование приложения и мониторинг Monitoring
Группа

Группа

ru.vyukov
Идентификатор

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

spring-boot-starter-prometheus
Последняя версия

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

0.1
Дата

Дата

Тип

Тип

jar
Описание

Описание

spring-boot-starter-prometheus
Metrics endpoint prometheus.io format for Spring Boot
Ссылка на сайт

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

https://github.com/akaGelo/spring-boot-starter-prometheus
Организация-разработчик

Организация-разработчик

Pivotal Software, Inc.
Система контроля версий

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

https://github.com/akaGelo/spring-boot-starter-prometheus

Скачать spring-boot-starter-prometheus

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

<!-- https://jarcasting.com/artifacts/ru.vyukov/spring-boot-starter-prometheus/ -->
<dependency>
    <groupId>ru.vyukov</groupId>
    <artifactId>spring-boot-starter-prometheus</artifactId>
    <version>0.1</version>
</dependency>
// https://jarcasting.com/artifacts/ru.vyukov/spring-boot-starter-prometheus/
implementation 'ru.vyukov:spring-boot-starter-prometheus:0.1'
// https://jarcasting.com/artifacts/ru.vyukov/spring-boot-starter-prometheus/
implementation ("ru.vyukov:spring-boot-starter-prometheus:0.1")
'ru.vyukov:spring-boot-starter-prometheus:jar:0.1'
<dependency org="ru.vyukov" name="spring-boot-starter-prometheus" rev="0.1">
  <artifact name="spring-boot-starter-prometheus" type="jar" />
</dependency>
@Grapes(
@Grab(group='ru.vyukov', module='spring-boot-starter-prometheus', version='0.1')
)
libraryDependencies += "ru.vyukov" % "spring-boot-starter-prometheus" % "0.1"
[ru.vyukov/spring-boot-starter-prometheus "0.1"]

Зависимости

compile (5)

Идентификатор библиотеки Тип Версия
io.prometheus : simpleclient_common jar 0.0.17
org.springframework.boot : spring-boot-starter jar 1.4.1.RELEASE
org.springframework.boot : spring-boot-starter-web jar 1.4.1.RELEASE
org.springframework.boot : spring-boot-starter-actuator jar 1.4.1.RELEASE
org.springframework.boot : spring-boot-configuration-processor Необязательный jar 1.4.1.RELEASE

test (5)

Идентификатор библиотеки Тип Версия
junit : junit jar 4.12
org.assertj : assertj-core jar 2.5.0
org.mockito : mockito-core jar 1.10.19
org.hamcrest : hamcrest-library jar 1.3
org.springframework : spring-test jar

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

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

spring-boot-starter-prometheus

Maven Central

#Quick start

  1. dependency
<dependency>
	<groupId>ru.vyukov</groupId>
	<artifactId>spring-boot-starter-prometheus</artifactId>
	<version>0.1</version>
</dependency>
  1. Add annotation to enable @EnablePrometheus
@EnablePrometheus
@SpringBootApplication
public class SpringBootApplication {
....
}

Russian

Это реализация metrics endpoint для Spring Boot Actuator в текстовом формате применяемом в Prometheus.

Экспортирует все зарегистрированные метрики.

Возвращает HTTP Status 200 если health check в статусе UP и 500 если в статусе down или unknown. Это используется Prometheus для определения состояния.

Принятые правила именовая метрик отличаются в Spring и Prometheus, поэтому я слегда модифицировал их в этом endpoint.

Пример: К "heap" дописаны единицы изменения, в результате метрика heap называется heap_bytes. Использовать рекомендации prometheus собирая метрики в _total смысла не вижу, документация spring станет неудобна.

Чтобы отключить или изменить это поведение нужно определить свой экземпляр PrometeusMetricNameConverter. Реализацию текущего поведения можно найти в DefaultPrometeusMetricNameConverter

English

This is the implementation of metrics endpoint for Spring Boot Actuator in the text format applied in Prometheus.

It exploits all the registered metrics.

It returns HTTP Status 200 if health check is in the status UP and 500 if it is in the status down or unknown. It is used in Prometheus to identify the status.

The accepted rules of naming the metrics are different in Spring and Prometheus, that’s why I’ve slightly modified them in this endpoint. For example, there are some added units to "heap", as a result, the metric heap is called heap_bytes.

In order to turn off or change this behaviour it is necessary to define your instance of PrometeusMetricNameConverter. It’s possible to find the implementation of the current behaviour in DefaultPrometeusMetricNameConverter.

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

Версия
0.1