GithubHelp home page GithubHelp logo

adessose / eureka-prometheus-bridge Goto Github PK

View Code? Open in Web Editor NEW
5.0 5.0 2.0 155 KB

Bridge for Eureka and Prometheus written in Kotlin

License: MIT License

Kotlin 100.00%
bridge docker docker-container eureka kotlin microservices prometheus spring-boot

eureka-prometheus-bridge's People

Contributors

silasmahler avatar thombergs avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

eureka-prometheus-bridge's Issues

Check all configuration parameters on startup

On startup, log all configuration parameters and their values and check if all mandatory parameters are valid (config template file must exist, for example). Throw an exception if not valid so that the application doesn't start at all.

Use a YML library

Instead of handling the YML as a string, it should be handled with a YML library that allows handling it via Java (or Kotlin). This way, we have a refactoring-safe (and easier-to-test) way of dealing with YML.

Introduce @ConfigurationProperties

Instead of passing all configuration parameters as @value into the Generator and ScheduledJob classes, it would be better to use @ConfigurationProperties to bind them to a new class EurekaPrometheusBridgeProperties
and inject this class into classes that need those properties.

Provide an example setup

Create a github repo that contains examples so that an interested user can easily run it to test the bridge. The repo should contain:

  • a Spring Boot App that acts as Eureka Server

  • two Spring Boot Apps that act as Eureka Clients

  • a guide on how to run the bridge to work with the eureka server

  • Reminder: "/prometheus" endpoint needs to be defined by the eureka-clients.

Then:

  • Link this repo from the README

CI Pipeline

add a Travis CI pipeline that build the app, runs the tests and automatically deploys the JAR and the docker file to the adesso organization on Bintray.

Provide a README

Provide a readme that explains

  • what this application does and why it was built
  • all configuration parameters
  • how to start the application (with and without docker)
  • where to download the application or docker file
  • how to configure Prometheus

Make Eureka query interval configurable

Currently, the interval to query Eureka is fix every 10 seconds, since it's defined in @Scheduled(fixedRate = 10000)

It would be nice to make this interval configurable. We could leave the @Scheduled annotation as is but add a check to the start that checks if the last job was longer than <configurable_interval> ago by storing the last execution time in an instance property (a little dirty, since the class has state then, but I wouldn't mind for this use case).

Extract Eureka-Querying into a separate class

The logic for querying Eureka should be extracted into a separate class. The class ScheduledJobs should simply provide the @Scheduled entry point and orchestrate any classes that do stuff.

Run a single job instead of two

Currently, there are 2 @ScheduledJobs, one that pulls the data from Eureka and one that writes it into the Prometheus file. Why are those separated? This may lead to all kinds of synchronization issues.

Better to make a single @ScheduledJob that pulls the data and directly writes it into the prometheus configuration file. This way, the service does not need to manage state.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.