top of page

Springboot App Metrices push to opentelementary with grafna and prometheus

  • Writer: Anand Nerurkar
    Anand Nerurkar
  • Feb 16
  • 1 min read

Updated: Feb 18


develop springboot app with spring initlaizer as per github link

build and install, run it




add application.yml

==

spring:

application:

name: springappotdemo


management:

endpoints:

web:

exposure:

include: health,metrics,prometheus


promotheus is enabled


build and run it




let us create docker compose for promotheus and grafna as below

docker-compose.yml

====

version: '3'

services:

prometheus:

container_name: prometheus

image: prom/prometheus

restart: always

command:

- --config.file=/etc/prometheus/prometheus.yml

volumes:

- ./docker/prometheus/prometheus.yml:/etc/prometheus/prometheus.yml

ports:

- "9090:9090"



grafana:

container_name: grafana

image: grafana/grafana

ports:

- "3000:3000"


let us create docker/promotheus folder at project level and create promotheus.yml file as below


promotheus.yml

===

global:

scrape_interval: 10s

evaluation_interval: 10s


scrape_configs:

- job_name: 'otel-collector'

static_configs:

- targets: ['host.docker.internal:8889']



pls issue command docker compose up to set up promotheus and grafna


docker compose up -d






So we have successfully integrated grafna and prmetheus.



To integrate Springboot App with OpenTelementary

====



add entry for open telemntry into pom xml

 <dependency>

      <groupId>io.micrometer</groupId>

      <artifactId>micrometer-registry-otlp</artifactId>

      <scope>runtime</scope>

    </dependency>


update application.yml for opentelementry as below

otlp:

metrics:

export:

step: 10s


update docker compose.yml for open telementary collector


otel-collector:

image: otel/opentelemetry-collector-contrib:0.82.0

restart: always

command:

- --config=/etc/otelcol-contrib/otel-collector.yml

volumes:

- ./docker/collector/otel-collector.yml:/etc/otelcol-contrib/otel-collector.yml

ports:

- "1888:1888" # pprof extension

- "8888:8888" # Prometheus metrics exposed by the collector

- "8889:8889" # Prometheus exporter metrics

- "13133:13133" # health_check extension

- "4317:4317" # OTLP gRPC receiver

- "4318:4318" # OTLP http receiver

- "55679:55679" # zpages extension

 
 
 

Recent Posts

See All
SOC2

SOC 2  (System and Organization Controls 2) is a widely recognized compliance framework  that evaluates how an organization manages...

 
 
 
RTO & RPO

✅ 1. What is RTO (Recovery Time Objective)? Definition: RTO is the maximum acceptable downtime  after a failure or disaster.It defines...

 
 
 

Comments

Rated 0 out of 5 stars.
No ratings yet

Add a rating
  • Facebook
  • Twitter
  • LinkedIn

©2024 by AeeroTech. Proudly created with Wix.com

bottom of page