Skip to content

Latest commit

ย 

History

History
90 lines (73 loc) ยท 3.49 KB

File metadata and controls

90 lines (73 loc) ยท 3.49 KB

Spring Server monitoring

๐Ÿ‘‰๐Ÿป Goal

Let's check health of our springboot server!

Version

  • SpringBoot : 2.4.4
  • Java : 11

About Spring Boot 2.x Actuator

In 2.x, Actuator keeps its fundamental intent but simplifies its model, extends its capabilities, and incorporates better defaults. First, this version becomes technology-agnostic. It also simplifies its security model by merging it with the application one. Among the various changes, it's important to keep in mind that some of them are breaking. This includes HTTP requests and responses as well as Java APIs. Lastly, the latest version now supports the CRUD model as opposed to the old read/write model.


  • BaseURL
http://localhost:8080/actuator

/health

  • ์–ดํ”Œ๋ฆฌ์ผ€์ด์…˜์— ๋Œ€ํ•œ ๊ธฐ๋ณธ์ ์ธ ์ •๋ณด๋ฅผ ์ œ๊ณต
  • Status
    • Up : ์„œ๋ฒ„ ์ •์ƒ
    • Down : DB ์—ฐ๊ฒฐ ๋ฌธ์ œ, ๋˜๋Š” ๋””์Šคํฌ ๊ณต๊ฐ„ ๋ถ€์กฑ
http://localhost:8080/actuator/health

/metrics

http://localhost:8080/actuator/metrics
  • JVM memory ์‚ฌ์šฉ๋ฅ 
  • CPU usage
  • ๋ฉ”ํŠธ๋ฆญ์—์„œ ์ œ๊ณตํ•ด์ฃผ๋Š” ๊ธฐ๋Šฅ๋“ค์€ ๋งŽ๋‹ค. ์›ํ•˜๋Š” ๋ฉ”ํŠธ๋ฆญ์„ checkํ•  ์ˆ˜ ์žˆ๋‹ค.
  • ์˜ˆ๋ฅผ ๋“ค๋ฉด ๋‹ค์Œ๊ณผ ๊ฐ™๋‹ค.
http://localhost:8080/actuator/metrics/jvm.buffer.memory.used

/loggers

  • Application log ํ™•์ธ
  • Runtime์‹œ์ ์— log level์„ ๋ฐ”๊ฟ€ ์ˆ˜๋„ ์žˆ์Œ
http://localhost:8080/actuator/loggers

/info

http://localhost:8080/actuator/info

/shutdown

  • ๊ธฐ๋ณธ์ ์œผ๋กœ๋Š” false๋กœ ์„ค์ •๋˜์–ด ์žˆ์Œ
  • shutdown ์—”๋“œํฌ์ธํŠธ๋Š” ๋ณด์•ˆ์ด ์ค‘์š”.
  • ๋งŒ์•ฝ ๋…ธ์ถœํ•œ๋‹ค๋ฉด ๊ผญ ๋ณด์•ˆ์„ ์„ค์ •ํ•  ๊ฒƒ(SpringSecurity)

๊ทธ ์™ธ์˜ ๋‹ค์–‘ํ•œ ๊ธฐ๋Šฅ๋“ค

Unlike in previous versions, Actuator comes with most endpoints disabled. Thus, the only two available by default are /health and /info. If we want to enable all of them, we could set management.endpoints.web.exposure.include=*. Alternatively, we can list endpoints that should be enabled.

Spec์— ๋Œ€ํ•ด ์กฐ์‚ฌํ•˜๊ณ  ์‚ฌ์šฉํ•  ๊ฒƒ(์‚ฌ์šฉ๋ฒ•์ด ๋‹ค ๋‹ค๋ฆ„)

  • /auditevents lists security audit-related events such as user login/logout. Also, we can filter by principal or type among other fields.
  • /beans returns all available beans in our BeanFactory. Unlike /auditevents, it doesn't support filtering.
  • /conditions, formerly known as /autoconfig, builds a report of conditions around autoconfiguration.
  • /configprops allows us to fetch all @ConfigurationProperties beans.
  • /env returns the current environment properties. Additionally, we can retrieve single properties.
  • /flyway provides details about our Flyway database migrations.
  • /health summarizes the health status of our application.
  • /heapdump builds and returns a heap dump from the JVM used by our application.
  • /info returns general information. It might be custom data, build information or details about the latest commit.
  • /liquibase behaves like /flyway but for Liquibase.
  • /logfile returns ordinary application logs.
  • /loggers enables us to query and modify the logging level of our application.
  • /metrics details metrics of our application. This might include generic metrics as well as custom ones.
  • /prometheus returns metrics like the previous one, but formatted to work with a Prometheus server.
  • /scheduledtasks provides details about every scheduled task within our application.
  • /sessions lists HTTP sessions given we are using Spring Session.
  • /shutdown performs a graceful shutdown of the application.
  • /threaddump dumps the thread information of the underlying JVM.