Code Monkey home page Code Monkey logo

hello-observability's Introduction

Hello Observability

Simple Spring Boot application to demonstrate collecting and correlating logs, metrics and traces with Prometheus, OpenTelemetry, and Grafana Cloud. It is built using Maven.

Refer to this documentation for details.

To just see the application in action, you can build a jar file and run it from the command line.

git clone https://github.com/adamquan/hello-observability.git
cd hello-observability/hello-observability
./mvnw package
java -jar target/*.jar

You can then access Hello Observability here: http://localhost:8080/hello. Very simple application!

hello-observability

Or you can run it using Docker:

cd hello-observability/hello-observability
docker build -t hello-observability .
docker run -d -p 8080:8080 --name hello-observability hello-observability

Similarly, you can access the application here: http://localhost:8080/hello

You can stop the docker container using:

docker stop hello-observability

Note that when you run the application either using the Jar file or directly with docker, nothing will be collected. You will need start all services using docker-compose, either all locally or connect to Grafana Cloud, to generate and collect logs, metrics and traces.

Running everything locally

You can run the whole stack locally inside Docker, after building the application container. The whole stack contains:

  • The Hello Observability application
  • The simple load runner
  • Prometheus for metrics
  • Loki for logs
  • Tempo for traces
  • Grafana Agent to collect logs, metrics and traces
  • Grafana
cd hello-observability/local
docker-compose up

After all the containers are up, you can access the appliction here: http://localhost:8080/hello, and Grafana here: http://localhost:3000

Grafana

Import the dashboard from the dashboard.json file,

Import Dashboard

and see something beautiful!

Dashboard

Sending logs, metrics and traces to Grafana Cloud

You can also run the application locally, but send logs, metrics and traces to Grafana Cloud. You do need to configure the cloud/config/agent.yaml file with your Grafana Cloud information. Local components that starts inside Docker include:

  • The Hello Observability application
  • The simple load runner
  • Grafana Agent to collect logs, metrics and traces

The architecture looks like:

architecture

cd hello-observability/cloud
docker-compose up

Similary as you have done locally, import the dashboard and enjoy!

Here is a live version of the dashboard

hello-observability's People

Contributors

hongyinq avatar adamquan 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.