Skip to content

Instantly share code, notes, and snippets.

@zeroows
Last active April 6, 2017 08:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zeroows/c0e1ad52af24a3020b048d1282e35dff to your computer and use it in GitHub Desktop.
Save zeroows/c0e1ad52af24a3020b048d1282e35dff to your computer and use it in GitHub Desktop.
Using Prometheus with Spring Boot - https://prometheus.io
  <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-actuator</artifactId>
  </dependency>
  <!-- The client -->
  <dependency>
      <groupId>io.prometheus</groupId>
      <artifactId>simpleclient</artifactId>
      <version>0.0.18</version>
  </dependency>
  <!-- Hotspot JVM metrics-->
  <dependency>
      <groupId>io.prometheus</groupId>
      <artifactId>simpleclient_hotspot</artifactId>
      <version>0.0.18</version>
  </dependency>
  <!-- Exposition servlet-->
  <dependency>
      <groupId>io.prometheus</groupId>
      <artifactId>simpleclient_servlet</artifactId>
      <version>0.0.18</version>
  </dependency>
  <!-- Pushgateway exposition-->
  <dependency>
      <groupId>io.prometheus</groupId>
      <artifactId>simpleclient_pushgateway</artifactId>
      <version>0.0.18</version>
  </dependency>
  <dependency>
      <groupId>io.prometheus</groupId>
      <artifactId>simpleclient_spring_boot</artifactId>
      <version>0.0.18</version>
  </dependency>
@EnablePrometheusEndpoint
@EnableSpringBootMetricsCollector
public class Application {
  public Application() {}

  public static void main(String[] args) {
    SpringApplication.run(Application.class, args);
  }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment