Skip to content

MikeSafonov/spring-boot-starter-prometheus-alerts

Repository files navigation

spring-boot-starter-prometheus-alerts

Maven Central codecov Travis-CI Conventional Commits

Quality Gate Status Reliability Rating Maintainability Rating Security Rating

Bugs Code Smells Vulnerabilities

Duplicated Lines (%) Lines of Code Technical Debt

This is a starter for spring boot application witch catch alerts from Prometheus Alertmanager.

The starter is available at https://repo1.maven.org/maven2/ repository.

Using gradle:

repositories {
    maven {url "https://repo1.maven.org/maven2/"}
}
dependencies {
    implementation 'com.github.mikesafonov:spring-boot-starter-prometheus-alerts:1.0.0'
}

The only thing you need to do after adding the dependency is to create a bean with implementation of NotificationService interface:

@Serivce
public class MyNotificationService implementation NotificationService {
...
} 

Configuration

The following properties can be configured:

property description
prometheus.alertmanager.endpoint.base base url for POST request mapping for prometheus alert (default /alert)

Build

Build from source

You can build application using following command:

./gradlew clean build -x signArchives

Requirements:

JDK >= 1.8

Unit tests

You can run unit tests using following command:

./gradlew test

Alertmanager configuration

route:
  receiver: 'my-application'
receivers:
- name: 'my-application'
  webhook_configs:
    - url: http://<application-host>:<application-port>/alert

Usage example

Contributing

Feel free to contribute. New feature proposals and bug fixes should be submitted as GitHub pull requests. Fork the repository on GitHub, prepare your change on your forked copy, and submit a pull request.

IMPORTANT!

Before contributing please read about Conventional Commits / Conventional Commits RU