The bridge pulls the service-urls from eureka. It provides a config-file for prometheus which contains the services /prometheus endpoint (or any endpoint you define), so prometheus knows where to scrape for metrics.
To test the project a fully dockerized spring-boot-kotlin app is available here. More information in the Chapter "Starting the Application"
spring.application.name=eureka-prometheus-bridge
server.port=1111
eureka.client.register-with-eureka=false
query.interval.second=60
bridge.eureka.port=8761
bridge.eureka.host=http://127.0.0.1
bridge.eureka.apipath=/eureka/apps/
bridge.eureka.showJson=false
bridge.prometheus.scrapeinterval=15
bridge.prometheus.scrapetimeout=10
bridge.prometheus.metricspath=/prometheus
bridge.prometheus.scheme=http
bridge.prometheus.generatedConfigFilePath=generated-prometheus-configs/prometheus.yml
bridge.prometheus.configFileTemplatePath=src/main/resources/prometheus-basic.yml
bridge.prometheus.testConfigFilePath=src/test/resources/prometheus-test.yml
- In the project_dir use
gradlew build
- Run the jar under
.\build\libs\eureka-prometheus-bridge-0.0.1.jar
As you may notice, just running the app doesnt fetch any services. So i built a spring boot project with some example-services to use.
Run docker-compose up
in the root-directory.
The Applications will be available:
Service | url | What it does |
---|---|---|
Eureka Dasboard | localhost:8761 | Shows you the services of the Microservice landscape |
Prometheus-Server | localhost:9090 | Monitors the services given in the prometheus.yml config file |
Test-Service 1 | localhost:1001 | Is a test-service with a simple endpoint /test |
Test-Service 2 | localhost:1002 | Is a test-service with a simple endpoint /test |
Have a look at Bintray as new releases will be available there as a dependency for future projects.