com.expediagroup:dropwizard-prometheus-bundle

Dropwizard bundle to integrate dropwizard metrics with prometheus

Лицензия

Лицензия

Категории

Категории

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

Группа

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

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

dropwizard-prometheus-bundle
Последняя версия

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

1.0.0
Дата

Дата

Тип

Тип

jar
Описание

Описание

com.expediagroup:dropwizard-prometheus-bundle
Dropwizard bundle to integrate dropwizard metrics with prometheus
Ссылка на сайт

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

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

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

https://github.com/homeaway/dropwizard-prometheus-bundle

Скачать dropwizard-prometheus-bundle

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

<!-- https://jarcasting.com/artifacts/com.expediagroup/dropwizard-prometheus-bundle/ -->
<dependency>
    <groupId>com.expediagroup</groupId>
    <artifactId>dropwizard-prometheus-bundle</artifactId>
    <version>1.0.0</version>
</dependency>
// https://jarcasting.com/artifacts/com.expediagroup/dropwizard-prometheus-bundle/
implementation 'com.expediagroup:dropwizard-prometheus-bundle:1.0.0'
// https://jarcasting.com/artifacts/com.expediagroup/dropwizard-prometheus-bundle/
implementation ("com.expediagroup:dropwizard-prometheus-bundle:1.0.0")
'com.expediagroup:dropwizard-prometheus-bundle:jar:1.0.0'
<dependency org="com.expediagroup" name="dropwizard-prometheus-bundle" rev="1.0.0">
  <artifact name="dropwizard-prometheus-bundle" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.expediagroup', module='dropwizard-prometheus-bundle', version='1.0.0')
)
libraryDependencies += "com.expediagroup" % "dropwizard-prometheus-bundle" % "1.0.0"
[com.expediagroup/dropwizard-prometheus-bundle "1.0.0"]

Зависимости

compile (4)

Идентификатор библиотеки Тип Версия
io.dropwizard : dropwizard-core jar
io.dropwizard.metrics : metrics-core jar
io.prometheus : simpleclient_dropwizard jar 0.8.0
io.prometheus : simpleclient_servlet jar 0.8.0

provided (1)

Идентификатор библиотеки Тип Версия
org.projectlombok : lombok jar 1.18.12

test (4)

Идентификатор библиотеки Тип Версия
org.junit.jupiter : junit-jupiter-api jar 5.6.0
org.junit.jupiter : junit-jupiter-engine jar 5.6.0
io.dropwizard : dropwizard-testing jar
org.assertj : assertj-core jar 3.15.0

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

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

dropwizard-prometheus-bundle

Build Status

This bundle allows for a quick drop-in enablement of prometheus exposition format in dropwizard applications. The bundle allows a user to integrate and configure the prometheus dropwizard metrcis bridge and the exposition servlet into a dropwizard application.

Usage

Step 1- Add the PrometeusBundleConfig attribute to your application configuration class, add a

public class YourApplicationConfiguration extends Configuration{
    PrometeusBundleConfig prometheusConfiguration;
    
     public PrometheusBundleConfig getPrometheusBundleConfig() {
        return this.prometheusBundleConfig;
     }
}

Step 2- Add the bundle to your application

In your application class subscribe the bundle in the initialize method using the bootstrap.

public class YourApplication extends Application<YourApplicationConfiguration>{
    
     public void initialize(Bootstrap<DropwizardtestConfiguration> bootstrap) {
         //....
         bootstrap.addBundle(new PrometheusBundle<>(YourApplicationConfiguration::getPrometheusBundleConfig));
         //....
     }
     
}

Note: the bundle constructor will take a function to extract the config, just pass your getter.

Step 3- Set your configuration

The bundle will default to subscribing a /metrics under the admin servlet to expose the metrics.

Configuration

The following configuration options are supported by the bundle by adding the following to your yaml file

Override the endpoint path

prometheusConfig:
  scrapePath: /newPath

Custom metric mapping

Since dropwizard metrics do not support labels you can add mapping actions to re-normalize names and provide labels from the original tokenized name. Refer to the prometheus client guide for more information.

prometheusConfig:
  mapperConfig:
    - matchField: "com.request.*.value"
      matchName: "ContextHandler.requests"
      labels: {"method":"${0}"}
    - matchField: "com.test.*.value.*"
      matchName: "testName.value"
      labels: {"method":"${0}", "value":"${1}"}

Static tag addition

Adding static tags from the client is considered and anti pattern and should be avoided since it is the prometheus server in the job configuration that should do this. That said, in the advent of OpenMetrics this might be something that could help specially if prometheus is not the scraper. Use this at your own discretion

prometheusConfig: customLabels: {"mylabel":"myvalue"}

com.expediagroup

HomeAway

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

Версия
1.0.0
0.0.2
0.0.1