Skip to content

Hyune-s-lab/prometheus-grafana-tutorial

Repository files navigation

prometheus-grafana-tutorial

Environment

  • kotlin, spring 2.7.x
  • prometheus, grafana with docker
  • exporter
    • spring actuator, micrometer

How to run

docker 로 실행되는 spring application, mysql, prometheus, grafana prometheus, grafana datasource 도 연결 됩니다.

> run.sh

image

1. spring application (prometheus-grafana-tutorial)

GC 를 일으키기 위한 부하 자동 생성 LoadGenerator

  • heap 메모리 점유를 위한 로직 구현
  • 최대 메모리를 128M 로 설정

Database row 생성을 위한 API

POST http://localhost:8080/api/v1/redeemcode
  • 무작위 금액의 redeemcode row insert

actuator 세팅

2. prometheus

http://localhost:9090/

  1. status > targets 에 application 정상 여부 확인 image
  2. graph 탭에서 메트릭 조회 가능
    • jvm_memory_used_bytes{job="prometheus-grafana-tutorial"} image

3. grafana

http://localhost:3000/
admin / admin

dashboard 구성

  1. Wiki > monitor Link
    • json import
  2. dashboard 확인 image

4. 기타

datasource url 을 localhost 가 아닌 host.docker.internal 로 설정한 이유

시행 착오 2 - 도커 컨테이너에서 localhost 를 쓰면 어떻게 될까? 항목 참고 image

About

[tutorial] spring-boot, prometheus, grafana

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published