Spring actuator

Actuator ๋ž€

์Šคํ”„๋ง ๊ณต์‹๋ฌธ์„œ์—์„œ๋Š” Production-ready Features ๋ผ๋Š” ์†Œ์ œ๋ชฉ์œผ๋กœ ํ”„๋กœ๋•์…˜ ํ™˜๊ฒฝ์—์„œ์˜ ์–ดํ”Œ๋ฆฌ์ผ€์ด์…˜์— ๋Œ€ํ•œ ๋ชจ๋‹ˆํ„ฐ๋ง๊ณผ ๊ด€๋ฆฌ ์ด์Šˆ๋ฅผ ๋‹ค๋ฃจ๊ณ  ์žˆ๋‹ค.

์Šคํ”„๋ง์—์„œ๋Š” ์–ดํ”Œ๋ฆฌ์ผ€์ด์…˜์˜ ๋ชจ๋‹ˆํ„ฐ๋ง ๋ฐ ๊ด€๋ฆฌ๋ฅผ ์œ„ํ•ด์„œ ๋ช‡ ๊ฐ€์ง€ HTTP endpoint ๋ฅผ ๋…ธ์ถœ์‹œํ‚ค๋Š”๋ฐ, ์ด ๊ณผ์ •์„ ์ฑ…์ž„์ ธ ์ฃผ๋Š” ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ๊ฐ€ Spring actuator ์ด๋‹ค.

Actuator ์— ๋Œ€ํ•œ ์‚ฌ์ „์  ์ •์˜๋Š” ์•„๋ž˜์™€ ๊ฐ™๋‹ค.

Definition of Actuator

An actuator is a manufacturing term that refers to a mechanical device for moving or controlling something. Actuators can generate a large amount of motion from a small change.

mechanical device for moving or controlling ์ด ํ•ต์‹ฌ์ธ ๊ฒƒ ๊ฐ™๋‹ค. ๊ณต์‹ ๋ฌธ์„œ๋ฅผ ๋ณด๋ฉด ์—ฌ๋Ÿฌ๊ฐ€์ง€ endpoint๋“ค์„ ์ œ๊ณตํ•˜๊ณ  ์žˆ์Œ์„ ์•Œ ์ˆ˜ ์žˆ๊ณ , ๊ฐ endpoint ๋งˆ๋‹ค ๋…ธ์ถœ๋˜๋Š” ์ •๋ณด๊ฐ€ ๋‹ค๋ฅด๋‹ค. properties ์„ค์ •์„ ํ†ตํ•ด์„œ ๋…ธ์ถœ์‹œํ‚ฌ endpoint๋“ค์„ ๊ณ ๋ฅผ ์ˆ˜ ์žˆ๋‹ค.

Actuator์™€ prometheus ์—ฐ๋™์„ ์œ„ํ•ด์„œ๋Š” ์Šคํ”„๋ง ์–ดํ”Œ๋ฆฌ์ผ€์ด์…˜์˜ ์—ฌ๋Ÿฌ ์ •๋ณด๋“ค์„ prometheous ๊ฐ€ ๊ฐ€์ ธ๊ฐˆ ์ˆ˜ ์žˆ๋Š” ๋ฐฉ์‹์œผ๋กœ ๋…ธ์ถœ ์‹œ์ผœ์ค˜์•ผํ•œ๋‹ค. ์ƒ์‹์ ์œผ๋กœ prometheus๊ฐ€ ํ†ต์‹ ํ•˜๋Š” ์ธํ„ฐํŽ˜์ด์Šค๊ฐ€ ๋”ฐ๋กœ ์žˆ์„ ๊ฒƒ์ด๊ธฐ์— ๊ฑฐ๊ธฐ์— ๋งž๊ฒŒ ์Šคํ”„ ๋ง ์–ดํ”Œ๋ฆฌ์ผ€์ด์…˜์˜ ๋‚ด๋ถ€ ๋ฐ์ดํ„ฐ๋ฅผ ๋ณ€ํ˜•ํ•ด์ค„ ํ•„์š”๊ฐ€ ์žˆ์„ ๊ฒƒ์ด๋‹ค.

Actuator + Prometheus

๊ณต์‹๋ฌธ์„œ๋ฅผ ๋ณด๋ฉด prometheus ๋ผ๋Š” endpoint๊ฐ€ ์กด์žฌํ•จ์„ ์•Œ ์ˆ˜ ์žˆ๊ณ  ์„ค๋ช…์€ ์•„๋ž˜์™€ ๊ฐ™๋‹ค.

Exposes metrics in a format that can be scraped by a Prometheus server. Requires a dependency on micrometer-registry-prometheus.

์„ค๋ช…์„ ๋ณด๋ฉด micrometer-registry-prometheus๋ผ๋Š” ์ถ”๊ฐ€์ ์ธ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ๊ฐ€ ํ•„์š”ํ•จ์„ ์•Œ ์ˆ˜ ์žˆ๋‹ค.

micrometer ๊ณต์‹ ํ™ˆํŽ˜์ด์ง€ ๊ฐ€๋ณด๋ฉด ์•„๋ž˜์™€ ๊ฐ™์€ ์„ค๋ช…์ด ์žˆ๋‹ค.

Micrometer provides a simple facade over the instrumentation clients for the most popular monitoring systems, allowing you to instrument your JVM-based application code without vendor lock-in. Think SLF4J, but for metrics.

์‰ฝ๊ฒŒ ๋งํ•ด ์—ฌ๋Ÿฌ๊ฐ€์ง€ ์œ ๋ช…ํ•œ ๋ชจ๋‹ˆํ„ฐ๋ง ์‹œ์Šคํ…œ๋“ค์—๊ฒŒ facade ํ•˜๊ฒŒ ์ธํ„ฐํŽ˜์ด์Šค๋ฅผ ์ œ๊ณตํ•ด์ฃผ๋Š” ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ์ด๋‹ค. ๊ทธ๋ฆผ์œผ๋กœ ๋ณด๋ฉด ์•„๋ž˜์™€ ๊ฐ™๋‹ค.

์ด๋ฏธ actuator ์— micrometer-core ๊ฐ€ ํฌํ•จ๋˜์–ด ์žˆ๋‹ค. prometheus ์—ฐ๋™์„ ์œ„ํ•ด์„œ๋Š” micrometer-registry-prometheus๋งŒ ์ถ”๊ฐ€์ ์œผ๋กœ runtime scope ์œผ๋กœ ์˜์กด์„ฑ ์ถ”๊ฐ€๋ฅผ ํ•ด์ฃผ๋ฉด ๋œ๋‹ค.

    implementation("io.micrometer:micrometer-registry-prometheus")

์—ฌ๊ธฐ๊นŒ์ง€ Spring Application ์˜ prometheus ์—ฐ๋™์„ ์œ„ํ•œ ์ค€๋น„๋‹จ๊ณ„๋กœ Actuator์™€ ๊ทธ ์™ธ ํ•„์š”ํ•œ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ์— ๋Œ€ํ•ด์„œ ์‚ดํŽด๋ณธ ๋‚ด์šฉ์ด๋‹ค.

Last updated