cxf-prometheus-metrics

Lib to collect prometheus statistics for spring boot actuator

Лицензия

Лицензия

Категории

Категории

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

Группа

io.github.ddk-prog
Идентификатор

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

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

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

1.1.1
Дата

Дата

Тип

Тип

jar
Описание

Описание

cxf-prometheus-metrics
Lib to collect prometheus statistics for spring boot actuator
Ссылка на сайт

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

https://github.com/ddk-prog/prometheus/
Система контроля версий

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

https://github.com/ddk-prog/prometheus/

Скачать cxf-prometheus-metrics

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

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

Зависимости

runtime (2)

Идентификатор библиотеки Тип Версия
org.apache.cxf : cxf-core jar 3.3.6
io.prometheus : simpleclient_pushgateway jar 0.8.1

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

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

CXF metrics for prometheus

Collects the following metrics for each endpoint and operation

cxf_requests_total       - total number of incoming cxf requests,
cxf_requests_success     - total number of successfully processed cxf requests,
cxf_requests_failed      - total number of failed cxf requests,
cxf_requests_seconds_sum - total execution time of cxf requests.

Besides, histograms are reported for execution time statistics. For example, for configuration bellow

@Bean
public Endpoint server1(final Bus bus, final MyFirstWebService service) {
    final EndpointImpl endpoint = new EndpointImpl(bus, service);
    endpoint.setEndpointName(new QName("server1"));
    endpoint.publish("/server1");
    return endpoint;
}

@Bean
public Endpoint server2(final Bus bus, final MySecondWebService service) {
    final EndpointImpl endpoint = new EndpointImpl(bus, service);
    endpoint.setEndpointName(new QName("server2"));
    endpoint.publish("/server2");
    return endpoint;
}

@Bean
public MyCxfClient client(final @Value("${my.cxf.client.url}") String url) {
    final JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
    factory.setAddress(url);
    factory.setEndpointName(new QName("client"));
    return factory.create(MyCxfClient.class);
}

the cxf_requests_total metric will be available for 'server1' endpoint as 'cxf_requests_total{endpoint="server1",operation="server1Method"}' for each web service method of MyFirstWebService.
And the same for other metrics of MyFirstWebService, MySecondWebService and MyCxfClient.

To enable cxf metrics for prometheus add dependency to your pom.xml.

<dependency>
    <groupId>io.github.ddk-prog</groupId>
    <artifactId>cxf-prometheus-metrics</artifactId>
    <version>1.1.1</version>
</dependency>

Add the following bean to your application configuration.

@Bean
public FactoryBeanListener cxfPrometheusFeatureBean(final CollectorRegistry registry) {
    return new PrometheusFactoryBeanListener(registry);
}

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

Версия
1.1.1
1.0.0