GithubHelp home page GithubHelp logo

helpdeveloper / java-observability-metrics Goto Github PK

View Code? Open in Web Editor NEW
3.0 1.0 0.0 523 KB

[Java][Metrics] Observability metrics stack with Java (Quarkus and Spring Boot) + Micrometer + Prometheus + Grafana

License: Apache License 2.0

Makefile 16.61% Java 83.39%

java-observability-metrics's Introduction

Observability: Monitoring your application from metrics

This repository contains sample Spring Boot and Quarkus application that exposes metrics to Prometheus and Grafana.

The goal of this project was to showcase how to instrumentation your application and collect and monitor application's metrics running inside docker compose.

More detail in this article written in PT-BR: Observabilidade: Monitorando sua aplicação a partir de métricas

Architecture

The project contains the following components:

Tecnologies:

  • Java 17
  • Spring Boot 3
  • Quarkus 2.15
  • Docker Compose
  • Prometheus 2.26
  • Grafana 9.3

Execution

We have two docker-compose files to separate the stack and applications

To facilitate the execution of this example, we created a Makefile script with the following instructions:

  • build: Execute build mvnw clean install on projects
  • install: Build the projects Dockerfile
  • run-stack: Execute only docker-compose-stack.yml
  • run-apps: Execute only docker-compose-apps.yml
  • run-all: Execute all steps above
  • stop-stack: Stop stack
  • stop-apps: Stop apps
  • stop-all: Stop stack and apps

Execute the desired instruction:

$make {desired-instruction}

Prometheus UI

Grafana UI

Test the apps métrics

Spring Boot: http://localhost:8081 Quarkus: http://localhost:8080

Both have a /hello endpoint with a Query Param name which will be metrified. The custom metrics generated are:

  • hello_get_method_timer: Time metric about method duration
  • hello_get_do_process_timer: Time metric about doProcess method duration
  • hello_get_name_length_limit: Count metric increases when the Query Param name exceed the length limit (currently 10)

Call that endpoint:

$curl 'http://localhost:{port}/hello?name={any name}'

Monitoring

We have Grafana as monitoring in conjunction with Prometheus listening to the metrics of the applications, a default dashbord was created that automatically goes up in Grafana; (dashboards location)

  • JVM (Micrometer) Dashboard

  • Application Metrics Dashboard

Contribute

Pull Requests are welcome. For important changes, open an 'issue' first to discuss what you would like to change. Be sure to update tests as appropriate.

Developer

Guilherme Biff Zarelli

Blog/Site - https://helpdev.com.br

LinkedIn - https://linkedin.com/in/gbzarelli/

GitHub - https://github.com/gbzarelli

Medium - https://medium.com/@guilherme.zarelli

Email - [email protected]

java-observability-metrics's People

Contributors

gbzarelli avatar

Stargazers

Leonardo dos Santos avatar  avatar Wallan Pereira avatar

Watchers

 avatar

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.