{"id":483258,"date":"2026-06-11T06:00:45","date_gmt":"2026-06-11T06:00:45","guid":{"rendered":"https:\/\/savepearlharbor.com\/?p=483258"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=483258","title":{"rendered":"\u0414\u0435\u043b\u043e \u043e \u043c\u043e\u043b\u0447\u0430\u043b\u0438\u0432\u043e\u0439 JVM: \u043c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u043d\u0433 Spring Boot \u0441 Prometheus \u0438 Grafana. Production-\u043d\u0443\u0430\u0440"},"content":{"rendered":"<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p><em>\u041e\u043d\u0430 \u0443\u043c\u0435\u0440\u043b\u0430 \u0432 \u0432\u043e\u0441\u043a\u0440\u0435\u0441\u0435\u043d\u044c\u0435 \u0432\u0435\u0447\u0435\u0440\u043e\u043c, \u0438 \u043d\u0438\u043a\u0442\u043e \u043d\u0435 \u0443\u0441\u043b\u044b\u0448\u0430\u043b \u043d\u0438 \u0437\u0432\u0443\u043a\u0430. \u0414\u0435\u0442\u0435\u043a\u0442\u0438\u0432\u043d\u0430\u044f \u0438\u0441\u0442\u043e\u0440\u0438\u044f \u043e \u0442\u043e\u043c, \u043a\u0430\u043a \u043f\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u043f\u0440\u043e\u0441\u043b\u0443\u0448\u043a\u0443 \u043d\u0430 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435: Prometheus, Grafana, Micrometer, \u0430\u043b\u0435\u0440\u0442\u044b, SLO. \u0412\u0441\u0435 \u0443\u043b\u0438\u043a\u0438 \u0432 \u043a\u043e\u043c\u043f\u043b\u0435\u043a\u0442\u0435, \u0434\u0435\u043c\u043e-\u043f\u0440\u043e\u0435\u043a\u0442 \u043f\u0440\u0438\u043b\u0430\u0433\u0430\u0435\u0442\u0441\u044f. \u0421\u043e\u0432\u043f\u0430\u0434\u0435\u043d\u0438\u044f \u0441 \u0432\u0430\u0448\u0438\u043c \u043f\u0440\u043e\u0434\u0430\u043a\u0448\u0435\u043d\u043e\u043c \u043d\u0435 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b.<\/em><\/p>\n<hr\/>\n<h3>\u041f\u0440\u043e\u043b\u043e\u0433. \u0422\u0435\u043b\u043e<\/h3>\n<p>\u0413\u043e\u0440\u043e\u0434 \u0441\u043f\u0430\u043b. \u042f &#8212; \u043d\u0435\u0442.<\/p>\n<p>\u0412\u043e\u0441\u043a\u0440\u0435\u0441\u0435\u043d\u044c\u0435, \u0432\u043e\u0441\u0435\u043c\u044c \u0432\u0435\u0447\u0435\u0440\u0430. \u0414\u043e\u0436\u0434\u044c \u0441\u0442\u0443\u0447\u0430\u043b \u0432 \u043e\u043a\u043d\u043e, \u043a\u0430\u043a healthcheck \u043f\u043e \u043c\u0451\u0440\u0442\u0432\u043e\u043c\u0443 \u044d\u043d\u0434\u043f\u043e\u0438\u043d\u0442\u0443: \u043c\u0435\u0442\u043e\u0434\u0438\u0447\u043d\u043e \u0438 \u0431\u0435\u0437 \u043d\u0430\u0434\u0435\u0436\u0434\u044b \u043d\u0430 \u043e\u0442\u0432\u0435\u0442. \u041d\u0430 \u0441\u0442\u043e\u043b\u0435 \u043e\u0441\u0442\u044b\u0432\u0430\u043b \u0443\u0436\u0438\u043d. \u0417\u0430\u0437\u0432\u043e\u043d\u0438\u043b \u0442\u0435\u043b\u0435\u0444\u043e\u043d. \u041b\u0451\u0448\u0430, \u0442\u0438\u043c\u043b\u0438\u0434. \u041b\u0451\u0448\u0430 \u043f\u043e \u0432\u043e\u0441\u043a\u0440\u0435\u0441\u0435\u043d\u044c\u044f\u043c \u043d\u0435 \u0437\u0432\u043e\u043d\u0438\u0442. \u041f\u043e \u0432\u043e\u0441\u043a\u0440\u0435\u0441\u0435\u043d\u044c\u044f\u043c \u043e\u043d \u043e\u0442\u0435\u0446, \u043c\u0443\u0436 \u0438 \u0447\u0435\u043b\u043e\u0432\u0435\u043a. \u0415\u0441\u043b\u0438 \u0437\u0432\u043e\u043d\u0438\u0442, \u0437\u043d\u0430\u0447\u0438\u0442, \u0447\u0435\u043b\u043e\u0432\u0435\u043a\u043e\u043c \u0441\u0435\u0433\u043e\u0434\u043d\u044f \u043f\u043e\u0431\u044b\u0442\u044c \u043d\u0435 \u0432\u044b\u0439\u0434\u0435\u0442 \u043d\u0438 \u0435\u043c\u0443, \u043d\u0438 \u043c\u043d\u0435.<\/p>\n<p>\u2014 \u0423 \u043d\u0430\u0441 \u0442\u0440\u0443\u043f, \u2014 \u0441\u043a\u0430\u0437\u0430\u043b \u043e\u043d. \u2014 \u041a\u0442\u043e? \u2014 Production. \u041b\u0435\u0436\u0438\u0442. \u041d\u0435 \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442.<\/p>\n<p>\u042f \u0432\u044b\u0435\u0445\u0430\u043b \u043d\u0435\u043c\u0435\u0434\u043b\u0435\u043d\u043d\u043e. \u0422\u043e \u0435\u0441\u0442\u044c \u043e\u0442\u043a\u0440\u044b\u043b \u043d\u043e\u0443\u0442\u0431\u0443\u043a, \u043d\u0435 \u0432\u0441\u0442\u0430\u0432\u0430\u044f \u0441 \u0434\u0438\u0432\u0430\u043d\u0430. \u0412 \u043d\u0430\u0448\u0435\u043c \u0434\u0435\u043b\u0435 \u044d\u0442\u043e \u0438 \u0435\u0441\u0442\u044c \u00ab\u0432\u044b\u0435\u0445\u0430\u043b \u043d\u0435\u043c\u0435\u0434\u043b\u0435\u043d\u043d\u043e\u00bb.<\/p>\n<p>\u041a\u0430\u0440\u0442\u0438\u043d\u0430 \u043f\u0440\u0435\u0441\u0442\u0443\u043f\u043b\u0435\u043d\u0438\u044f \u0431\u044b\u043b\u0430 \u0447\u0438\u0441\u0442\u043e\u0439. \u0421\u043b\u0438\u0448\u043a\u043e\u043c \u0447\u0438\u0441\u0442\u043e\u0439. JVM \u043b\u0435\u0436\u0430\u043b\u0430 \u043e\u0441\u0442\u044b\u0432\u0448\u0430\u044f, \u0431\u0435\u0437 \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u043e\u0432 \u0436\u0438\u0437\u043d\u0438. \u041d\u0438 \u043f\u0440\u0435\u0434\u0441\u043c\u0435\u0440\u0442\u043d\u043e\u0439, \u043d\u0438 \u043a\u0440\u0438\u043a\u043e\u0432 \u0432 \u043b\u043e\u0433\u0430\u0445, \u043d\u0438 \u043e\u0434\u043d\u043e\u0433\u043e \u0441\u0432\u0438\u0434\u0435\u0442\u0435\u043b\u044f. OutOfMemoryError, \u0433\u043b\u0430\u0441\u0438\u043b\u043e \u0437\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043c\u044b \u0434\u043e\u0431\u044b\u043b\u0438 \u0442\u043e\u043b\u044c\u043a\u043e \u0447\u0435\u0440\u0435\u0437 \u0447\u0435\u0442\u044b\u0440\u0435 \u0447\u0430\u0441\u0430 \u0432\u0441\u043a\u0440\u044b\u0442\u0438\u044f. \u0427\u0435\u0442\u044b\u0440\u0435 \u0447\u0430\u0441\u0430 \u043c\u043e\u0435\u0439 \u0436\u0438\u0437\u043d\u0438. \u0423\u0436\u0438\u043d \u043a \u0442\u043e\u043c\u0443 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u043e\u043a\u043e\u0447\u0435\u043d\u0435\u043b \u0432\u043c\u0435\u0441\u0442\u0435 \u0441 \u043f\u043e\u0442\u0435\u0440\u043f\u0435\u0432\u0448\u0435\u0439.<\/p>\n<p>\u041d\u043e \u0432\u043e\u0442 \u0447\u0442\u043e \u043d\u0435 \u0434\u0430\u0432\u0430\u043b\u043e \u043c\u043d\u0435 \u043f\u043e\u043a\u043e\u044f, \u043a\u043e\u0433\u0434\u0430 \u044f \u043e\u0442\u043c\u043e\u0442\u0430\u043b \u043f\u043b\u0451\u043d\u043a\u0443 GC-\u043b\u043e\u0433\u043e\u0432 \u043d\u0430\u0437\u0430\u0434. Heap \u0431\u044b\u043b \u0437\u0430\u0431\u0438\u0442 \u043d\u0430 95% <strong>\u0434\u0432\u043e\u0435 \u0441\u0443\u0442\u043e\u043a<\/strong>. \u0414\u0432\u043e\u0435 \u0441\u0443\u0442\u043e\u043a \u0436\u0435\u0440\u0442\u0432\u0430 \u0445\u043e\u0434\u0438\u043b\u0430 \u043f\u043e \u0433\u043e\u0440\u043e\u0434\u0443 \u0441 \u043d\u043e\u0436\u043e\u043c \u0432 \u0441\u043f\u0438\u043d\u0435 \u0438 \u0443\u043b\u044b\u0431\u0430\u043b\u0430\u0441\u044c \u043f\u0440\u043e\u0445\u043e\u0436\u0438\u043c. \u0414\u0432\u043e\u0435 \u0441\u0443\u0442\u043e\u043a \u043b\u044e\u0431\u043e\u0439 \u043c\u043e\u0433 \u0432\u0437\u0433\u043b\u044f\u043d\u0443\u0442\u044c \u043d\u0430 \u043d\u0435\u0451 \u0438 \u0441\u043a\u0430\u0437\u0430\u0442\u044c: \u00ab\u0414\u0430\u043c\u043e\u0447\u043a\u0430, \u0434\u0430 \u0432\u044b \u0436\u0435 \u0435\u043b\u0435 \u0434\u044b\u0448\u0438\u0442\u0435\u00bb. \u041d\u0438\u043a\u0442\u043e \u043d\u0435 \u0432\u0437\u0433\u043b\u044f\u043d\u0443\u043b. \u041f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0431\u044b\u043b\u043e \u043d\u0435\u043a\u043e\u043c\u0443.<\/p>\n<p>\u0412 \u043f\u043e\u043d\u0435\u0434\u0435\u043b\u044c\u043d\u0438\u043a \u0443\u0442\u0440\u043e\u043c \u041b\u0451\u0448\u0430 \u0441\u043e\u0431\u0440\u0430\u043b \u0432\u0441\u0435\u0445 \u0432 \u0443\u0447\u0430\u0441\u0442\u043a\u0435 \u0438 \u0441\u043a\u0430\u0437\u0430\u043b \u0442\u043e, \u0447\u0442\u043e \u0434\u043e\u043b\u0436\u043d\u044b \u0431\u044b\u043b\u0438 \u0441\u043a\u0430\u0437\u0430\u0442\u044c \u0434\u0430\u0432\u043d\u044b\u043c-\u0434\u0430\u0432\u043d\u043e:<\/p>\n<p>\u2014 \u042f \u0431\u043e\u043b\u044c\u0448\u0435 \u043d\u0435 \u0445\u043e\u0447\u0443 \u0443\u0437\u043d\u0430\u0432\u0430\u0442\u044c \u043e \u0442\u0440\u0443\u043f\u0430\u0445 \u043e\u0442 \u043c\u044d\u0440\u0430. \u042f \u0445\u043e\u0447\u0443 \u0443\u0437\u043d\u0430\u0432\u0430\u0442\u044c \u043e \u043d\u0438\u0445 \u043e\u0442 \u043e\u0441\u0432\u0435\u0434\u043e\u043c\u0438\u0442\u0435\u043b\u0435\u0439. \u0416\u0435\u043b\u0430\u0442\u0435\u043b\u044c\u043d\u043e, \u043f\u043e\u043a\u0430 \u043e\u043d\u0438 \u0435\u0449\u0451 \u0436\u0438\u0432\u044b.<\/p>\n<p>\u0422\u0430\u043a \u043e\u0442\u043a\u0440\u044b\u043b\u043e\u0441\u044c \u044d\u0442\u043e \u0434\u0435\u043b\u043e. \u0414\u0435\u043b\u043e \u2116 1142, \u00ab\u041c\u043e\u043b\u0447\u0430\u043b\u0438\u0432\u0430\u044f JVM\u00bb. \u042f \u0432\u0451\u043b \u0435\u0433\u043e \u0448\u0435\u0441\u0442\u044c \u043d\u0435\u0434\u0435\u043b\u044c. \u0414\u0435\u0439\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u043b\u0438\u0446\u0430: \u041b\u0451\u0448\u0430 \u2014 \u043a\u0430\u043f\u0438\u0442\u0430\u043d, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0434\u0430\u0432\u044f\u0442 \u0441\u0432\u0435\u0440\u0445\u0443. \u0414\u0430\u043d\u044f \u2014 \u0441\u0442\u0430\u0436\u0451\u0440 \u0441 \u0433\u043e\u0440\u044f\u0449\u0438\u043c\u0438 \u0433\u043b\u0430\u0437\u0430\u043c\u0438, \u0435\u0449\u0451 \u0432\u0435\u0440\u0438\u0442, \u0447\u0442\u043e \u043f\u0440\u0430\u0432\u0434\u0443 \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u0432 \u043b\u043e\u0433\u0430\u0445. \u0411\u043e\u0440\u0438\u0441 \u0410\u0440\u043a\u0430\u0434\u044c\u0435\u0432\u0438\u0447 \u2014 \u043c\u044d\u0440 \u0433\u043e\u0440\u043e\u0434\u0430, \u0447\u0435\u043b\u043e\u0432\u0435\u043a, \u0434\u0430\u043b\u0451\u043a\u0438\u0439 \u043e\u0442 \u043f\u0435\u0440\u0446\u0435\u043d\u0442\u0438\u043b\u0435\u0439, \u043d\u043e \u0431\u043b\u0438\u0437\u043a\u0438\u0439 \u043a \u0431\u044e\u0434\u0436\u0435\u0442\u0443. \u0418 \u0421\u0435\u0440\u0451\u0433\u0430 \u2014 \u043c\u043e\u0439 \u0441\u0442\u0430\u0440\u044b\u0439 \u043d\u0430\u043f\u0430\u0440\u043d\u0438\u043a \u0438\u0437 \u0441\u043e\u0441\u0435\u0434\u043d\u0435\u0433\u043e \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f. \u0421\u0435\u0440\u0451\u0433\u0430 \u043a\u043e\u0433\u0434\u0430-\u0442\u043e \u0432\u0451\u043b \u0434\u0435\u043b\u043e \u043e \u043a\u0430\u0440\u0434\u0438\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u0438. \u0421 \u0442\u0435\u0445 \u043f\u043e\u0440 \u0443 \u043d\u0435\u0433\u043e \u0441\u0435\u0434\u0438\u043d\u0430 \u0438 \u043f\u0440\u0438\u0432\u044b\u0447\u043a\u0430 \u0432\u0437\u0434\u0440\u0430\u0433\u0438\u0432\u0430\u0442\u044c \u043e\u0442 \u0441\u043b\u043e\u0432 \u00abuser_id\u00bb.<\/p>\n<p>\u0418 \u0435\u0449\u0451 \u0432 \u044d\u0442\u043e\u043c \u0434\u0435\u043b\u0435 \u0431\u0443\u0434\u0443\u0442 \u0442\u0440\u043e\u0435, \u043a\u043e\u0433\u043e \u044f \u0437\u0430\u0432\u0435\u0440\u0431\u043e\u0432\u0430\u043b. \u0410\u0440\u0445\u0438\u0432\u0430\u0440\u0438\u0443\u0441 \u043f\u043e \u0438\u043c\u0435\u043d\u0438 \u041f\u0440\u043e\u043c\u0435\u0442\u0435\u0439: \u0444\u043e\u0442\u043e\u0433\u0440\u0430\u0444\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u043f\u0430\u043c\u044f\u0442\u044c, \u043f\u043e\u043c\u043d\u0438\u0442 \u0432\u0441\u0451, \u0447\u0442\u043e \u0432\u0438\u0434\u0435\u043b, \u043d\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u0437\u0430 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u043c\u0435\u0441\u044f\u0446, \u0442\u0430\u043a\u043e\u0439 \u0443 \u043d\u0435\u0433\u043e \u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442. \u041e\u0441\u0432\u0435\u0434\u043e\u043c\u0438\u0442\u0435\u043b\u044c\u043d\u0438\u0446\u0430 \u0413\u0440\u0435\u0439\u0441: \u0440\u0438\u0441\u0443\u0435\u0442 \u043a\u0430\u0440\u0442\u0438\u043d\u0443 \u0433\u043e\u0440\u043e\u0434\u0430 \u043b\u0443\u0447\u0448\u0435 \u043b\u044e\u0431\u043e\u0433\u043e \u0448\u0442\u0430\u0442\u043d\u043e\u0433\u043e \u0445\u0443\u0434\u043e\u0436\u043d\u0438\u043a\u0430. \u0418 \u0434\u0438\u0441\u043f\u0435\u0442\u0447\u0435\u0440 \u043d\u0430 \u043a\u043e\u043c\u043c\u0443\u0442\u0430\u0442\u043e\u0440\u0435: \u0431\u0443\u0434\u0438\u0442 \u043d\u0443\u0436\u043d\u044b\u0445 \u043b\u044e\u0434\u0435\u0439 \u0432 \u043d\u0443\u0436\u043d\u043e\u0435 \u0432\u0440\u0435\u043c\u044f. \u041d\u0435 \u043f\u0443\u0442\u0430\u0442\u044c \u0441 \u043d\u0435\u043d\u0443\u0436\u043d\u044b\u043c\u0438 \u043b\u044e\u0434\u044c\u043c\u0438 \u0432 \u043d\u0435\u043d\u0443\u0436\u043d\u043e\u0435 \u0432\u0440\u0435\u043c\u044f, \u044d\u0442\u043e\u043c\u0443 \u043a\u043e\u043c\u043c\u0443\u0442\u0430\u0442\u043e\u0440 \u0442\u043e\u0436\u0435 \u043e\u0431\u0443\u0447\u0435\u043d, \u043d\u043e \u043e\u0431 \u044d\u0442\u043e\u043c \u043f\u043e\u0437\u0436\u0435.<\/p>\n<p><strong>\u041f\u043e\u0447\u0435\u043c\u0443 \u0438\u043c\u0435\u043d\u043d\u043e Prometheus, Grafana \u0438 Micrometer?<\/strong><\/p>\n<p>\u042f \u0441\u043f\u0440\u043e\u0441\u0438\u043b \u0421\u0435\u0440\u0451\u0433\u0443. \u0421\u0435\u0440\u0451\u0433\u0430 \u0437\u0430\u0442\u044f\u043d\u0443\u043b\u0441\u044f \u043a\u043e\u0444\u0435, \u043a\u0430\u043a \u0441\u0438\u0433\u0430\u0440\u0435\u0442\u043e\u0439, \u0438 \u0441\u043a\u0430\u0437\u0430\u043b: \u00ab\u041f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0431\u0435\u0441\u043f\u043b\u0430\u0442\u043d\u043e. \u041f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442. \u0418 \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e Micrometer \u0443\u0436\u0435 \u0441\u0438\u0434\u0438\u0442 \u0432 \u0442\u0432\u043e\u0451\u043c Spring Boot\u00bb. \u041e\u0442 \u0441\u0435\u0431\u044f \u0434\u043e\u0431\u0430\u0432\u043b\u044e: \u044d\u0442\u0443 \u0442\u0440\u043e\u0438\u0446\u0443 \u0441\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u044e\u0442 \u043d\u0430 \u0441\u043e\u0431\u0435\u0441\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u044f\u0445. \u0410 \u0437\u0430\u0440\u043f\u043b\u0430\u0442\u0430 &#8212; \u043b\u0443\u0447\u0448\u0438\u0439 \u0441\u0442\u0438\u043c\u0443\u043b \u043a \u0440\u0430\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u044e, \u0447\u0442\u043e \u0431\u044b \u0442\u0430\u043c \u043d\u0438 \u043f\u0438\u0441\u0430\u043b\u0438 \u0432 \u0434\u0435\u0442\u0435\u043a\u0442\u0438\u0432\u0430\u0445 \u043f\u0440\u043e \u0436\u0430\u0436\u0434\u0443 \u0441\u043f\u0440\u0430\u0432\u0435\u0434\u043b\u0438\u0432\u043e\u0441\u0442\u0438.<\/p>\n<p>\u041f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0431\u0435\u0437 \u043c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u043d\u0433\u0430 &#8212; \u044d\u0442\u043e \u0433\u043e\u0440\u043e\u0434 \u0431\u0435\u0437 \u0435\u0434\u0438\u043d\u043e\u0433\u043e \u0444\u043e\u043d\u0430\u0440\u044f. \u0416\u0438\u0442\u044c \u043c\u043e\u0436\u043d\u043e. \u041d\u0435\u0434\u043e\u043b\u0433\u043e.<\/p>\n<p>\u041f\u043e\u0435\u0445\u0430\u043b\u0438. \u0427\u0435\u0440\u0435\u0437 \u0434\u0435\u0441\u044f\u0442\u044c \u043c\u0438\u043d\u0443\u0442 \u0443 \u0432\u0430\u0441 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u043e\u0441\u043b\u0443\u0448\u043a\u0430. \u0427\u0435\u0440\u0435\u0437 \u0447\u0430\u0441 &#8212; \u0441\u0435\u0442\u044c \u043e\u0441\u0432\u0435\u0434\u043e\u043c\u0438\u0442\u0435\u043b\u0435\u0439, \u0441 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043c\u043e\u0436\u043d\u043e \u0441\u043f\u0430\u0442\u044c \u043f\u043e \u043d\u043e\u0447\u0430\u043c. \u041f\u043e\u0447\u0442\u0438. \u0421\u043e\u0432\u0441\u0435\u043c \u0441\u043f\u043e\u043a\u043e\u0439\u043d\u043e \u0432 \u044d\u0442\u043e\u043c \u0433\u043e\u0440\u043e\u0434\u0435 \u0441\u043f\u044f\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0442\u0435, \u0443 \u043a\u043e\u0433\u043e \u043d\u0435\u0442 production.<\/p>\n<hr\/>\n<h3>\u042d\u043f\u0438\u0437\u043e\u0434 1. \u041f\u0440\u043e\u0441\u043b\u0443\u0448\u043a\u0430: \u043f\u0435\u0440\u0432\u044b\u0435 \u043c\u0435\u0442\u0440\u0438\u043a\u0438 \u0437\u0430 10 \u043c\u0438\u043d\u0443\u0442<\/h3>\n<p>\u0412 \u043f\u043e\u043d\u0435\u0434\u0435\u043b\u044c\u043d\u0438\u043a \u043f\u043e\u0441\u043b\u0435 \u043e\u0431\u0435\u0434\u0430 \u0441\u0442\u0430\u0436\u0451\u0440 \u0414\u0430\u043d\u044f \u043f\u043e\u0434\u043e\u0448\u0451\u043b \u043a\u043e \u043c\u043d\u0435 \u0441 \u043b\u0438\u0446\u043e\u043c \u0447\u0435\u043b\u043e\u0432\u0435\u043a\u0430, \u0433\u043e\u0442\u043e\u0432\u043e\u0433\u043e \u043a \u0445\u0443\u0434\u0448\u0435\u043c\u0443:<\/p>\n<p>\u2014 \u041d\u0430\u043c \u0442\u0435\u043f\u0435\u0440\u044c \u043f\u0438\u0441\u0430\u0442\u044c \u043a\u0430\u043a\u043e\u0433\u043e-\u0442\u043e \u0430\u0433\u0435\u043d\u0442\u0430? \u0421\u043e\u0431\u0438\u0440\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0440\u0443\u043a\u0430\u043c\u0438? \u042d\u0442\u043e \u0436\u0435 \u043d\u0435\u0434\u0435\u043b\u0438.<\/p>\n<p>\u041d\u0435\u0442, \u043f\u0430\u0440\u0435\u043d\u044c. \u0418 \u0432 \u044d\u0442\u043e\u043c \u043f\u0435\u0440\u0432\u044b\u0439 \u043f\u043e\u0432\u043e\u0440\u043e\u0442 \u0441\u044e\u0436\u0435\u0442\u0430: \u043f\u0440\u043e\u0441\u043b\u0443\u0448\u043a\u0430 \u0443\u0436\u0435 \u0441\u0442\u043e\u0438\u0442. \u0415\u0451 \u043f\u043e\u0441\u0442\u0430\u0432\u0438\u043b\u0438 \u0434\u043e \u043d\u0430\u0441. \u041e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u0432\u043e\u0442\u043a\u043d\u0443\u0442\u044c \u043d\u0430\u0443\u0448\u043d\u0438\u043a\u0438.<\/p>\n<h4>\u041c\u0435\u0441\u0442\u043e \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f<\/h4>\n<p>\u0414\u0435\u043b\u043e \u0440\u0430\u0437\u0432\u0435\u0440\u043d\u0451\u0442\u0441\u044f \u0432\u043e\u043a\u0440\u0443\u0433 TODO-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f. \u041e\u0431\u044a\u0435\u043a\u0442 \u043d\u0430\u043c\u0435\u0440\u0435\u043d\u043d\u043e \u0441\u043a\u0443\u0447\u043d\u044b\u0439: \u0437\u0430\u0434\u0430\u0447\u0438 \u0441\u043e\u0437\u0434\u0430\u044e\u0442\u0441\u044f, \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044e\u0442\u0441\u044f, \u0443\u0434\u0430\u043b\u044f\u044e\u0442\u0441\u044f. \u0421\u043a\u0443\u0447\u043d\u044b\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u044f \u043b\u044e\u0431\u043b\u044e. \u0412\u0441\u044f \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u0430\u044f \u0436\u0438\u0437\u043d\u044c \u0443 \u043d\u0438\u0445, \u043a\u0430\u043a \u0432\u043e\u0434\u0438\u0442\u0441\u044f, \u0442\u0430\u0439\u043d\u0430\u044f.<\/p>\n<pre><code>todo-monitoring-demo\/\u251c\u2500\u2500 src\/main\/java\/com\/example\/todo\/\u2502   \u251c\u2500\u2500 controller\/\u2502   \u2502   \u251c\u2500\u2500 TaskController.java          # CRUD \u043f\u043e \u0437\u0430\u0434\u0430\u0447\u0430\u043c\u2502   \u2502   \u2514\u2500\u2500 DemoController.java          # \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440 \u043b\u0430\u0442\u0435\u043d\u0442\u043d\u043e\u0441\u0442\u0438 \u0438 5xx \u0434\u043b\u044f \u0434\u0435\u043c\u043e\u2502   \u251c\u2500\u2500 service\/TaskService.java\u2502   \u251c\u2500\u2500 repository\/TaskRepository.java\u2502   \u251c\u2500\u2500 model\/                           # Task, TaskStatus, TaskPriority\u2502   \u251c\u2500\u2500 event\/                           # TaskCreatedEvent, TaskCompletedEvent, ...\u2502   \u2514\u2500\u2500 config\/\u2502       \u251c\u2500\u2500 SecurityConfig.java\u2502       \u251c\u2500\u2500 MeterRegistryConfig.java\u2502       \u251c\u2500\u2500 RepositoryMetricsAspect.java\u2502       \u251c\u2500\u2500 CustomWebMvcTagsContributor.java\u2502       \u251c\u2500\u2500 MetricsEventListener.java\u2502       \u2514\u2500\u2500 DemoTrafficGenerator.java    # \u0434\u0435\u043c\u043e-\u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0430, \u0447\u0442\u043e\u0431\u044b \u0433\u0440\u0430\u0444\u0438\u043a\u0438 \u043e\u0436\u0438\u043b\u0438\u251c\u2500\u2500 src\/main\/resources\/\u2502   \u2514\u2500\u2500 application.yml\u251c\u2500\u2500 Dockerfile\u251c\u2500\u2500 docker-compose.yml\u251c\u2500\u2500 prometheus\/\u2502   \u251c\u2500\u2500 prometheus.yml\u2502   \u251c\u2500\u2500 alert-rules.yml\u2502   \u251c\u2500\u2500 recording-rules.yml\u2502   \u251c\u2500\u2500 slo-rules.yml\u2502   \u2514\u2500\u2500 alertmanager.yml\u2514\u2500\u2500 grafana\/    \u251c\u2500\u2500 dashboards\/    \u2502   \u251c\u2500\u2500 dashboard.yml    \u2502   \u2514\u2500\u2500 todo-app-dashboard.json    \u2514\u2500\u2500 datasources.yml<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:87px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<h4>\u0428\u0430\u0433 1: \u0417\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438<\/h4>\n<p>\u0414\u0432\u0435 \u0441\u0442\u0440\u043e\u0447\u043a\u0438. \u0412\u0441\u0435\u0433\u043e \u0434\u0432\u0435. \u041d\u0435 \u043f\u044f\u0442\u044c, \u043d\u0435 \u0434\u0435\u0441\u044f\u0442\u044c. \u0414\u0432\u0435. \u0412 \u043c\u0438\u0440\u0435, \u0433\u0434\u0435 \u0434\u043b\u044f \u00abHello World\u00bb \u043d\u0443\u0436\u043d\u043e 200 \u043c\u0435\u0433\u0430\u0431\u0430\u0439\u0442 node_modules, \u044d\u0442\u043e \u043f\u043e\u0447\u0442\u0438 \u043f\u043e\u0434\u043e\u0437\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e.<\/p>\n<pre><code class=\"xml\">&lt;!-- Spring Boot Actuator - \u043e\u0441\u043d\u043e\u0432\u0430 \u043c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u043d\u0433\u0430 --&gt;&lt;dependency&gt;    &lt;groupId&gt;org.springframework.boot&lt;\/groupId&gt;    &lt;artifactId&gt;spring-boot-starter-actuator&lt;\/artifactId&gt;&lt;\/dependency&gt;&lt;!-- Micrometer Prometheus Registry - \u044d\u043a\u0441\u043f\u043e\u0440\u0442 \u043c\u0435\u0442\u0440\u0438\u043a --&gt;&lt;dependency&gt;    &lt;groupId&gt;io.micrometer&lt;\/groupId&gt;    &lt;artifactId&gt;micrometer-registry-prometheus&lt;\/artifactId&gt;&lt;\/dependency&gt;<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p>Actuator \u0441\u0430\u043c \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u0442 \u0434\u0435\u0441\u044f\u0442\u043a\u0438 \u0436\u0443\u0447\u043a\u043e\u0432: JVM, HTTP-\u0437\u0430\u043f\u0440\u043e\u0441\u044b, connection pools. \u0418 \u0432\u044b\u0432\u043e\u0434\u0438\u0442 \u0432\u0441\u0451 \u043d\u0430 endpoint <code>\/actuator\/prometheus<\/code>. Spring Boot 3.x \u0442\u044f\u043d\u0435\u0442 \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u0438\u043c\u044b\u0439 Micrometer \u0431\u0435\u0437 \u043b\u0438\u0448\u043d\u0438\u0445 \u0432\u043e\u043f\u0440\u043e\u0441\u043e\u0432, \u0432\u0435\u0440\u0441\u0438\u0438 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u043d\u0435 \u043d\u0443\u0436\u043d\u043e.<\/p>\n<p>\u0414\u0430\u043d\u044f \u0441\u043c\u043e\u0442\u0440\u0435\u043b \u043d\u0430 \u044d\u0442\u0438 \u0434\u0432\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u0441 \u043f\u043e\u0434\u043e\u0437\u0440\u0435\u043d\u0438\u0435\u043c. \u041f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u0441\u043c\u043e\u0442\u0440\u0435\u043b. \u041a\u043e\u0433\u0434\u0430 \u0432 \u043d\u0430\u0448\u0435\u043c \u0434\u0435\u043b\u0435 \u0447\u0442\u043e-\u0442\u043e \u0434\u043e\u0441\u0442\u0430\u0451\u0442\u0441\u044f \u043b\u0435\u0433\u043a\u043e, \u0436\u0434\u0438 \u0441\u0447\u0451\u0442\u0430. \u0421\u0447\u0451\u0442 \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u0437\u0436\u0435.<\/p>\n<h4>\u0428\u0430\u0433 2: \u041a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044f<\/h4>\n<pre><code class=\"yaml\"># application.ymlspring:  application:    name: todo-monitoring-demo    datasource:    hikari:      pool-name: TodoHikariPool      maximum-pool-size: 10      minimum-idle: 2      register-mbeans: true  # \u0412\u043a\u043b\u044e\u0447\u0430\u0435\u0442 JMX MBeans (\u043d\u0435 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u0435\u043d \u0434\u043b\u044f Prometheus-\u043c\u0435\u0442\u0440\u0438\u043a)management:  endpoints:    web:      exposure:        # \u041e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u043c \u0422\u041e\u041b\u042c\u041a\u041e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0435. \u041d\u0438\u043a\u0430\u043a\u0438\u0445 env \u0438 loggers \"\u043d\u0430 \u0432\u0441\u044f\u043a\u0438\u0439 \u0441\u043b\u0443\u0447\u0430\u0439\" -        # \u0432 env \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u0441\u0435\u043a\u0440\u0435\u0442\u044b. \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 - \u0432 \u044d\u043f\u0438\u0437\u043e\u0434\u0435 \u043f\u0440\u043e \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u044c.        include: health, info, prometheus, metrics  endpoint:    prometheus:      enabled: true    health:      show-details: when_authorized    metrics:    tags:      application: ${spring.application.name}    distribution:      percentiles-histogram:        http.server.requests: true      percentiles:        http.server.requests: 0.5, 0.75, 0.95, 0.99      # SLO-\u0433\u0440\u0430\u043d\u0438\u0446\u044b \u0441\u043e\u0437\u0434\u0430\u044e\u0442 \u0442\u043e\u0447\u043d\u044b\u0435 \u0431\u0430\u043a\u0435\u0442\u044b le=\"...\". \u0411\u0435\u0437 \u043d\u0438\u0445 \u0437\u0430\u043f\u0440\u043e\u0441\u044b      # \u0432\u0438\u0434\u0430 http_server_requests_seconds_bucket{le=\"0.5\"} \u0432\u0435\u0440\u043d\u0443\u0442 \u043f\u0443\u0441\u0442\u043e\u0442\u0443 -      # \u0430 \u043d\u0430 \u043d\u0438\u0445 \u0434\u0435\u0440\u0436\u0430\u0442\u0441\u044f SLI \u043f\u043e \u043b\u0430\u0442\u0435\u043d\u0442\u043d\u043e\u0441\u0442\u0438 \u0438\u0437 \u044d\u043f\u0438\u0437\u043e\u0434\u0430 \u043f\u0440\u043e SLO.      # \u0417\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0434\u043e\u043b\u0436\u043d\u044b \u0441\u043e\u0432\u043f\u0430\u0434\u0430\u0442\u044c \u0441 \u0442\u0435\u043c\u0438, \u0447\u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u0432 slo-rules.yml.      slo:        http.server.requests: 100ms, 200ms, 500ms, 1s, 2s, 5s<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p>\u0417\u0430\u043f\u043e\u043c\u043d\u0438\u0442\u0435 \u0438\u0437 \u044d\u0442\u043e\u0433\u043e \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u0430 \u0447\u0435\u0442\u044b\u0440\u0435 \u0441\u0442\u0440\u043e\u043a\u0438:<\/p>\n<ul>\n<li>\n<p><code>exposure.include<\/code> &#8212; \u043a\u0430\u043a\u0438\u0435 \u0434\u0432\u0435\u0440\u0438 \u043e\u0442\u043a\u0440\u044b\u0442\u044c. \u041c\u0438\u043d\u0438\u043c\u0443\u043c: <code>prometheus<\/code> \u0438 <code>health<\/code>.<\/p>\n<\/li>\n<li>\n<p><code>percentiles-histogram<\/code> &#8212; \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u0442 \u0433\u0438\u0441\u0442\u043e\u0433\u0440\u0430\u043c\u043c\u0443 \u0434\u043b\u044f \u043f\u0435\u0440\u0446\u0435\u043d\u0442\u0438\u043b\u0435\u0439.<\/p>\n<\/li>\n<li>\n<p><code>slo<\/code> &#8212; \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442 \u00ab\u0438\u043c\u0435\u043d\u043d\u044b\u0435\u00bb \u0431\u0430\u043a\u0435\u0442\u044b <code>le=<\/code>. \u0417\u0430\u0445\u043e\u0442\u0438\u0442\u0435 \u043f\u043e\u0442\u043e\u043c \u0441\u0447\u0438\u0442\u0430\u0442\u044c \u00ab\u0434\u043e\u043b\u044e \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u0431\u044b\u0441\u0442\u0440\u0435\u0435 500 \u043c\u0441\u00bb, \u0430 \u0431\u0435\u0437 \u044d\u0442\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438 \u043d\u0435 \u043f\u043e\u0441\u0447\u0438\u0442\u0430\u0435\u0442\u0441\u044f \u043d\u0438\u0447\u0435\u0433\u043e &#8212; \u043c\u043e\u043b\u0447\u0430, \u0431\u0435\u0437 \u0435\u0434\u0438\u043d\u043e\u0439 \u043e\u0448\u0438\u0431\u043a\u0438 \u0432 \u043b\u043e\u0433\u0430\u0445. \u0412 \u043d\u0430\u0448\u0435\u043c \u0433\u043e\u0440\u043e\u0434\u0435 \u0441\u0430\u043c\u044b\u0435 \u043e\u043f\u0430\u0441\u043d\u044b\u0435 \u043f\u0440\u043e\u0432\u0430\u043b\u044b \u0442\u0435, \u0447\u0442\u043e \u043c\u043e\u043b\u0447\u0430\u0442.<\/p>\n<\/li>\n<li>\n<p><code>metrics.tags<\/code> &#8212; \u043e\u0431\u0449\u0438\u0435 \u0442\u0435\u0433\u0438. \u041a\u043e\u0433\u0434\u0430 \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432 \u0441\u0442\u0430\u043d\u0435\u0442 \u0434\u0432\u0430\u0434\u0446\u0430\u0442\u044c, \u0432\u044b \u043f\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u0435 \u044d\u0442\u043e\u0439 \u0441\u0442\u0440\u043e\u0447\u043a\u0435 \u043f\u0430\u043c\u044f\u0442\u043d\u0438\u043a.<\/p>\n<\/li>\n<\/ul>\n<h4>\u0428\u0430\u0433 3: Docker Compose<\/h4>\n<p>\u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435: \u043d\u0438\u043a\u0430\u043a\u043e\u0433\u043e <code>version: '3.8'<\/code> \u0432 \u0448\u0430\u043f\u043a\u0435. Compose v2 \u043d\u0430 \u043d\u0435\u0451 \u0442\u043e\u043b\u044c\u043a\u043e \u0432\u043e\u0440\u0447\u0438\u0442.<\/p>\n<pre><code class=\"yaml\">services:  app:    build: .    container_name: todo-app    ports:      - \"8080:8080\"    environment:      - SPRING_PROFILES_ACTIVE=docker    # \u041b\u0438\u043c\u0438\u0442 \u043f\u0430\u043c\u044f\u0442\u0438 + -XX:MaxRAMPercentage \u0432 Dockerfile = \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0443\u0435\u043c\u044b\u0439 max heap.    # \u0411\u0435\u0437 \u043b\u0438\u043c\u0438\u0442\u0430 JVM \u0432\u043e\u0437\u044c\u043c\u0451\u0442 25% RAM \u0445\u043e\u0441\u0442\u0430, \u0438 \u0430\u043b\u0435\u0440\u0442\u044b \u043d\u0430 heap \u0431\u0443\u0434\u0443\u0442 \u043c\u0435\u0440\u0438\u0442\u044c\u0441\u044f    # \u043d\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043d\u043e \u043e\u0442 \u0447\u0435\u0433\u043e.    mem_limit: 512m    networks:      - monitoring    healthcheck:      test: [\"CMD\", \"wget\", \"-q\", \"--spider\", \"http:\/\/localhost:8080\/actuator\/health\"]      interval: 30s      timeout: 10s      retries: 3      start_period: 40s  prometheus:    image: prom\/prometheus:v2.48.0    container_name: prometheus    ports:      - \"9090:9090\"    volumes:      - .\/prometheus\/prometheus.yml:\/etc\/prometheus\/prometheus.yml:ro      - .\/prometheus\/alert-rules.yml:\/etc\/prometheus\/alert-rules.yml:ro      - .\/prometheus\/recording-rules.yml:\/etc\/prometheus\/recording-rules.yml:ro      - .\/prometheus\/slo-rules.yml:\/etc\/prometheus\/slo-rules.yml:ro      - prometheus_data:\/prometheus    command:      - '--config.file=\/etc\/prometheus\/prometheus.yml'      - '--storage.tsdb.path=\/prometheus'      # 31 \u0434\u0435\u043d\u044c, \u0447\u0442\u043e\u0431\u044b 30-\u0434\u043d\u0435\u0432\u043d\u043e\u0435 \u043e\u043a\u043d\u043e SLO (ratio_rate30d) \u0438\u043c\u0435\u043b\u043e \u0434\u0430\u043d\u043d\u044b\u0435      - '--storage.tsdb.retention.time=31d'      - '--storage.tsdb.retention.size=10GB'      - '--web.enable-lifecycle'    networks:      - monitoring    healthcheck:      test: [\"CMD\", \"wget\", \"-q\", \"--spider\", \"http:\/\/localhost:9090\/-\/healthy\"]      interval: 30s      timeout: 10s      retries: 3  grafana:    image: grafana\/grafana:10.2.2    container_name: grafana    ports:      - \"3000:3000\"    environment:      - GF_SECURITY_ADMIN_USER=admin      - GF_SECURITY_ADMIN_PASSWORD=admin      - GF_USERS_ALLOW_SIGN_UP=false    volumes:      - grafana_data:\/var\/lib\/grafana      - .\/grafana\/dashboards:\/etc\/grafana\/provisioning\/dashboards:ro      - .\/grafana\/datasources.yml:\/etc\/grafana\/provisioning\/datasources\/datasources.yml:ro    networks:      - monitoring    depends_on:      - prometheus    healthcheck:      test: [\"CMD-SHELL\", \"curl -f http:\/\/localhost:3000\/api\/health || exit 1\"]      interval: 30s      timeout: 10s      retries: 3  alertmanager:    image: prom\/alertmanager:v0.26.0    container_name: alertmanager    ports:      - \"9093:9093\"    volumes:      - .\/prometheus\/alertmanager.yml:\/etc\/alertmanager\/alertmanager.yml:ro      - alertmanager_data:\/alertmanager    command:      - '--config.file=\/etc\/alertmanager\/alertmanager.yml'      - '--storage.path=\/alertmanager'    networks:      - monitoringnetworks:  monitoring:    driver: bridgevolumes:  prometheus_data:  grafana_data:  alertmanager_data:<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p>Health checks \u043d\u0443\u0436\u043d\u044b \u0434\u043b\u044f \u043f\u043e\u0440\u044f\u0434\u043a\u0430, volumes &#8212; \u0447\u0442\u043e\u0431\u044b \u0430\u0440\u0445\u0438\u0432 \u043f\u0435\u0440\u0435\u0436\u0438\u043b \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0443\u0441\u043a. \u0410\u0440\u0445\u0438\u0432\u0430\u0440\u0438\u0443\u0441 \u0431\u0435\u0437 \u0430\u0440\u0445\u0438\u0432\u0430 &#8212; \u043f\u0440\u043e\u0441\u0442\u043e \u0447\u0435\u043b\u043e\u0432\u0435\u043a \u0441 \u0445\u043e\u0440\u043e\u0448\u0435\u0439 \u043f\u0430\u043c\u044f\u0442\u044c\u044e \u0438 \u043f\u043b\u043e\u0445\u0438\u043c \u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u043e\u043c.<\/p>\n<h4>\u0428\u0430\u0433 4: \u041a\u043e\u043d\u0442\u0440\u0430\u043a\u0442 \u0441 \u0430\u0440\u0445\u0438\u0432\u0430\u0440\u0438\u0443\u0441\u043e\u043c<\/h4>\n<pre><code class=\"yaml\"># prometheus\/prometheus.ymlglobal:  scrape_interval: 15s  evaluation_interval: 15s  external_labels:    monitor: 'todo-app-monitor'rule_files:  - \/etc\/prometheus\/alert-rules.yml  - \/etc\/prometheus\/recording-rules.yml  - \/etc\/prometheus\/slo-rules.ymlalerting:  alertmanagers:    - static_configs:        - targets: ['alertmanager:9093']scrape_configs:  - job_name: 'prometheus'    static_configs:      - targets: ['localhost:9090']  - job_name: 'todo-app'    metrics_path: '\/actuator\/prometheus'    scrape_interval: 5s    static_configs:      - targets: ['app:8080']    basic_auth:      username: 'prometheus'      password: 'prometheus'<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p><code>scrape_interval: 5s<\/code> \u0441\u0442\u043e\u0438\u0442 \u0434\u043b\u044f \u0434\u0435\u043c\u043e, \u0447\u0442\u043e\u0431\u044b \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0430 \u0448\u0435\u0432\u0435\u043b\u0438\u043b\u0430\u0441\u044c. \u0412 production \u0441\u0442\u0430\u0432\u044c\u0442\u0435 15-30 \u0441\u0435\u043a\u0443\u043d\u0434. \u0427\u0430\u0449\u0435 \u0445\u043e\u0434\u0438\u0448\u044c \u043a \u043e\u0441\u0432\u0435\u0434\u043e\u043c\u0438\u0442\u0435\u043b\u044e &#8212; \u0431\u043e\u043b\u044c\u0448\u0435 \u0437\u043d\u0430\u0435\u0448\u044c. \u041d\u043e \u043a\u0430\u0436\u0434\u044b\u0439 \u0432\u0438\u0437\u0438\u0442 \u0441\u0442\u043e\u0438\u0442 \u043e\u0431\u044a\u0435\u043a\u0442\u0443 \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432: scrape &#8212; \u044d\u0442\u043e \u043e\u0431\u044b\u0447\u043d\u044b\u0439 HTTP-\u0437\u0430\u043f\u0440\u043e\u0441 \u043a \u0432\u0430\u0448\u0435\u043c\u0443 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044e, \u0438 \u043e\u043d \u043d\u0435 \u0431\u0435\u0441\u043f\u043b\u0430\u0442\u043d\u044b\u0439.<\/p>\n<p>\u0418 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0435\u0440\u0435\u0436\u0435\u043d\u0438\u0435, \u043e\u043f\u043b\u0430\u0447\u0435\u043d\u043d\u043e\u0435 \u0421\u0435\u0440\u0451\u0433\u0438\u043d\u044b\u043c\u0438 \u043d\u0435\u0440\u0432\u0430\u043c\u0438: \u043d\u0435 \u0432\u0435\u0448\u0430\u0439\u0442\u0435 <strong>\u0434\u0432\u0443\u0445 \u0442\u043e\u043f\u0442\u0443\u043d\u043e\u0432 \u043d\u0430 \u043e\u0434\u0438\u043d \u043e\u0431\u044a\u0435\u043a\u0442<\/strong>. \u00ab\u041e\u0434\u0438\u043d job \u0434\u043b\u044f Docker, \u043e\u0434\u0438\u043d \u0434\u043b\u044f \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0437\u0430\u043f\u0443\u0441\u043a\u0430, \u0443\u0434\u043e\u0431\u043d\u043e \u0436\u0435\u00bb. \u0410 \u043f\u043e\u0442\u043e\u043c SLO-\u043f\u0440\u0430\u0432\u0438\u043b\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0430\u0433\u0440\u0435\u0433\u0438\u0440\u0443\u044e\u0442 \u043f\u043e <code>application<\/code>, \u043f\u043e\u0441\u0447\u0438\u0442\u0430\u044e\u0442 \u043e\u0434\u0438\u043d \u0438 \u0442\u043e\u0442 \u0436\u0435 \u0442\u0440\u0430\u0444\u0438\u043a \u0434\u0432\u0430\u0436\u0434\u044b. RPS \u0443\u0434\u0432\u043e\u0438\u0442\u0441\u044f, \u0434\u043e\u043b\u044f \u043e\u0448\u0438\u0431\u043e\u043a \u043f\u043e\u0435\u0434\u0435\u0442, \u0438 \u0432\u044b \u043d\u0435\u0434\u0435\u043b\u044e \u0431\u0443\u0434\u0435\u0442\u0435 \u0438\u0441\u043a\u0430\u0442\u044c, \u043f\u043e\u0447\u0435\u043c\u0443 \u0441\u0432\u043e\u0434\u043a\u0430 \u0432\u0440\u0451\u0442 \u0440\u043e\u0432\u043d\u043e \u0432 \u0434\u0432\u0430 \u0440\u0430\u0437\u0430.<\/p>\n<h4>\u0428\u0430\u0433 5: \u0412\u043a\u043b\u044e\u0447\u0430\u0435\u043c<\/h4>\n<pre><code class=\"bash\">docker-compose up -d<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p>\u041c\u0438\u043d\u0443\u0442\u0430 \u043e\u0436\u0438\u0434\u0430\u043d\u0438\u044f. \u041f\u043e\u0442\u043e\u043c:<\/p>\n<ul>\n<li>\n<p><a href=\"http:\/\/localhost:8080\/actuator\/prometheus\" rel=\"noopener noreferrer nofollow\">http:\/\/localhost:8080\/actuator\/prometheus<\/a> &#8212; \u0441\u044b\u0440\u0430\u044f \u043f\u0440\u043e\u0441\u043b\u0443\u0448\u043a\u0430<\/p>\n<\/li>\n<li>\n<p><a href=\"http:\/\/localhost:9090\" rel=\"noopener noreferrer nofollow\">http:\/\/localhost:9090<\/a> &#8212; \u043a\u0430\u0431\u0438\u043d\u0435\u0442 \u0430\u0440\u0445\u0438\u0432\u0430\u0440\u0438\u0443\u0441\u0430<\/p>\n<\/li>\n<li>\n<p><a href=\"http:\/\/localhost:3000\" rel=\"noopener noreferrer nofollow\">http:\/\/localhost:3000<\/a> &#8212; \u043c\u0430\u0441\u0442\u0435\u0440\u0441\u043a\u0430\u044f \u0413\u0440\u0435\u0439\u0441 (admin\/admin)<\/p>\n<\/li>\n<\/ul>\n<p>\u0412 <code>\/actuator\/prometheus<\/code> \u0432\u044b \u0443\u0432\u0438\u0434\u0438\u0442\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u044d\u0442\u043e:<\/p>\n<pre><code># HELP jvm_memory_used_bytes The amount of used memory# TYPE jvm_memory_used_bytes gaugejvm_memory_used_bytes{area=\"heap\",id=\"G1 Eden Space\",} 2.5165824E7jvm_memory_used_bytes{area=\"heap\",id=\"G1 Old Gen\",} 1.6777216E7# HELP http_server_requests_seconds  # TYPE http_server_requests_seconds histogramhttp_server_requests_seconds_bucket{method=\"GET\",uri=\"\/api\/tasks\",status=\"200\",le=\"0.05\"} 45.0http_server_requests_seconds_bucket{method=\"GET\",uri=\"\/api\/tasks\",status=\"200\",le=\"0.1\"} 67.0<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p>\u0414\u0430\u043d\u044f \u0441\u043c\u043e\u0442\u0440\u0435\u043b \u043d\u0430 \u044d\u0442\u043e\u0442 \u043f\u043e\u0442\u043e\u043a \u043c\u0438\u043d\u0443\u0442\u044b \u0434\u0432\u0435. \u041f\u043e\u0442\u043e\u043c \u043f\u043e\u0434\u043d\u044f\u043b \u0433\u043b\u0430\u0437\u0430:<\/p>\n<p>\u2014 \u041f\u043e\u0434\u043e\u0436\u0434\u0438. \u042d\u0442\u043e \u0432\u0441\u0451\u2026 \u0443\u0436\u0435 \u0431\u044b\u043b\u043e? \u0412\u0441\u0451 \u044d\u0442\u043e \u0432\u0440\u0435\u043c\u044f? \u2014 \u0412\u0441\u0451 \u044d\u0442\u043e \u0432\u0440\u0435\u043c\u044f, \u043f\u0430\u0440\u0435\u043d\u044c. \u2014 \u0418 \u0432 \u0442\u043e \u0432\u043e\u0441\u043a\u0440\u0435\u0441\u0435\u043d\u044c\u0435? \u2014 \u0418 \u0432 \u0442\u043e \u0432\u043e\u0441\u043a\u0440\u0435\u0441\u0435\u043d\u044c\u0435. \u0413\u043e\u0440\u043e\u0434 \u0433\u043e\u0432\u043e\u0440\u0438\u043b. \u0421\u043b\u0443\u0448\u0430\u0442\u044c \u0431\u044b\u043b\u043e \u043d\u0435\u043a\u043e\u043c\u0443.<\/p>\n<p>\u041d\u043e\u043b\u044c \u0441\u0442\u0440\u043e\u043a \u043a\u043e\u0434\u0430, \u0430 \u0443 \u0432\u0430\u0441 \u0443\u0436\u0435 \u043d\u0430 \u043f\u0440\u043e\u0441\u043b\u0443\u0448\u043a\u0435 JVM, HTTP, \u043f\u0443\u043b\u044b \u043f\u043e\u0442\u043e\u043a\u043e\u0432 \u0438 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0439. \u0417\u0430 \u044d\u0442\u043e \u044f \u0438 \u043b\u044e\u0431\u043b\u044e Spring Boot: \u043e\u043d \u0434\u0435\u043b\u0430\u0435\u0442 \u0433\u0440\u044f\u0437\u043d\u0443\u044e \u0440\u0430\u0431\u043e\u0442\u0443 \u0442\u0438\u0445\u043e, \u043a\u0430\u043a \u0445\u043e\u0440\u043e\u0448\u0438\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0442\u043e\u0440. \u0410 \u0432\u043e\u0442 \u0434\u0430\u043b\u044c\u0448\u0435 \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442\u0441\u044f \u0440\u0430\u0431\u043e\u0442\u0430 \u0434\u043b\u044f \u043d\u0430\u0441. \u041f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043f\u0440\u043e\u0441\u043b\u0443\u0448\u043a\u0430 \u0431\u0435\u0437 \u0430\u043d\u0430\u043b\u0438\u0442\u0438\u043a\u0430 &#8212; \u044d\u0442\u043e \u0448\u0443\u043c. \u0414\u043e\u0440\u043e\u0433\u043e\u0439, \u043a\u0440\u0430\u0441\u0438\u0432\u043e \u0437\u0430\u0430\u0440\u0445\u0438\u0432\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0448\u0443\u043c.<\/p>\n<hr\/>\n<h3>\u042d\u043f\u0438\u0437\u043e\u0434 2. PromQL: \u044f\u0437\u044b\u043a \u0434\u043e\u043f\u0440\u043e\u0441\u0430<\/h3>\n<p>\u0412\u043e \u0432\u0442\u043e\u0440\u043d\u0438\u043a \u0414\u0430\u043d\u044f \u043e\u0442\u043a\u0440\u044b\u043b \u043a\u0430\u0431\u0438\u043d\u0435\u0442 \u0430\u0440\u0445\u0438\u0432\u0430\u0440\u0438\u0443\u0441\u0430, \u043f\u043e\u0442\u044b\u043a\u0430\u043b \u0432 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441, \u0432\u044b\u0448\u0435\u043b \u0438 \u0447\u0435\u0441\u0442\u043d\u043e \u0434\u043e\u043b\u043e\u0436\u0438\u043b: \u00ab\u042f \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u043f\u043e\u043d\u044f\u043b\u00bb. \u041d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e. \u041f\u0440\u043e\u043c\u0435\u0442\u0435\u0439 \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0442\u043e\u043c\u0443, \u043a\u0442\u043e \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u0441\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u0435\u0442. PromQL &#8212; \u044f\u0437\u044b\u043a \u0434\u043e\u043f\u0440\u043e\u0441\u0430: \u043f\u043e\u0445\u043e\u0436 \u043d\u0430 SQL, \u043d\u043e \u043a\u043e\u0440\u043e\u0447\u0435 \u0438 \u0437\u043b\u043e\u043f\u0430\u043c\u044f\u0442\u043d\u0435\u0435. \u041a\u0442\u043e \u0437\u043d\u0430\u0435\u0442 SQL, \u0437\u0430\u0433\u043e\u0432\u043e\u0440\u0438\u0442 \u0437\u0430 \u0434\u0435\u0441\u044f\u0442\u044c \u043c\u0438\u043d\u0443\u0442. \u041a\u0442\u043e \u043d\u0435 \u0437\u043d\u0430\u0435\u0442 &#8212; \u0437\u0430 \u0434\u0432\u0430\u0434\u0446\u0430\u0442\u044c. \u0410 \u0432\u043e\u0442 \u043d\u044e\u0430\u043d\u0441\u044b \u0431\u0443\u0434\u0443\u0442 \u0434\u043e\u0433\u043e\u043d\u044f\u0442\u044c \u0435\u0449\u0451 \u043c\u0435\u0441\u044f\u0446, \u0438 \u043e\u0434\u0438\u043d \u0438\u0437 \u043d\u0438\u0445 \u0447\u0443\u0442\u044c \u043d\u0435 \u0437\u0430\u043a\u0440\u044b\u043b \u043d\u0430\u043c \u0432\u0441\u0451 \u0434\u0435\u043b\u043e. \u0420\u0430\u0441\u0441\u043a\u0430\u0436\u0443 \u0432 \u043a\u043e\u043d\u0446\u0435 \u044d\u043f\u0438\u0437\u043e\u0434\u0430.<\/p>\n<h4>\u0422\u0438\u043f\u044b \u0434\u0430\u043d\u043d\u044b\u0445<\/h4>\n<p><strong>Instant Vector<\/strong> &#8212; \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u0438\u044f \u043d\u0430 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442:<\/p>\n<pre><code>http_server_requests_seconds_count<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p><strong>Range Vector<\/strong> &#8212; \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u0438\u044f \u0437\u0430 \u043f\u0435\u0440\u0438\u043e\u0434 (\u0434\u043b\u044f rate):<\/p>\n<pre><code>http_server_requests_seconds_count[5m]<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p><strong>Scalar<\/strong> &#8212; \u043f\u0440\u043e\u0441\u0442\u043e \u0447\u0438\u0441\u043b\u043e:<\/p>\n<pre><code>42<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<h4>\u0421\u0435\u043b\u0435\u043a\u0442\u043e\u0440\u044b \u0438 \u0444\u0438\u043b\u044c\u0442\u0440\u0430\u0446\u0438\u044f<\/h4>\n<pre><code># \u0412\u0441\u0435 \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u0438\u044f \u0441 \u0438\u043c\u0435\u043d\u0435\u043chttp_server_requests_seconds_count# \u0422\u043e\u0447\u043d\u043e\u0435 \u0441\u043e\u0432\u043f\u0430\u0434\u0435\u043d\u0438\u0435http_server_requests_seconds_count{status=\"200\"}# \u0420\u0435\u0433\u0443\u043b\u044f\u0440\u043d\u043e\u0435 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435http_server_requests_seconds_count{status=~\"2..\"}# \u0418\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435http_server_requests_seconds_count{uri!~\"\/actuator.*\"}# \u041a\u043e\u043c\u0431\u0438\u043d\u0430\u0446\u0438\u044fhttp_server_requests_seconds_count{method=\"GET\", status=\"200\", uri=\"\/api\/tasks\"}<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<h4>\u041a\u043b\u044e\u0447\u0435\u0432\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438<\/h4>\n<p><strong>rate()<\/strong> &#8212; \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f counter. \u0413\u043b\u0430\u0432\u043d\u044b\u0439 \u0432\u043e\u043f\u0440\u043e\u0441 \u043b\u044e\u0431\u043e\u0433\u043e \u0434\u043e\u043f\u0440\u043e\u0441\u0430: \u043d\u0435 \u0447\u0442\u043e \u0442\u044b \u0441\u0434\u0435\u043b\u0430\u043b, \u0430 \u043a\u0430\u043a \u0431\u044b\u0441\u0442\u0440\u043e \u0442\u044b \u044d\u0442\u043e \u0434\u0435\u043b\u0430\u0435\u0448\u044c.<\/p>\n<pre><code># RPS (\u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u0432 \u0441\u0435\u043a\u0443\u043d\u0434\u0443)rate(http_server_requests_seconds_count[5m])<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p>Counter \u0442\u043e\u043b\u044c\u043a\u043e \u0440\u0430\u0441\u0442\u0451\u0442. \u041d\u0438\u043a\u043e\u0433\u0434\u0430 \u043d\u0435 \u0443\u043c\u0435\u043d\u044c\u0448\u0430\u0435\u0442\u0441\u044f. \u041a\u0430\u043a \u0434\u043e\u0441\u044c\u0435. rate() \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u0442, \u043d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0431\u044b\u0441\u0442\u0440\u043e \u043e\u043d \u0440\u0430\u0441\u0442\u0451\u0442, \u0438 \u044d\u0442\u043e \u043f\u043e\u0447\u0442\u0438 \u0432\u0441\u0435\u0433\u0434\u0430 \u0442\u043e, \u0447\u0442\u043e \u0432\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435.<\/p>\n<p><strong>increase()<\/strong> &#8212; \u0430\u0431\u0441\u043e\u043b\u044e\u0442\u043d\u044b\u0439 \u043f\u0440\u0438\u0440\u043e\u0441\u0442:<\/p>\n<pre><code># \u0417\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u0437\u0430 \u0447\u0430\u0441increase(http_server_requests_seconds_count[1h])<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p><strong>sum(), avg(), max(), min()<\/strong> &#8212; \u0430\u0433\u0440\u0435\u0433\u0430\u0446\u0438\u044f:<\/p>\n<pre><code># \u041e\u0431\u0449\u0438\u0439 RPSsum(rate(http_server_requests_seconds_count[5m]))# RPS \u043f\u043e endpointsum(rate(http_server_requests_seconds_count[5m])) by (uri)<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p><strong>histogram_quantile()<\/strong> &#8212; \u043f\u0435\u0440\u0446\u0435\u043d\u0442\u0438\u043b\u0438:<\/p>\n<pre><code># p99 \u043b\u0430\u0442\u0435\u043d\u0442\u043d\u043e\u0441\u0442\u044chistogram_quantile(0.99,   sum(rate(http_server_requests_seconds_bucket[5m])) by (le))<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<h4>\u0414\u043e\u043f\u0440\u043e\u0441\u044b \u043d\u0430 \u043a\u0430\u0436\u0434\u044b\u0439 \u0434\u0435\u043d\u044c<\/h4>\n<p><strong>RPS:<\/strong><\/p>\n<pre><code>sum(rate(http_server_requests_seconds_count[5m]))<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p><strong>Error Rate %:<\/strong><\/p>\n<pre><code>sum(rate(http_server_requests_seconds_count{status=~\"5..\"}[5m])) \/ sum(rate(http_server_requests_seconds_count[5m])) * 100<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p><strong>Heap usage %:<\/strong><\/p>\n<pre><code>sum by (instance) (jvm_memory_used_bytes{area=\"heap\"})\/ sum by (instance) (jvm_memory_max_bytes{area=\"heap\"} != -1)* 100<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p>\u041f\u043e\u0447\u0435\u043c\u0443 heap \u0434\u043e\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0441 <code>sum<\/code>, \u0430 \u043d\u0435 \u0434\u0435\u043b\u0438\u0442\u0441\u044f \u0432 \u043b\u043e\u0431 &#8212; \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u044d\u043f\u0438\u0437\u043e\u0434, \u0438 \u043e\u043d \u0431\u0443\u0434\u0435\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c. \u0421\u043f\u043e\u0439\u043b\u0435\u0440: \u043c\u044b \u043f\u043e\u0434\u0435\u043b\u0438\u043b\u0438 \u0432 \u043b\u043e\u0431 \u0438 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 \u043b\u043e\u0436\u043d\u044b\u0439 \u0434\u043e\u043d\u043e\u0441.<\/p>\n<h4>\u0414\u0435\u043b\u043e \u043e \u043c\u043e\u043b\u0447\u0430\u043d\u0438\u0438, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043f\u0440\u0438\u0442\u0432\u043e\u0440\u044f\u043b\u043e\u0441\u044c \u043d\u0443\u043b\u0451\u043c<\/h4>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043e\u0431\u0435\u0449\u0430\u043d\u043d\u044b\u0439 \u043d\u044e\u0430\u043d\u0441. \u0412\u043e\u043f\u0440\u043e\u0441 \u043d\u0430 \u0437\u0430\u0441\u044b\u043f\u043a\u0443: \u0447\u0442\u043e \u043e\u0442\u0432\u0435\u0442\u0438\u0442 <code>sum()<\/code>, \u0435\u0441\u043b\u0438 \u0441\u0435\u0440\u0438\u0439 \u043d\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442? \u041d\u043e\u043b\u044c? \u041b\u043e\u0433\u0438\u0447\u043d\u043e &#8212; \u0441\u0443\u043c\u043c\u0430 \u043d\u0438\u0447\u0435\u0433\u043e \u0440\u0430\u0432\u043d\u0430 \u043d\u0443\u043b\u044e.<\/p>\n<p>\u041d\u0435 \u043d\u043e\u043b\u044c. <strong>\u041f\u0443\u0441\u0442\u043e\u0442\u0443.<\/strong> \u0412 \u044d\u0442\u043e\u043c \u0433\u043e\u0440\u043e\u0434\u0435 \u00ab\u043d\u0438\u043a\u0442\u043e \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u0432\u0438\u0434\u0435\u043b\u00bb \u0438 \u00ab\u0432\u0441\u0435 \u0432\u0438\u0434\u0435\u043b\u0438, \u0447\u0442\u043e \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u0431\u044b\u043b\u043e\u00bb &#8212; \u0434\u0432\u0430 \u0440\u0430\u0437\u043d\u044b\u0445 \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u0438\u044f, \u0438 \u043c\u0435\u0436\u0434\u0443 \u043d\u0438\u043c\u0438 \u043f\u0440\u043e\u043f\u0430\u0441\u0442\u044c. \u041d\u0430\u043f\u0438\u0448\u0435\u0442\u0435 \u0430\u043b\u0435\u0440\u0442 \u00ab\u0442\u0440\u0430\u0444\u0438\u043a\u0430 \u043d\u0435\u0442\u00bb: <code>sum(rate(...)) == 0<\/code>, \u0438 \u043e\u043d \u043d\u0435 \u0441\u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0438\u043c\u0435\u043d\u043d\u043e \u0442\u043e\u0433\u0434\u0430, \u043a\u043e\u0433\u0434\u0430 \u0442\u0440\u0430\u0444\u0438\u043a\u0430 \u043d\u0435\u0442 \u0441\u043e\u0432\u0441\u0435\u043c. \u0421\u0435\u0440\u0438\u0439 \u043d\u0435\u0442, \u0441\u0443\u043c\u043c\u044b \u043d\u0435\u0442, \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f \u043d\u0435\u0442, \u0430\u043b\u0435\u0440\u0442\u0430 \u043d\u0435\u0442. \u0421\u0432\u0438\u0434\u0435\u0442\u0435\u043b\u044c \u043d\u0435 \u0433\u043e\u0432\u043e\u0440\u0438\u0442 \u00ab\u043d\u043e\u043b\u044c\u00bb. \u0421\u0432\u0438\u0434\u0435\u0442\u0435\u043b\u044c \u043d\u0435 \u043f\u0440\u0438\u0448\u0451\u043b.<\/p>\n<p>\u041b\u0435\u043a\u0430\u0440\u0441\u0442\u0432\u043e &#8212; \u043f\u043e\u0434\u0441\u0442\u0430\u0432\u043d\u043e\u0439 \u0441\u0432\u0438\u0434\u0435\u0442\u0435\u043b\u044c <code>or vector(0)<\/code>:<\/p>\n<pre><code>(sum(rate(http_server_requests_seconds_count{uri!~\"\/actuator.*\"}[5m])) or vector(0)) == 0<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p>\u0417\u0430\u043f\u043e\u043c\u043d\u0438\u0442\u0435 \u044d\u0442\u043e\u0442 \u0442\u0440\u044e\u043a. \u041e\u043d \u0435\u0449\u0451 \u0432\u044b\u0441\u0442\u0440\u0435\u043b\u0438\u0442 \u0432 \u044d\u043f\u0438\u0437\u043e\u0434\u0435 \u043f\u0440\u043e \u0441\u0438\u0433\u043d\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e.<\/p>\n<p>\u042d\u0442\u0438\u043c \u043d\u0430\u0431\u043e\u0440\u043e\u043c \u0437\u0430\u043a\u0440\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043f\u0440\u043e\u0446\u0435\u043d\u0442\u043e\u0432 \u0434\u0435\u0432\u044f\u043d\u043e\u0441\u0442\u043e \u0434\u043e\u043f\u0440\u043e\u0441\u043e\u0432. \u041e\u0441\u0442\u0430\u0432\u0448\u0438\u0435\u0441\u044f \u0434\u0435\u0441\u044f\u0442\u044c &#8212; \u044d\u0442\u043e \u043a\u043e\u0433\u0434\u0430 \u0437\u0430\u0445\u043e\u0447\u0435\u0442\u0441\u044f \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0445 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u043d\u0430 \u043f\u043e\u043b-\u044d\u043a\u0440\u0430\u043d\u0430 \u0438 \u043e\u0449\u0443\u0449\u0435\u043d\u0438\u044f \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0439 \u0433\u0435\u043d\u0438\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u0438. \u041d\u0435 \u0441\u0435\u0439\u0447\u0430\u0441.<\/p>\n<hr\/>\n<h3>\u042d\u043f\u0438\u0437\u043e\u0434 3. \u0412\u0441\u043a\u0440\u044b\u0442\u0438\u0435 JVM \u0438 \u043f\u0435\u0440\u0432\u044b\u0439 \u043b\u043e\u0436\u043d\u044b\u0439 \u0434\u043e\u043d\u043e\u0441<\/h3>\n<p>\u0412 \u043d\u043e\u0447\u044c \u0441\u043e \u0441\u0440\u0435\u0434\u044b \u043d\u0430 \u0447\u0435\u0442\u0432\u0435\u0440\u0433 \u043c\u043d\u0435 \u043f\u043e\u0437\u0432\u043e\u043d\u0438\u043b\u0430 \u0441\u0438\u0433\u043d\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f: \u00abHeap 98%!\u00bb. \u042f \u043f\u043e\u0434\u0441\u043a\u043e\u0447\u0438\u043b, \u043a\u0430\u043a \u043e\u0442 \u0432\u044b\u0441\u0442\u0440\u0435\u043b\u0430. \u041e\u0442\u043a\u0440\u044b\u043b \u043d\u043e\u0443\u0442\u0431\u0443\u043a. \u0420\u0443\u043a\u0438 \u043d\u0430\u0431\u0438\u0440\u0430\u043b\u0438 ssh \u0431\u044b\u0441\u0442\u0440\u0435\u0435, \u0447\u0435\u043c \u043f\u0440\u043e\u0441\u044b\u043f\u0430\u043b\u0430\u0441\u044c \u0433\u043e\u043b\u043e\u0432\u0430.<\/p>\n<p>Heap \u0431\u044b\u043b \u0432 \u043f\u043e\u0440\u044f\u0434\u043a\u0435.<\/p>\n<p>\u041b\u043e\u0436\u043d\u044b\u0439 \u0434\u043e\u043d\u043e\u0441. \u0418 \u0437\u043d\u0430\u0435\u0442\u0435, \u043a\u0442\u043e \u043d\u0430\u0441\u0442\u0443\u0447\u0430\u043b? \u041c\u044b \u0441\u0430\u043c\u0438. \u041d\u0430\u0448 \u043f\u0435\u0440\u0432\u044b\u0439 \u0430\u043b\u0435\u0440\u0442 \u043d\u0430 \u043f\u0430\u043c\u044f\u0442\u044c, \u0433\u043e\u0440\u0434\u043e\u0441\u0442\u044c \u0432\u0441\u0435\u0433\u043e \u043e\u0442\u0434\u0435\u043b\u0430. \u041c\u044b \u0432\u0437\u044f\u043b\u0438 <code>jvm_memory_used_bytes{area=\"heap\"}<\/code> \u0438 \u043f\u043e\u0434\u0435\u043b\u0438\u043b\u0438 \u043d\u0430 <code>jvm_memory_max_bytes{area=\"heap\"}<\/code> \u0432 \u043b\u043e\u0431. \u0410 \u044d\u0442\u043e, \u043a\u0430\u043a \u0432\u044b\u044f\u0441\u043d\u0438\u043b\u043e\u0441\u044c \u043d\u0430 \u043e\u0447\u043d\u043e\u0439 \u0441\u0442\u0430\u0432\u043a\u0435, \u043d\u0435 \u043e\u0434\u043d\u0430 \u043c\u0435\u0442\u0440\u0438\u043a\u0430. \u042d\u0442\u043e \u0442\u0440\u0438 \u043f\u0435\u0440\u0441\u043e\u043d\u044b: Eden, Survivor, Old Gen. \u041f\u043e \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0439 \u0441\u0435\u0440\u0438\u0438 \u043d\u0430 \u043a\u0430\u0436\u0434\u044b\u0439 \u043f\u0443\u043b. \u0418 Prometheus \u0443\u0441\u043b\u0443\u0436\u043b\u0438\u0432\u043e \u0441\u0440\u0430\u0432\u043d\u0438\u043b <strong>\u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0441 \u0435\u0433\u043e \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u043c \u043f\u043e\u0442\u043e\u043b\u043a\u043e\u043c<\/strong>.<\/p>\n<p>\u0410 Eden \u043f\u0435\u0440\u0435\u0434 \u0441\u0431\u043e\u0440\u043a\u043e\u0439 \u043c\u0443\u0441\u043e\u0440\u0430 \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d \u043f\u043e\u0434 \u0437\u0430\u0432\u044f\u0437\u043a\u0443. \u0412\u0441\u0435\u0433\u0434\u0430. \u042d\u0442\u043e \u0435\u0433\u043e \u0440\u0430\u0431\u043e\u0442\u0430: \u043d\u0430\u043f\u043e\u043b\u043d\u044f\u0442\u044c\u0441\u044f \u0438 \u043e\u043f\u0443\u0441\u0442\u043e\u0448\u0430\u0442\u044c\u0441\u044f.<\/p>\n<p>\u0412\u0442\u043e\u0440\u0430\u044f \u043f\u043e\u043b\u043e\u0432\u0438\u043d\u0430 \u0433\u0440\u0430\u0431\u043b\u0435\u0439, \u0447\u0442\u043e\u0431\u044b \u0434\u0432\u0430\u0436\u0434\u044b \u043d\u0435 \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c \u043f\u043e\u043d\u044f\u0442\u044b\u0445: \u0443 \u043f\u0443\u043b\u043e\u0432 \u0431\u0435\u0437 \u0444\u0438\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0433\u043e \u043c\u0430\u043a\u0441\u0438\u043c\u0443\u043c\u0430 (\u0432 G1 \u044d\u0442\u043e Eden \u0438 Survivor) <code>jvm_memory_max_bytes<\/code> \u0440\u0430\u0432\u0435\u043d <code>-1<\/code>. \u041c\u0438\u043d\u0443\u0441 \u043e\u0434\u0438\u043d. \u041f\u0440\u043e\u0441\u0443\u043c\u043c\u0438\u0440\u0443\u0435\u0442\u0435 \u0431\u0435\u0437 \u0444\u0438\u043b\u044c\u0442\u0440\u0430, \u0438 \u0437\u043d\u0430\u043c\u0435\u043d\u0430\u0442\u0435\u043b\u044c \u0443\u0439\u0434\u0451\u0442 \u0432 \u0441\u0430\u043c\u043e\u0432\u043e\u043b\u043a\u0443. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043a\u0430\u043d\u043e\u043d\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0434\u043e\u043f\u0440\u043e\u0441 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0442\u0430\u043a:<\/p>\n<pre><code># \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0430\u044f \u043f\u0430\u043c\u044f\u0442\u044c (\u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u0435\u0440\u0438\u0439 - \u043f\u043e \u043e\u0434\u043d\u043e\u0439 \u043d\u0430 \u043f\u0443\u043b!)jvm_memory_used_bytes{area=\"heap\"}# \u041c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u0430\u044fjvm_memory_max_bytes{area=\"heap\"}# \u041f\u0440\u043e\u0446\u0435\u043d\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f - \u0421 \u0421\u0423\u041c\u041c\u041e\u0419 \u043f\u043e \u043f\u0443\u043b\u0430\u043csum by (instance) (jvm_memory_used_bytes{area=\"heap\"})\/sum by (instance) (jvm_memory_max_bytes{area=\"heap\"} != -1)* 100<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p>\u041c\u0435\u043b\u043e\u0447\u044c? \u041c\u0435\u043b\u043e\u0447\u044c. \u041d\u043e \u0438\u0437 \u0442\u0430\u043a\u0438\u0445 \u043c\u0435\u043b\u043e\u0447\u0435\u0439 \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0440\u0430\u0437\u043d\u0438\u0446\u0430 \u043c\u0435\u0436\u0434\u0443 \u0441\u0435\u0442\u044c\u044e \u043e\u0441\u0432\u0435\u0434\u043e\u043c\u0438\u0442\u0435\u043b\u0435\u0439 \u0438 \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u043e\u043c \u043b\u043e\u0436\u043d\u044b\u0445 \u0434\u043e\u043d\u043e\u0441\u043e\u0432. \u0423\u0442\u0440\u043e\u043c \u044f \u043f\u043e\u043a\u0430\u0437\u0430\u043b \u0438\u0441\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0414\u0430\u043d\u0435. \u0414\u0430\u043d\u044f \u0437\u0430\u043f\u0438\u0441\u0430\u043b. \u0421\u0435\u0440\u0451\u0433\u0430, \u043f\u0440\u043e\u0445\u043e\u0434\u0438\u0432\u0448\u0438\u0439 \u043c\u0438\u043c\u043e \u0441 \u043a\u043e\u0444\u0435, \u0431\u0440\u043e\u0441\u0438\u043b \u0447\u0435\u0440\u0435\u0437 \u043f\u043b\u0435\u0447\u043e: \u00ab\u0410, Eden. \u0412\u0441\u0435 \u0447\u0435\u0440\u0435\u0437 \u044d\u0442\u043e \u043f\u0440\u043e\u0445\u043e\u0434\u044f\u0442. \u041a\u0430\u043a \u043f\u0435\u0440\u0432\u044b\u0439 \u043e\u0431\u044b\u0441\u043a \u0431\u0435\u0437 \u043e\u0440\u0434\u0435\u0440\u0430\u00bb.<\/p>\n<h4>Heap: \u0440\u0430\u0439\u043e\u043d, \u0433\u0434\u0435 \u0436\u0438\u0432\u0443\u0442 \u0432\u0441\u0435 \u0432\u0430\u0448\u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u044b<\/h4>\n<p>\u041a\u0430\u0436\u0434\u044b\u0439 <code>new Object()<\/code> &#8212; \u043d\u043e\u0432\u044b\u0439 \u0436\u0438\u043b\u0435\u0446. \u0421\u0442\u0440\u043e\u043a\u0438, \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u0438, DTO, \u043a\u044d\u0448\u0438. \u0412\u0441\u0435 \u043f\u0440\u043e\u043f\u0438\u0441\u0430\u043d\u044b \u0437\u0434\u0435\u0441\u044c, \u0438 \u0432\u0441\u0435\u0445 \u043d\u0443\u0436\u043d\u043e \u043a\u043e\u0433\u0434\u0430-\u0442\u043e \u0432\u044b\u0441\u0435\u043b\u044f\u0442\u044c. \u0412\u044b\u0441\u0435\u043b\u0435\u043d\u0438\u0435\u043c \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u0442\u0441\u044f Garbage Collector. \u041d\u043e \u0438\u043d\u043e\u0433\u0434\u0430 \u043e\u043d \u043d\u0435 \u0441\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f. \u0418 \u0442\u043e\u0433\u0434\u0430 OutOfMemoryError. \u0422\u043e\u0442 \u0441\u0430\u043c\u044b\u0439. \u0412\u043e\u0441\u043a\u0440\u0435\u0441\u043d\u044b\u0439.<\/p>\n<p><strong>\u041a\u043e\u0433\u0434\u0430 \u0432\u043e\u043b\u043d\u043e\u0432\u0430\u0442\u044c\u0441\u044f:<\/strong><\/p>\n<ul>\n<li>\n<p>&gt; 80% &#8212; \u0436\u0451\u043b\u0442\u044b\u0439 \u0441\u0432\u0435\u0442. \u0421\u0442\u043e\u0438\u0442 \u043f\u0440\u0438\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c\u0441\u044f. \u041c\u043e\u0436\u0435\u0442, \u043d\u0438\u0447\u0435\u0433\u043e. \u0410 \u043c\u043e\u0436\u0435\u0442, \u0443\u0442\u0435\u0447\u043a\u0430.<\/p>\n<\/li>\n<li>\n<p>&gt; 95% &#8212; \u043a\u0440\u0430\u0441\u043d\u044b\u0439. GC \u043f\u0430\u0448\u0435\u0442 \u0431\u0435\u0437 \u043f\u0435\u0440\u0435\u043a\u0443\u0440\u043e\u0432, \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0435\u043b\u0435 \u0434\u044b\u0448\u0438\u0442.<\/p>\n<\/li>\n<li>\n<p>\u0420\u043e\u0441\u0442 \u0431\u0435\u0437 \u0441\u043d\u0438\u0436\u0435\u043d\u0438\u044f &#8212; \u0443\u0442\u0435\u0447\u043a\u0430 \u043f\u0430\u043c\u044f\u0442\u0438. \u0422\u0443\u0442 \u0443\u0436\u0435 \u043d\u0435 \u00ab\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u00bb, \u0430 \u043e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u043a\u0430 \u043d\u0430 \u043f\u043e\u0434\u043e\u0437\u0440\u0435\u0432\u0430\u0435\u043c\u043e\u0433\u043e.<\/p>\n<\/li>\n<\/ul>\n<h4>Non-Heap: \u043f\u0440\u0438\u0433\u043e\u0440\u043e\u0434, \u043e \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0437\u0430\u0431\u044b\u0432\u0430\u044e\u0442<\/h4>\n<p>Non-Heap \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442:<\/p>\n<ul>\n<li>\n<p><strong>Metaspace<\/strong> &#8212; \u043c\u0435\u0442\u0430\u0434\u0430\u043d\u043d\u044b\u0435 \u043a\u043b\u0430\u0441\u0441\u043e\u0432<\/p>\n<\/li>\n<li>\n<p><strong>Code Cache<\/strong> &#8212; \u0441\u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 JIT-\u043a\u043e\u0434<\/p>\n<\/li>\n<li>\n<p><strong>Thread stacks<\/strong><\/p>\n<\/li>\n<\/ul>\n<pre><code># Metaspacejvm_memory_used_bytes{area=\"nonheap\", id=\"Metaspace\"}<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p>Metaspace \u0440\u0430\u0441\u0442\u0451\u0442 \u0431\u0435\u0437 \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438? \u0423\u0442\u0435\u0447\u043a\u0430 \u043a\u043b\u0430\u0441\u0441\u043e\u0432. \u0411\u044b\u0432\u0430\u0435\u0442 \u043f\u0440\u0438 hot reload. \u0411\u044b\u0432\u0430\u0435\u0442 \u043f\u0440\u0438 \u043a\u0440\u0438\u0432\u044b\u0445 class loaders. \u0410 \u0431\u044b\u0432\u0430\u0435\u0442 \u0431\u0435\u0437 \u0432\u0438\u0434\u0438\u043c\u043e\u0439 \u043f\u0440\u0438\u0447\u0438\u043d\u044b &#8212; \u043a\u0430\u043a \u0434\u043e\u0436\u0434\u044c \u0432 \u044d\u0442\u043e\u043c \u0433\u043e\u0440\u043e\u0434\u0435.<\/p>\n<h4>GC: \u0443\u0431\u043e\u0440\u0449\u0438\u043a, \u043a\u043e\u0442\u043e\u0440\u043e\u043c\u0443 \u043f\u043b\u0430\u0442\u044f\u0442 \u043f\u0430\u0443\u0437\u0430\u043c\u0438<\/h4>\n<p>Garbage Collector \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0431\u0435\u0441\u043f\u043b\u0430\u0442\u043d\u043e. \u0428\u0443\u0442\u043a\u0430. \u0411\u0435\u0440\u0451\u0442 \u043f\u0430\u0443\u0437\u0430\u043c\u0438: \u043f\u043e\u043a\u0430 \u043e\u043d \u0443\u0431\u0438\u0440\u0430\u0435\u0442, \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0441\u0442\u043e\u0438\u0442.<\/p>\n<pre><code># \u0412\u0440\u0435\u043c\u044f \u0432 GCrate(jvm_gc_pause_seconds_sum[5m])# \u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u0430\u0443\u0437rate(jvm_gc_pause_seconds_count[5m])# \u0421\u0440\u0435\u0434\u043d\u044f\u044f \u0434\u043b\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u043f\u0430\u0443\u0437\u044brate(jvm_gc_pause_seconds_sum[5m]) \/ rate(jvm_gc_pause_seconds_count[5m])<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p>\u0421\u0440\u0435\u0434\u043d\u044f\u044f \u043f\u0430\u0443\u0437\u0430 \u0431\u043e\u043b\u044c\u0448\u0435 500 \u043c\u0441 &#8212; \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430. \u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0438 \u0437\u0430\u043c\u0435\u0447\u0430\u044e\u0442.<\/p>\n<p><strong>\u0421\u0438\u0433\u043d\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f, \u0442\u0435\u043f\u0435\u0440\u044c \u0431\u0435\u0437 \u043b\u043e\u0436\u043d\u044b\u0445 \u0434\u043e\u043d\u043e\u0441\u043e\u0432, \u0441 \u0441\u0443\u043c\u043c\u043e\u0439 \u043f\u043e \u043f\u0443\u043b\u0430\u043c:<\/strong><\/p>\n<pre><code class=\"yaml\">- alert: LongGCPauses  expr: |    rate(jvm_gc_pause_seconds_sum[5m])     \/ rate(jvm_gc_pause_seconds_count[5m]) &gt; 0.5  for: 5m  labels:    severity: warning  annotations:    summary: \"Long GC pauses detected\"    description: \"Average GC pause &gt; 500ms\"- alert: HighHeapUsage  expr: |    sum by (application, instance) (jvm_memory_used_bytes{area=\"heap\"})    \/    sum by (application, instance) (jvm_memory_max_bytes{area=\"heap\"} != -1) &gt; 0.8  for: 5m  labels:    severity: warning  annotations:    summary: \"High JVM Heap Usage\"    description: \"Heap usage &gt; 80% (current: {{ $value | humanizePercentage }})\"<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p>\u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 <code>humanizePercentage<\/code>. <code>$value<\/code> \u0432 \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0438 &#8212; \u0434\u043e\u043b\u044f \u043e\u0442 0 \u0434\u043e 1. \u041d\u0430\u043f\u0438\u0448\u0435\u0442\u0435 <code>{{ $value }}%<\/code>, \u0438 \u0434\u0435\u0436\u0443\u0440\u043d\u044b\u0439 \u0432 \u0442\u0440\u0438 \u043d\u043e\u0447\u0438 \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0435\u0442 \u00abheap usage 0.85%\u00bb, \u043f\u043e\u0436\u043c\u0451\u0442 \u043f\u043b\u0435\u0447\u0430\u043c\u0438 \u0438 \u0443\u0441\u043d\u0451\u0442 \u043e\u0431\u0440\u0430\u0442\u043d\u043e. \u0413\u0434\u0435-\u0442\u043e \u043f\u0440\u044f\u043c\u043e \u0441\u0435\u0439\u0447\u0430\u0441 \u0441\u043f\u0438\u0442 \u0434\u0435\u0436\u0443\u0440\u043d\u044b\u0439, \u043a\u043e\u0442\u043e\u0440\u043e\u043c\u0443 \u0440\u0430\u0446\u0438\u044f \u0447\u0435\u0441\u0442\u043d\u043e \u0434\u043e\u043b\u043e\u0436\u0438\u043b\u0430 \u043f\u0440\u043e 0.95%. \u0421\u043f\u0438\u0442. \u0410 \u0437\u0440\u044f.<\/p>\n<h4>Threads: \u043a\u043e\u0433\u0434\u0430 \u0432\u0441\u0435 \u043b\u044e\u0434\u0438 \u0437\u0430\u043d\u044f\u0442\u044b<\/h4>\n<pre><code># \u0416\u0438\u0432\u044b\u0435 \u043f\u043e\u0442\u043e\u043a\u0438jvm_threads_live_threads# \u041f\u0438\u043a\u043e\u0432\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435jvm_threads_peak_threads# Daemon \u043f\u043e\u0442\u043e\u043a\u0438jvm_threads_daemon_threads<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p><code>jvm_threads_live_threads<\/code> \u0443\u043f\u0451\u0440\u0441\u044f \u0432 \u043f\u043e\u0442\u043e\u043b\u043e\u043a? Thread starvation.<\/p>\n<h4>Direct Memory: \u0442\u0435\u043d\u0435\u0432\u043e\u0439 \u0440\u0430\u0439\u043e\u043d<\/h4>\n<pre><code># \u0411\u0443\u0444\u0435\u0440\u044b Netty, Kafka client \u0438 \u0442.\u0434.jvm_buffer_memory_used_bytes{id=\"direct\"}jvm_buffer_count_buffers{id=\"direct\"}<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p>Direct Memory \u0432 heap \u043d\u0435 \u043f\u0440\u043e\u043f\u0438\u0441\u0430\u043d\u0430. \u041d\u043e \u0437\u0430\u043a\u043e\u043d\u0447\u0438\u0442\u044c\u0441\u044f \u043c\u043e\u0436\u0435\u0442. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0435 WebFlux \u0438\u043b\u0438 gRPC? \u0421\u043b\u0435\u0434\u0438\u0442\u0435. \u041d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0435? \u0412\u0441\u0451 \u0440\u0430\u0432\u043d\u043e \u0441\u043b\u0435\u0434\u0438\u0442\u0435.<\/p>\n<h4>JVM Flags: \u0442\u0430\u0431\u0435\u043b\u044c\u043d\u043e\u0435 \u043e\u0440\u0443\u0436\u0438\u0435<\/h4>\n<pre><code class=\"bash\"># Heap dump \u043f\u0440\u0438 OOM - \u0447\u0442\u043e\u0431\u044b \u0431\u044b\u043b\u043e \u0447\u0442\u043e \u0438\u0437\u0443\u0447\u0430\u0442\u044c \u043d\u0430 \u0432\u0441\u043a\u0440\u044b\u0442\u0438\u0438-XX:+HeapDumpOnOutOfMemoryError-XX:HeapDumpPath=\/var\/log\/heapdump.hprof# Heap \u043a\u0430\u043a \u043f\u0440\u043e\u0446\u0435\u043d\u0442 \u043e\u0442 \u043b\u0438\u043c\u0438\u0442\u0430 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0430 - \u0430 \u043b\u0438\u043c\u0438\u0442 \u0437\u0430\u0434\u0430\u0439\u0442\u0435 \u0432 compose\/k8s-XX:MaxRAMPercentage=75.0# \u0414\u0435\u0442\u0430\u043b\u044c\u043d\u044b\u0439 GC logging-Xlog:gc*:file=\/var\/log\/gc.log:time,uptime:filecount=5,filesize=10M# Native Memory Tracking-XX:NativeMemoryTracking=summary<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p>\u041f\u0440\u043e <code>MaxRAMPercentage<\/code> \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u0430\u044f \u0440\u0435\u043c\u0430\u0440\u043a\u0430. \u0421\u0438\u0433\u043d\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u00abheap \u0431\u043e\u043b\u044c\u0448\u0435 80%\u00bb \u0438\u043c\u0435\u0435\u0442 \u0441\u043c\u044b\u0441\u043b, \u0442\u043e\u043b\u044c\u043a\u043e \u043a\u043e\u0433\u0434\u0430 \u0443 heap \u0435\u0441\u0442\u044c \u043f\u043e\u0442\u043e\u043b\u043e\u043a. \u041a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440 \u0431\u0435\u0437 \u043b\u0438\u043c\u0438\u0442\u0430 \u043f\u0430\u043c\u044f\u0442\u0438 &#8212; \u044d\u0442\u043e JVM, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0431\u0435\u0440\u0451\u0442 25% RAM \u0445\u043e\u0441\u0442\u0430 \u0438 \u0436\u0438\u0432\u0451\u0442 \u043d\u0430 \u0448\u0438\u0440\u043e\u043a\u0443\u044e \u043d\u043e\u0433\u0443 \u0437\u0430 \u0447\u0443\u0436\u043e\u0439 \u0441\u0447\u0451\u0442. \u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u043f\u043e\u0442\u043e\u043b\u043e\u043a, \u043f\u043e\u0442\u043e\u043c \u043f\u0440\u043e\u0446\u0435\u043d\u0442\u044b. \u041d\u0435 \u043d\u0430\u043e\u0431\u043e\u0440\u043e\u0442.<\/p>\n<hr\/>\n<h3>\u042d\u043f\u0438\u0437\u043e\u0434 4. HTTP: \u0447\u0442\u043e \u0432\u0438\u0434\u0435\u043b\u0430 \u0443\u043b\u0438\u0446\u0430<\/h3>\n<p>\u0412 \u0441\u0440\u0435\u0434\u0443 \u0432 \u0443\u0447\u0430\u0441\u0442\u043e\u043a \u0437\u0430\u0448\u0451\u043b \u043c\u044d\u0440. \u0411\u043e\u0440\u0438\u0441 \u0410\u0440\u043a\u0430\u0434\u044c\u0435\u0432\u0438\u0447, \u0447\u0435\u043b\u043e\u0432\u0435\u043a, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0438\u0437\u043c\u0435\u0440\u044f\u0435\u0442 \u0432\u0441\u0451 \u0432 \u0434\u0435\u043d\u044c\u0433\u0430\u0445 \u0438 \u0433\u043e\u043b\u043e\u0441\u0430\u0445 \u0438\u0437\u0431\u0438\u0440\u0430\u0442\u0435\u043b\u0435\u0439. \u041a\u0430\u043f\u0438\u0442\u0430\u043d \u041b\u0451\u0448\u0430 \u0433\u043e\u0440\u0434\u043e \u0440\u0430\u0437\u0432\u0435\u0440\u043d\u0443\u043b \u043f\u0435\u0440\u0435\u0434 \u043d\u0438\u043c \u0433\u0440\u0430\u0444\u0438\u043a heap.<\/p>\n<p>\u2014 \u0410 \u0447\u0442\u043e \u0432\u0438\u0434\u044f\u0442 \u043b\u044e\u0434\u0438? \u2014 \u0441\u043f\u0440\u043e\u0441\u0438\u043b \u043c\u044d\u0440.<\/p>\n<p>\u041f\u0430\u0443\u0437\u0430. \u0425\u043e\u0440\u043e\u0448\u0430\u044f. \u0421 \u044d\u0445\u043e\u043c.<\/p>\n<p>JVM-\u043c\u0435\u0442\u0440\u0438\u043a\u0438 &#8212; \u043f\u0440\u043e \u0437\u0434\u043e\u0440\u043e\u0432\u044c\u0435 \u0443\u0447\u0430\u0441\u0442\u043a\u0430. HTTP-\u043c\u0435\u0442\u0440\u0438\u043a\u0438 &#8212; \u043f\u0440\u043e \u0442\u043e, \u0447\u0442\u043e \u0442\u0432\u043e\u0440\u0438\u0442\u0441\u044f \u043d\u0430 \u0443\u043b\u0438\u0446\u0430\u0445. \u041c\u044d\u0440\u0443 \u043f\u043b\u0435\u0432\u0430\u0442\u044c, \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0443 \u0432\u0430\u0441 heap. \u041c\u044d\u0440\u0443 \u0432\u0430\u0436\u043d\u043e, \u0447\u0442\u043e\u0431\u044b \u0433\u043e\u0440\u043e\u0436\u0430\u043d\u0435 \u043d\u0435 \u0436\u0430\u043b\u043e\u0432\u0430\u043b\u0438\u0441\u044c. \u0416\u0435\u043b\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u043d\u0438\u043a\u043e\u0433\u0434\u0430.<\/p>\n<h4>RED Method: \u0442\u0440\u0438 \u0432\u043e\u043f\u0440\u043e\u0441\u0430 \u0441\u043e \u0441\u0442\u0430\u0440\u043e\u0439 \u0432\u0438\u0437\u0438\u0442\u043a\u0438<\/h4>\n<p><strong>R<\/strong>ate &#8212; \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043d\u0430\u0440\u043e\u0434\u0443 \u043f\u0440\u043e\u0445\u043e\u0434\u0438\u0442:<\/p>\n<pre><code>sum(rate(http_server_requests_seconds_count[5m]))<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p><strong>E<\/strong>rrors &#8212; \u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u043e\u0431\u0438\u0434\u0435\u043b\u0438:<\/p>\n<pre><code>sum(rate(http_server_requests_seconds_count{status=~\"5..\"}[5m])) \/ sum(rate(http_server_requests_seconds_count[5m])) * 100<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p><strong>D<\/strong>uration &#8212; \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0436\u0434\u0430\u043b\u0438:<\/p>\n<pre><code>histogram_quantile(0.99,   sum(rate(http_server_requests_seconds_bucket[5m])) by (le))<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<h4>\u041f\u0435\u0440\u0446\u0435\u043d\u0442\u0438\u043b\u0438: \u043f\u043e\u0447\u0435\u043c\u0443 \u0441\u0440\u0435\u0434\u043d\u0435\u0435 &#8212; \u043b\u0436\u0435\u0441\u0432\u0438\u0434\u0435\u0442\u0435\u043b\u044c<\/h4>\n<p>\u041e\u0431\u044a\u044f\u0441\u043d\u044f\u043b \u0414\u0430\u043d\u0435 \u043d\u0430 \u043f\u0430\u043b\u044c\u0446\u0430\u0445. \u0414\u0435\u0432\u044f\u043d\u043e\u0441\u0442\u043e \u0434\u0435\u0432\u044f\u0442\u044c \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u043f\u043e 10 \u043c\u0441, \u043e\u0434\u0438\u043d &#8212; 10 \u0441\u0435\u043a\u0443\u043d\u0434. \u0421\u0440\u0435\u0434\u043d\u0435\u0435: 109 \u043c\u0441. \u041f\u0440\u043e\u0442\u043e\u043a\u043e\u043b \u0447\u0438\u0441\u0442\u044b\u0439, \u043c\u043e\u0436\u043d\u043e \u043d\u0435\u0441\u0442\u0438 \u043c\u044d\u0440\u0443. \u0410 \u043e\u0434\u0438\u043d \u0433\u043e\u0440\u043e\u0436\u0430\u043d\u0438\u043d \u043f\u0440\u043e\u0436\u0434\u0430\u043b 10 \u0441\u0435\u043a\u0443\u043d\u0434 \u0438 \u0443\u0435\u0445\u0430\u043b \u0432 \u0441\u043e\u0441\u0435\u0434\u043d\u0438\u0439 \u0433\u043e\u0440\u043e\u0434. \u041d\u0430\u0432\u0441\u0435\u0433\u0434\u0430.<\/p>\n<p>p99 &#8212; \u0432\u043e\u0442 \u0447\u0435\u0441\u0442\u043d\u044b\u0439 \u0441\u0432\u0438\u0434\u0435\u0442\u0435\u043b\u044c. \u00ab99% \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u0431\u044b\u0441\u0442\u0440\u0435\u0435 \u044d\u0442\u043e\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f\u00bb. \u042d\u0442\u043e \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u0438\u044f \u0441\u0430\u043c\u043e\u0433\u043e \u043d\u0435\u0432\u0435\u0437\u0443\u0447\u0435\u0433\u043e \u0438\u0437 \u0441\u0442\u0430.<\/p>\n<pre><code># \u041c\u0435\u0434\u0438\u0430\u043d\u0430 (p50)histogram_quantile(0.50, sum(rate(http_server_requests_seconds_bucket[5m])) by (le))# p95histogram_quantile(0.95, sum(rate(http_server_requests_seconds_bucket[5m])) by (le))# p99histogram_quantile(0.99, sum(rate(http_server_requests_seconds_bucket[5m])) by (le))<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p>p50 = 50 \u043c\u0441, \u0430 p99 = 5 \u0441? \u0423 \u0432\u0430\u0441 tail latency. \u0412 \u0441\u0440\u0435\u0434\u043d\u0435\u043c \u043f\u043e \u0433\u043e\u0440\u043e\u0434\u0443 \u0441\u043f\u043e\u043a\u043e\u0439\u043d\u043e, \u0430 \u043d\u0430 \u043e\u043a\u0440\u0430\u0438\u043d\u0430\u0445 \u0441\u0442\u0440\u0435\u043b\u044f\u044e\u0442.<\/p>\n<h4>\u041a\u0430\u0441\u0442\u043e\u043c\u043d\u044b\u0435 \u0442\u0435\u0433\u0438: \u043e\u0441\u043e\u0431\u044b\u0435 \u043f\u0440\u0438\u043c\u0435\u0442\u044b<\/h4>\n<p>\u041f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e Spring Boot \u0432\u0435\u0448\u0430\u0435\u0442 \u043d\u0430 HTTP-\u043c\u0435\u0442\u0440\u0438\u043a\u0438 \u0442\u0435\u0433\u0438: method, uri, status, exception, outcome. \u0418\u043d\u043e\u0433\u0434\u0430 \u043d\u0443\u0436\u043d\u044b \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u043f\u0440\u0438\u043c\u0435\u0442\u044b: \u0432\u0435\u0440\u0441\u0438\u044f API, \u0442\u0438\u043f \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438.<\/p>\n<pre><code class=\"java\">\/\/ \u0412\u0410\u0416\u041d\u041e: \u043d\u0430\u0441\u043b\u0435\u0434\u0443\u0435\u043c\u0441\u044f \u043e\u0442 DefaultServerRequestObservationConvention, \u0430 \u041d\u0415 \u043f\u0440\u043e\u0441\u0442\u043e\/\/ \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u043c \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 ServerRequestObservationConvention. \u0414\u0435\u0444\u043e\u043b\u0442\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434\/\/ \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u041f\u0423\u0421\u0422\u041e\u0419 \u043d\u0430\u0431\u043e\u0440 \u0442\u0435\u0433\u043e\u0432 - \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0435 method\/uri\/status\/outcome\/\/ \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442 \u0438\u043c\u0435\u043d\u043d\u043e \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u0439 \u043a\u043b\u0430\u0441\u0441. \u0420\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u0442\u0435 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e - \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0435\/\/ \u0442\u0435\u0433\u0438 \u043f\u0440\u043e\u043f\u0430\u0434\u0443\u0442, status \u0438\u0441\u0447\u0435\u0437\u043d\u0435\u0442 \u0438\u0437 \u043c\u0435\u0442\u0440\u0438\u043a, \u0438 \u0442\u043e\u0433\u0434\u0430 error rate, RED-\u043c\u0435\u0442\u0440\u0438\u043a\u0438\/\/ \u043f\u043e \u0441\u0442\u0430\u0442\u0443\u0441\u0443 \u0438 SLI \u043f\u043e 5xx \u043c\u043e\u043b\u0447\u0430 \u043f\u0435\u0440\u0435\u0441\u0442\u0430\u043d\u0443\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c.@Componentpublic class CustomWebMvcTagsContributor extends DefaultServerRequestObservationConvention {    @Override    public KeyValues getLowCardinalityKeyValues(ServerRequestObservationContext context) {        \/\/ \u0421\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0435 \u0442\u0435\u0433\u0438 (method, uri, status, outcome) \u043e\u0442 \u0431\u0430\u0437\u043e\u0432\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430        KeyValues keyValues = super.getLowCardinalityKeyValues(context);                HttpServletRequest request = context.getCarrier();                \/\/ \u0412\u0435\u0440\u0441\u0438\u044f API        String apiVersion = extractApiVersion(request.getRequestURI());        keyValues = keyValues.and(KeyValue.of(\"api.version\", apiVersion));                \/\/ \u0422\u0438\u043f \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438        String operationType = determineOperationType(            request.getMethod(),             request.getRequestURI()        );        keyValues = keyValues.and(KeyValue.of(\"operation.type\", operationType));                return keyValues;    }    private String extractApiVersion(String uri) {        if (uri != null &amp;&amp; uri.contains(\"\/v\")) {            int vIndex = uri.indexOf(\"\/v\");            if (vIndex &gt;= 0 &amp;&amp; vIndex + 2 &lt; uri.length()) {                int endIndex = uri.indexOf('\/', vIndex + 1);                if (endIndex &lt; 0) endIndex = uri.length();                String version = uri.substring(vIndex + 1, endIndex);                if (version.matches(\"v\\\\d+\")) return version;            }        }        return \"v0\";    }    private String determineOperationType(String method, String uri) {        if (uri == null || method == null) {            return \"unknown\";        }        \/\/ Actuator-\u0442\u0440\u0430\u0444\u0438\u043a \u043f\u043e\u043c\u0435\u0447\u0430\u0435\u043c \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e - \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u0442\u043e\u043c \u043b\u0435\u0433\u043a\u043e \u0438\u0441\u043a\u043b\u044e\u0447\u0430\u0442\u044c        if (uri.startsWith(\"\/actuator\")) {            return \"monitoring\";        }        if (uri.contains(\"\/tasks\")) {            return switch (method.toUpperCase()) {                case \"GET\" -&gt; uri.matches(\".*\/tasks\/\\\\d+$\") ? \"task_read\" : \"task_list\";                case \"POST\" -&gt; uri.endsWith(\"\/complete\") ? \"task_complete\" : \"task_create\";                case \"PUT\" -&gt; \"task_update\";                case \"DELETE\" -&gt; \"task_delete\";                default -&gt; \"task_other\";            };        }        return \"other\";    }    @Override    public String getName() {        \/\/ \u0421\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u043c \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0435 \u0438\u043c\u044f \u043c\u0435\u0442\u0440\u0438\u043a\u0438, \u0438\u043d\u0430\u0447\u0435 \u0432\u0441\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u044b        \/\/ \u043a http_server_requests_* \u0432 \u0434\u0430\u0448\u0431\u043e\u0440\u0434\u0430\u0445 \u0438 \u043f\u0440\u0430\u0432\u0438\u043b\u0430\u0445 \u043e\u0441\u043b\u0435\u043f\u043d\u0443\u0442        return \"http.server.requests\";    }}<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p><strong>\u0412\u0430\u0436\u043d\u043e:<\/strong> \u0442\u043e\u043b\u044c\u043a\u043e low-cardinality! \u041d\u0438\u043a\u0430\u043a\u0438\u0445 user_id, request_id. \u041f\u043e\u0447\u0435\u043c\u0443 &#8212; \u0431\u0443\u0434\u0435\u0442 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u044d\u043f\u0438\u0437\u043e\u0434, \u0443 \u0421\u0435\u0440\u0451\u0433\u0438 \u043d\u0430 \u044d\u0442\u0443 \u0442\u0435\u043c\u0443 \u0435\u0441\u0442\u044c \u0434\u0435\u043b\u043e, \u043f\u043e\u0441\u043b\u0435 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043e\u043d \u043f\u043e\u0441\u0435\u0434\u0435\u043b. \u0415\u0441\u043b\u0438 \u043a\u043e\u0440\u043e\u0442\u043a\u043e: Prometheus \u043d\u0435 \u0432\u044b\u0434\u0435\u0440\u0436\u0438\u0442. \u041d\u0435 \u0444\u0438\u0433\u0443\u0440\u0430\u043b\u044c\u043d\u043e.<\/p>\n<hr\/>\n<h3>\u042d\u043f\u0438\u0437\u043e\u0434 5. \u0411\u0430\u0440 \u00ab\u0423 \u0425\u0438\u043a\u0430\u0440\u0438\u00bb: \u0443\u0437\u043a\u043e\u0435 \u043c\u0435\u0441\u0442\u043e, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0432\u0441\u0435 \u0438\u0449\u0443\u0442<\/h3>\n<p>\u0411\u0430\u0437\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 &#8212; \u0431\u0443\u0442\u044b\u043b\u043e\u0447\u043d\u043e\u0435 \u0433\u043e\u0440\u043b\u044b\u0448\u043a\u043e. \u041f\u0440\u043e \u043d\u0435\u0433\u043e \u0432\u0441\u0435 \u0437\u043d\u0430\u044e\u0442, \u0435\u0433\u043e \u0432\u0441\u0435 \u0438\u0449\u0443\u0442, \u0430 \u043d\u0430\u0445\u043e\u0434\u044f\u0442 \u043e\u0431\u044b\u0447\u043d\u043e \u043a\u043e\u0433\u0434\u0430 \u0443\u0436\u0435 \u043f\u043e\u0437\u0434\u043d\u043e: \u043f\u043e\u0434 \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u043e\u0439 \u0438 \u043d\u0430 \u043f\u0440\u043e\u0434\u0435. Connection pool &#8212; \u043f\u0435\u0440\u0432\u043e\u0435 \u043c\u0435\u0441\u0442\u043e, \u043a\u0443\u0434\u0430 \u0441\u0442\u043e\u0438\u0442 \u0437\u0430\u0439\u0442\u0438. \u042f \u043d\u0430\u0437\u044b\u0432\u0430\u044e \u0435\u0433\u043e \u00ab\u0431\u0430\u0440 \u201c\u0423 \u0425\u0438\u043a\u0430\u0440\u0438\u201d\u00bb: \u0434\u0435\u0441\u044f\u0442\u044c \u0441\u0442\u043e\u043b\u0438\u043a\u043e\u0432, \u0431\u0430\u0440\u043c\u0435\u043d \u0441 \u0441\u0435\u043a\u0443\u043d\u0434\u043e\u043c\u0435\u0440\u043e\u043c, \u0438 \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u043d\u0430 \u0432\u0445\u043e\u0434\u0435 \u043f\u043e\u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0432\u0441\u0435\u0433\u0434\u0430 \u0432\u043d\u0435\u0437\u0430\u043f\u043d\u043e.<\/p>\n<p>\u0423\u0437\u043a\u043e\u0435 \u043c\u0435\u0441\u0442\u043e \u0443 \u043d\u0430\u0441, \u043a\u0441\u0442\u0430\u0442\u0438, \u043d\u0430\u0448\u043b\u043e\u0441\u044c \u0431\u044b\u0441\u0442\u0440\u043e. \u0412 \u0447\u0435\u0442\u0432\u0435\u0440\u0433 \u0414\u0430\u043d\u044f \u0432\u043b\u0435\u0442\u0435\u043b \u0432 \u043a\u0430\u0431\u0438\u043d\u0435\u0442: \u00ab\u0421\u043c\u043e\u0442\u0440\u0438, pending \u0440\u0430\u0441\u0442\u0451\u0442!\u00bb \u0418 \u043c\u044b \u0432\u043f\u0435\u0440\u0432\u044b\u0435 \u0443\u0432\u0438\u0434\u0435\u043b\u0438 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443 <strong>\u0434\u043e<\/strong> \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u043e\u043d\u0430 \u0441\u0442\u0430\u043b\u0430 \u0442\u0440\u0443\u043f\u043e\u043c. \u041e\u0449\u0443\u0449\u0435\u043d\u0438\u0435 \u043d\u0438 \u0441 \u0447\u0435\u043c \u043d\u0435 \u0441\u0440\u0430\u0432\u043d\u0438\u043c\u043e\u0435. \u041a\u0430\u043a \u0440\u0430\u0441\u043a\u0440\u044b\u0442\u044c \u0434\u0435\u043b\u043e \u0434\u043e \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u043e\u043d\u043e \u0437\u0430\u0432\u0435\u043b\u043e\u0441\u044c.<\/p>\n<h4>HikariCP<\/h4>\n<pre><code># \u0410\u043a\u0442\u0438\u0432\u043d\u044b\u0435 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f (\u0441\u0435\u0439\u0447\u0430\u0441 \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442)hikaricp_connections_active# \u041e\u0436\u0438\u0434\u0430\u044e\u0449\u0438\u0435 (\u0441\u0442\u043e\u044f\u0442 \u0432 \u043e\u0447\u0435\u0440\u0435\u0434\u0438)hikaricp_connections_pending# \u041f\u0440\u043e\u0441\u0442\u0430\u0438\u0432\u0430\u044e\u0449\u0438\u0435 (\u0441\u0432\u043e\u0431\u043e\u0434\u043d\u044b)hikaricp_connections_idle# \u0412\u0441\u0435\u0433\u043e \u0432 \u043f\u0443\u043b\u0435hikaricp_connections<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p><strong>\u0417\u0434\u043e\u0440\u043e\u0432\u0430\u044f \u043a\u0430\u0440\u0442\u0438\u043d\u0430:<\/strong> active \u043a\u043e\u043b\u0435\u0431\u043b\u0435\u0442\u0441\u044f, pending \u043d\u0430 \u043d\u0443\u043b\u0435, \u0432 idle \u0435\u0441\u0442\u044c \u0437\u0430\u043f\u0430\u0441.<\/p>\n<p><strong>\u041f\u0440\u043e\u0431\u043b\u0435\u043c\u0430:<\/strong> active = max, pending &gt; 0. \u0412\u0441\u0435 \u0441\u0442\u043e\u043b\u0438\u043a\u0438 \u0437\u0430\u043d\u044f\u0442\u044b, \u0443 \u0432\u0445\u043e\u0434\u0430 \u043e\u0447\u0435\u0440\u0435\u0434\u044c. \u0418 \u043a\u0430\u0436\u0434\u044b\u0439 \u0432 \u044d\u0442\u043e\u0439 \u043e\u0447\u0435\u0440\u0435\u0434\u0438 &#8212; \u0433\u043e\u0440\u043e\u0436\u0430\u043d\u0438\u043d, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0436\u0434\u0451\u0442. \u0410 \u0433\u043e\u0440\u043e\u0436\u0430\u043d\u0435 \u0436\u0434\u0430\u0442\u044c \u043d\u0435 \u043b\u044e\u0431\u044f\u0442. \u041d\u0438\u043a\u0442\u043e \u043d\u0435 \u043b\u044e\u0431\u0438\u0442.<\/p>\n<h4>\u041a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044f<\/h4>\n<pre><code class=\"yaml\">spring:  datasource:    hikari:      pool-name: TodoHikariPool      maximum-pool-size: 10      minimum-idle: 2      register-mbeans: true  # \u042d\u0442\u043e \u043f\u0440\u043e JMX. \u041c\u0435\u0442\u0440\u0438\u043a\u0438 hikaricp_* \u0432 Prometheus \u0438\u0434\u0443\u0442 \u043d\u0435 \u043e\u0442\u0441\u044e\u0434\u0430<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p>\u041c\u0430\u043b\u0435\u043d\u044c\u043a\u043e\u0435 \u0443\u0442\u043e\u0447\u043d\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u0430, \u0447\u0442\u043e\u0431\u044b \u043d\u0435 \u0431\u044b\u043b\u043e \u0440\u0430\u0437\u043e\u0447\u0430\u0440\u043e\u0432\u0430\u043d\u0438\u0439. \u041c\u0435\u0442\u0440\u0438\u043a\u0438 <code>hikaricp_connections_*<\/code> \u043f\u043e\u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0432 Prometheus \u043d\u0435 \u0438\u0437-\u0437\u0430 <code>register-mbeans<\/code>. \u0418\u0445 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u0442 \u0441\u0430\u043c Spring Boot, \u043a\u0430\u043a \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u0434\u0435\u043b\u0435 \u043f\u043e\u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f <code>MeterRegistry<\/code>. \u0410 <code>register-mbeans<\/code> &#8212; \u044d\u0442\u043e \u043f\u0440\u043e JMX, \u043a\u043e\u043d\u0442\u043e\u0440\u0430 \u0438\u0437 \u0434\u0440\u0443\u0433\u043e\u0439 \u044d\u043f\u043e\u0445\u0438. \u0423\u0431\u0435\u0440\u0451\u0442\u0435 \u0444\u043b\u0430\u0433, \u043c\u0435\u0442\u0440\u0438\u043a\u0438 \u043f\u0443\u043b\u0430 \u043e\u0441\u0442\u0430\u043d\u0443\u0442\u0441\u044f \u043d\u0430 \u043c\u0435\u0441\u0442\u0435. \u041f\u0440\u043e\u0432\u0435\u0440\u0435\u043d\u043e \u043b\u0438\u0447\u043d\u043e.<\/p>\n<h4>AOP \u0434\u043b\u044f Repository: \u0442\u043e\u043f\u0442\u0443\u043d \u0443 \u043a\u0430\u0436\u0434\u043e\u0439 \u0434\u0432\u0435\u0440\u0438<\/h4>\n<p>\u0425\u043e\u0442\u0438\u0442\u0435 \u0437\u043d\u0430\u0442\u044c, \u043a\u0430\u043a\u043e\u0439 \u0438\u043c\u0435\u043d\u043d\u043e \u0437\u0430\u043f\u0440\u043e\u0441 \u0442\u043e\u0440\u043c\u043e\u0437\u0438\u0442? \u041f\u043e\u0438\u043c\u0451\u043d\u043d\u043e? \u0421\u0442\u0430\u0432\u0438\u043c \u043d\u0430\u0440\u0443\u0436\u043d\u043e\u0435 \u043d\u0430\u0431\u043b\u044e\u0434\u0435\u043d\u0438\u0435.<\/p>\n<pre><code class=\"java\">@Aspect@Componentpublic class RepositoryMetricsAspect {    private final MeterRegistry meterRegistry;    public RepositoryMetricsAspect(MeterRegistry meterRegistry) {        this.meterRegistry = meterRegistry;    }    @Around(\"execution(* com.example.todo.repository.*Repository.*(..))\")    public Object measureRepositoryCall(ProceedingJoinPoint joinPoint) throws Throwable {        MethodSignature signature = (MethodSignature) joinPoint.getSignature();        String repositoryName = signature.getDeclaringType().getSimpleName();        String methodName = signature.getName();        String operationType = determineOperationType(methodName);        Timer.Sample sample = Timer.start(meterRegistry);        String outcome = \"success\";                try {            return joinPoint.proceed();        } catch (Throwable ex) {            outcome = \"error\";            meterRegistry.counter(\"repository.errors.total\",                    \"repository\", repositoryName,                    \"method\", methodName,                    \"exception\", ex.getClass().getSimpleName()            ).increment();            throw ex;        } finally {            \/\/ \u0422\u043e\u043b\u044c\u043a\u043e \u0433\u0438\u0441\u0442\u043e\u0433\u0440\u0430\u043c\u043c\u0430, \u0431\u0435\u0437 publishPercentiles: \u043f\u0435\u0440\u0446\u0435\u043d\u0442\u0438\u043b\u0438 \u043f\u043e\u0441\u0447\u0438\u0442\u0430\u0435\u0442            \/\/ Prometheus \u0447\u0435\u0440\u0435\u0437 histogram_quantile, \u0438 \u0438\u0445 \u043c\u043e\u0436\u043d\u043e \u0430\u0433\u0440\u0435\u0433\u0438\u0440\u043e\u0432\u0430\u0442\u044c            \/\/ \u043c\u0435\u0436\u0434\u0443 \u0438\u043d\u0441\u0442\u0430\u043d\u0441\u0430\u043c\u0438. \u041a\u043b\u0438\u0435\u043d\u0442\u0441\u043a\u0438\u0435 \u043f\u0435\u0440\u0446\u0435\u043d\u0442\u0438\u043b\u0438 \u0440\u044f\u0434\u043e\u043c \u0441 \u0433\u0438\u0441\u0442\u043e\u0433\u0440\u0430\u043c\u043c\u043e\u0439 -            \/\/ \u043f\u0440\u043e\u0441\u0442\u043e \u043b\u0438\u0448\u043d\u0438\u0435 \u0441\u0435\u0440\u0438\u0438.            sample.stop(Timer.builder(\"repository.method.duration\")                    .description(\"Repository method execution time\")                    .tag(\"repository\", repositoryName)                    .tag(\"method\", methodName)                    .tag(\"operation\", operationType)                    .tag(\"outcome\", outcome)                    .publishPercentileHistogram()                    .register(meterRegistry));        }    }    private String determineOperationType(String methodName) {        String lower = methodName.toLowerCase();        if (lower.startsWith(\"find\") || lower.startsWith(\"get\") || lower.startsWith(\"count\"))             return \"read\";        if (lower.startsWith(\"save\") || lower.startsWith(\"update\"))             return \"write\";        if (lower.startsWith(\"delete\"))             return \"delete\";        return \"other\";    }}<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043a\u0430\u0436\u0434\u044b\u0439 \u0432\u044b\u0437\u043e\u0432 Repository \u043f\u043e\u0434 \u043d\u0430\u0431\u043b\u044e\u0434\u0435\u043d\u0438\u0435\u043c: \u043c\u0435\u0442\u0440\u0438\u043a\u0430 <code>repository.method.duration<\/code>, \u0440\u0430\u0437\u0431\u0438\u0432\u043a\u0430 \u043f\u043e \u043c\u0435\u0442\u043e\u0434\u0430\u043c. \u0412\u0438\u0434\u043d\u043e, \u043a\u0442\u043e \u0442\u043e\u0440\u043c\u043e\u0437\u0438\u0442. \u0421 \u0434\u043e\u043b\u0436\u043d\u043e\u0441\u0442\u044c\u044e \u0438 \u043a\u043b\u0438\u0447\u043a\u043e\u0439.<\/p>\n<h4>PromQL \u0434\u043b\u044f \u0431\u0430\u0437\u044b<\/h4>\n<pre><code># \u0423\u0442\u0438\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043f\u0443\u043b\u0430 %hikaricp_connections_active \/ hikaricp_connections_max * 100# \u0412\u0440\u0435\u043c\u044f \u043e\u0436\u0438\u0434\u0430\u043d\u0438\u044f \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044frate(hikaricp_connections_acquire_seconds_sum[5m]) \/ rate(hikaricp_connections_acquire_seconds_count[5m])# \u0422\u043e\u043f \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u044b\u0445 \u043c\u0435\u0442\u043e\u0434\u043e\u0432topk(5,   histogram_quantile(0.95,     sum(rate(repository_method_duration_seconds_bucket[5m])) by (le, method)))<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<hr\/>\n<h3>\u042d\u043f\u0438\u0437\u043e\u0434 6. \u0414\u0435\u043d\u044c\u0433\u0438: \u044f\u0437\u044b\u043a, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u043d\u0438\u043c\u0430\u0435\u0442 \u043c\u044d\u0440\u0438\u044f<\/h3>\n<p>\u041f\u044f\u0442\u043d\u0438\u0446\u0430, \u043e\u0442\u0447\u0451\u0442 \u0432 \u043c\u044d\u0440\u0438\u0438. \u0411\u043e\u0440\u0438\u0441 \u0410\u0440\u043a\u0430\u0434\u044c\u0435\u0432\u0438\u0447 \u0438\u0437\u0443\u0447\u0430\u0435\u0442 \u043d\u0430\u0448\u0443 \u043d\u043e\u0432\u0443\u044e \u0434\u043e\u0441\u043a\u0443 \u0443\u043b\u0438\u043a. \u0414\u043e\u043b\u0433\u043e. \u041f\u043e\u0442\u043e\u043c \u043f\u043e\u0434\u043d\u0438\u043c\u0430\u0435\u0442 \u0433\u043b\u0430\u0437\u0430:<\/p>\n<p>\u2014 \u0421\u043a\u043e\u043b\u044c\u043a\u043e \u0443 \u043d\u0430\u0441 RPS? \u2014 \u041f\u044f\u0442\u044c\u0441\u043e\u0442, \u2014 \u0433\u043e\u0440\u0434\u043e \u0433\u043e\u0432\u043e\u0440\u0438\u0442 \u043a\u0430\u043f\u0438\u0442\u0430\u043d \u041b\u0451\u0448\u0430. \u2014 \u042d\u0442\u043e \u0445\u043e\u0440\u043e\u0448\u043e? \u2014 \u2026 \u2014 \u042f \u0441\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u044e: \u044d\u0442\u043e \u0445\u043e\u0440\u043e\u0448\u043e \u0438\u043b\u0438 \u043f\u043b\u043e\u0445\u043e? \u2014 \u042d\u0442\u043e\u2026 \u043f\u044f\u0442\u044c\u0441\u043e\u0442.<\/p>\n<p>\u0412 \u043a\u0430\u0431\u0438\u043d\u0435\u0442\u0435 \u0441\u0442\u0430\u043b\u043e \u0442\u0438\u0445\u043e. \u0422\u0430\u043a \u0442\u0438\u0445\u043e \u0431\u044b\u0432\u0430\u0435\u0442, \u043a\u043e\u0433\u0434\u0430 \u0438\u043d\u0436\u0435\u043d\u0435\u0440 \u0438 \u0434\u0435\u043d\u044c\u0433\u0438 \u0432\u043f\u0435\u0440\u0432\u044b\u0435 \u0441\u043c\u043e\u0442\u0440\u044f\u0442 \u0434\u0440\u0443\u0433 \u0434\u0440\u0443\u0433\u0443 \u0432 \u0433\u043b\u0430\u0437\u0430.<\/p>\n<p>\u0422\u0435\u0445\u043d\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u043c\u0435\u0442\u0440\u0438\u043a\u0438 &#8212; \u0434\u043b\u044f \u0443\u0447\u0430\u0441\u0442\u043a\u0430. \u00ab\u0421\u043a\u043e\u043b\u044c\u043a\u043e \u0437\u0430\u0434\u0430\u0447 \u0441\u043e\u0437\u0434\u0430\u043b\u0438 \u0438 \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u043b\u0438\u00bb &#8212; \u0434\u043b\u044f \u043c\u044d\u0440\u0438\u0438. \u0420\u0430\u0437\u043d\u044b\u0435 \u0432\u043e\u043f\u0440\u043e\u0441\u044b, \u0440\u0430\u0437\u043d\u044b\u0435 \u043e\u0442\u0432\u0435\u0442\u044b, \u0440\u0430\u0437\u043d\u044b\u0435 \u043b\u044e\u0434\u0438. \u0418 \u0436\u0430\u043b\u043e\u0432\u0430\u043d\u044c\u0435 \u043d\u0430\u043c, \u043c\u0435\u0436\u0434\u0443 \u043f\u0440\u043e\u0447\u0438\u043c, \u043f\u043e\u0434\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442 \u043c\u044d\u0440\u0438\u044f. \u0422\u0430\u043a \u0447\u0442\u043e \u0443\u0447\u0438\u043c \u0438\u0445 \u044f\u0437\u044b\u043a. \u042f\u0437\u044b\u043a \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u00ab\u0431\u0438\u0437\u043d\u0435\u0441-\u043c\u0435\u0442\u0440\u0438\u043a\u0438\u00bb, \u0438 \u0432 Micrometer \u0434\u043b\u044f \u043d\u0435\u0433\u043e \u0447\u0435\u0442\u044b\u0440\u0435 \u043f\u0430\u0434\u0435\u0436\u0430.<\/p>\n<h4>\u0427\u0435\u0442\u044b\u0440\u0435 \u0442\u0438\u043f\u0430 \u043c\u0435\u0442\u0440\u0438\u043a Micrometer<\/h4>\n<p><strong>Counter<\/strong> &#8212; \u0442\u043e\u043b\u044c\u043a\u043e \u0440\u0430\u0441\u0442\u0451\u0442. \u041a\u0430\u043a \u0434\u043e\u0441\u044c\u0435. \u041d\u0430\u0437\u0430\u0434 \u043d\u0435 \u043e\u0442\u043c\u0430\u0442\u044b\u0432\u0430\u0435\u0442\u0441\u044f.<\/p>\n<p><strong>Gauge<\/strong> &#8212; \u0442\u0435\u043a\u0443\u0449\u0435\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435. \u041a\u0430\u043a \u0442\u0435\u043c\u043f\u0435\u0440\u0430\u0442\u0443\u0440\u0430: \u0441\u0435\u0439\u0447\u0430\u0441 36.6, \u0447\u0435\u0440\u0435\u0437 \u0447\u0430\u0441 37. \u041c\u043e\u0436\u0435\u0442 \u0440\u0430\u0441\u0442\u0438, \u043c\u043e\u0436\u0435\u0442 \u043f\u0430\u0434\u0430\u0442\u044c.<\/p>\n<p><strong>Timer<\/strong> &#8212; \u0432\u0440\u0435\u043c\u044f \u0438 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e. \u0421\u0435\u043a\u0443\u043d\u0434\u043e\u043c\u0435\u0440 \u0441 \u043f\u0430\u043c\u044f\u0442\u044c\u044e.<\/p>\n<p><strong>Distribution Summary<\/strong> &#8212; \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439. \u041d\u0435 \u0432\u0440\u0435\u043c\u0435\u043d\u0438, \u0430 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439: \u0440\u0430\u0437\u043c\u0435\u0440 \u0437\u0430\u043f\u0440\u043e\u0441\u0430, \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0442\u043e\u0432\u0430\u0440\u043e\u0432 \u0432 \u043a\u043e\u0440\u0437\u0438\u043d\u0435, \u0441\u0443\u043c\u043c\u0430 \u0447\u0435\u043a\u0430.<\/p>\n<h4>TaskService \u0441 \u043f\u043e\u043b\u043d\u044b\u043c \u043d\u0430\u0431\u043e\u0440\u043e\u043c<\/h4>\n<pre><code class=\"java\">@Service@Transactionalpublic class TaskService {    private final TaskRepository taskRepository;    private final MeterRegistry meterRegistry;    private final ApplicationEventPublisher eventPublisher;        \/\/ Counters    private Counter tasksCreatedCounter;    private Counter tasksCompletedCounter;    private Counter tasksDeletedCounter;        \/\/ Gauge \u0447\u0435\u0440\u0435\u0437 AtomicInteger    private final AtomicInteger activeTasksGauge = new AtomicInteger(0);        \/\/ Timer    private Timer taskProcessingTimer;        \/\/ Distribution Summary    private DistributionSummary taskPrioritySummary;    public TaskService(TaskRepository taskRepository,                        MeterRegistry meterRegistry,                       ApplicationEventPublisher eventPublisher) {        this.taskRepository = taskRepository;        this.meterRegistry = meterRegistry;        this.eventPublisher = eventPublisher;    }    @PostConstruct    public void initMetrics() {        \/\/ \u0412\u043d\u0438\u043c\u0430\u043d\u0438\u0435: \u0438\u043c\u044f \u041d\u0415 \u0437\u0430\u043a\u0430\u043d\u0447\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u043d\u0430 \".total\".        \/\/ Micrometer \u0441\u0430\u043c \u0434\u043e\u0431\u0430\u0432\u0438\u0442 \u0441\u0443\u0444\u0444\u0438\u043a\u0441 _total \u0434\u043b\u044f Prometheus.        \/\/ \"tasks.created\" \u0441\u0442\u0430\u043d\u0435\u0442 \u043c\u0435\u0442\u0440\u0438\u043a\u043e\u0439 tasks_created_total.        \/\/ \u041d\u0430\u0437\u043e\u0432\u0451\u0442\u0435 \"tasks.created.total\" - \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0435 tasks_created_total_total. \u0414\u0432\u0430\u0436\u0434\u044b. \u0417\u0430\u0447\u0435\u043c?        tasksCreatedCounter = Counter.builder(\"tasks.created\")                .description(\"Total number of created tasks\")                .register(meterRegistry);        tasksCompletedCounter = Counter.builder(\"tasks.completed\")                .description(\"Total number of completed tasks\")                .register(meterRegistry);        tasksDeletedCounter = Counter.builder(\"tasks.deleted\")                .description(\"Total number of deleted tasks\")                .register(meterRegistry);        Gauge.builder(\"tasks.active.count\", activeTasksGauge, AtomicInteger::get)                .description(\"Current number of active tasks\")                .register(meterRegistry);        taskProcessingTimer = Timer.builder(\"tasks.processing.time\")                .description(\"Task processing time from creation to completion\")                .publishPercentiles(0.5, 0.75, 0.95, 0.99)                .register(meterRegistry);        taskPrioritySummary = DistributionSummary.builder(\"tasks.priority.distribution\")                .description(\"Distribution of task priorities\")                .publishPercentiles(0.5, 0.75, 0.95)                .register(meterRegistry);        \/\/ \u0418\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f gauge \u0438\u0437 \u0411\u0414 (\u043e\u0434\u043d\u043e\u043a\u0440\u0430\u0442\u043d\u043e, \u043f\u0440\u0438 \u0441\u0442\u0430\u0440\u0442\u0435).        \/\/ countActiveTasks() \u0441\u0447\u0438\u0442\u0430\u0435\u0442 PENDING + IN_PROGRESS. \u0418\u043c\u0435\u043d\u043d\u043e \u0438\u0445,        \/\/ \u0430 \u043d\u0435 \"\u0432\u0441\u0451, \u0447\u0442\u043e \u043d\u0435 DONE\" - \u043e\u0442\u043c\u0435\u043d\u0451\u043d\u043d\u0430\u044f \u0437\u0430\u0434\u0430\u0447\u0430 \u043d\u0435 \u0430\u043a\u0442\u0438\u0432\u043d\u0430\u044f,        \/\/ \u0445\u043e\u0442\u044f \u0438 \u043d\u0435 \u0437\u0430\u0432\u0435\u0440\u0448\u0451\u043d\u043d\u0430\u044f. \u0421\u0435\u043c\u0430\u043d\u0442\u0438\u043a\u0430 gauge \u0434\u043e\u043b\u0436\u043d\u0430 \u0441\u043e\u0432\u043f\u0430\u0434\u0430\u0442\u044c        \/\/ \u0441 \u043b\u043e\u0433\u0438\u043a\u043e\u0439 \u0438\u043d\u043a\u0440\u0435\u043c\u0435\u043d\u0442\u043e\u0432\/\u0434\u0435\u043a\u0440\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u043d\u0438\u0436\u0435, \u0438\u043d\u0430\u0447\u0435 gauge \u0443\u0435\u0434\u0435\u0442.        activeTasksGauge.set((int) taskRepository.countActiveTasks());    }    @Transactional    public Task createTask(String title, String description, TaskPriority priority) {        Task task = new Task(title, description, priority);        Task savedTask = taskRepository.save(task);        tasksCreatedCounter.increment();        taskPrioritySummary.record(priority.getWeight());        meterRegistry.counter(\"tasks.created.by.priority\",                \"priority\", priority.name().toLowerCase()        ).increment();        activeTasksGauge.incrementAndGet();        eventPublisher.publishEvent(new TaskCreatedEvent(savedTask));        return savedTask;    }    @Transactional    public Task completeTask(Long id) {        Task task = taskRepository.findById(id)                .orElseThrow(() -&gt; new TaskNotFoundException(id));        if (task.getStatus() == TaskStatus.DONE) {            \/\/ \u0411\u0435\u0437 \u044d\u0442\u043e\u0439 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u044b\u0439 complete \u0434\u0435\u043a\u0440\u0435\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043b \u0431\u044b            \/\/ gauge \u0430\u043a\u0442\u0438\u0432\u043d\u044b\u0445 \u0437\u0430\u0434\u0430\u0447 \u0432\u0442\u043e\u0440\u043e\u0439 \u0440\u0430\u0437. \u041c\u0435\u0442\u0440\u0438\u043a\u0438 \u044d\u0442\u043e\u0433\u043e \u043d\u0435 \u043f\u0440\u043e\u0449\u0430\u044e\u0442.            throw new IllegalStateException(\"\u0417\u0430\u0434\u0430\u0447\u0430 \u0443\u0436\u0435 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0430\");        }        task.setStatus(TaskStatus.DONE);        task.setCompletedAt(LocalDateTime.now());        Duration processingTime = Duration.between(            task.getCreatedAt(),             task.getCompletedAt()        );        taskProcessingTimer.record(processingTime);        tasksCompletedCounter.increment();        activeTasksGauge.decrementAndGet();        eventPublisher.publishEvent(new TaskCompletedEvent(task, processingTime));        return taskRepository.save(task);    }    @Transactional    public void deleteTask(Long id) {        Task task = taskRepository.findById(id)                .orElseThrow(() -&gt; new TaskNotFoundException(id));        \/\/ \u0414\u0435\u043a\u0440\u0435\u043c\u0435\u043d\u0442\u0438\u0440\u0443\u0435\u043c gauge \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0430\u043a\u0442\u0438\u0432\u043d\u044b\u0445 \u0437\u0430\u0434\u0430\u0447.        \/\/ \u0423\u0441\u043b\u043e\u0432\u0438\u0435 \"status != DONE\" \u0431\u044b\u043b\u043e \u0431\u044b \u043e\u0448\u0438\u0431\u043a\u043e\u0439: \u043e\u0442\u043c\u0435\u043d\u0451\u043d\u043d\u0430\u044f (CANCELLED)        \/\/ \u0437\u0430\u0434\u0430\u0447\u0430 \u0432 gauge \u043d\u0435 \u0432\u0445\u043e\u0434\u0438\u0442, \u0438 \u0435\u0451 \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u0443\u0432\u0435\u043b\u043e \u0431\u044b \u0441\u0447\u0451\u0442\u0447\u0438\u043a \u0432 \u043c\u0438\u043d\u0443\u0441.        if (task.getStatus() == TaskStatus.PENDING ||            task.getStatus() == TaskStatus.IN_PROGRESS) {            activeTasksGauge.decrementAndGet();        }        taskRepository.delete(task);        tasksDeletedCounter.increment();    }    public static class TaskNotFoundException extends RuntimeException {        public TaskNotFoundException(Long id) {            super(\"Task not found: \" + id);        }    }}<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p>\u0420\u0430\u0431\u043e\u0442\u0430\u0435\u0442? \u0420\u0430\u0431\u043e\u0442\u0430\u0435\u0442. \u0410 \u0442\u0435\u043f\u0435\u0440\u044c \u0434\u0432\u0430 \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432 \u0443\u0447\u0435\u0431\u043d\u0438\u043a\u0430\u0445 \u043f\u0435\u0447\u0430\u0442\u0430\u044e\u0442 \u043c\u0435\u043b\u043a\u0438\u043c \u0448\u0440\u0438\u0444\u0442\u043e\u043c, \u0430 \u0432 \u0436\u0438\u0437\u043d\u0438 \u043a\u0440\u043e\u0432\u044c\u044e.<\/p>\n<p><strong>\u041f\u0435\u0440\u0432\u043e\u0435: \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0438.<\/strong> \u0412\u0441\u0435 \u044d\u0442\u0438 <code>counter.increment()<\/code> \u0438\u0441\u043f\u043e\u043b\u043d\u044f\u044e\u0442\u0441\u044f \u0432\u043d\u0443\u0442\u0440\u0438 <code>@Transactional<\/code>-\u043c\u0435\u0442\u043e\u0434\u0430, \u0434\u043e \u043a\u043e\u043c\u043c\u0438\u0442\u0430. \u0422\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u044f \u043e\u0442\u043a\u0430\u0442\u0438\u043b\u0430\u0441\u044c, \u0430 \u0441\u0447\u0451\u0442\u0447\u0438\u043a \u0443\u0436\u0435 \u0443\u0432\u0435\u043b\u0438\u0447\u0435\u043d. \u0417\u0430\u0434\u0430\u0447\u0438 \u0432 \u0431\u0430\u0437\u0435 \u043d\u0435\u0442, \u0432 \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u0435 \u0435\u0441\u0442\u044c. \u041e\u0434\u0438\u043d \u043e\u0442\u043a\u0430\u0442 &#8212; \u043f\u043e\u0433\u0440\u0435\u0448\u043d\u043e\u0441\u0442\u044c. \u0422\u044b\u0441\u044f\u0447\u0430 \u043e\u0442\u043a\u0430\u0442\u043e\u0432 &#8212; \u0444\u0430\u043b\u044c\u0448\u0438\u0432\u044b\u0439 \u043e\u0442\u0447\u0451\u0442, \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u0435\u0440\u0438\u0442 \u0432\u0435\u0441\u044c \u0433\u043e\u0440\u043e\u0434, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043e\u043d \u043a\u0440\u0430\u0441\u0438\u0432\u043e \u043d\u0430\u0440\u0438\u0441\u043e\u0432\u0430\u043d. \u0414\u043b\u044f \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u0430 \u0434\u0435\u043b \u044d\u0442\u043e \u043f\u0440\u0438\u0435\u043c\u043b\u0435\u043c\u0430\u044f \u0446\u0435\u043d\u0430 \u043f\u0440\u043e\u0441\u0442\u043e\u0442\u044b. \u0414\u043b\u044f \u0442\u043e\u0447\u043d\u044b\u0445 \u0431\u0438\u0437\u043d\u0435\u0441-\u043c\u0435\u0442\u0440\u0438\u043a \u0435\u0441\u0442\u044c \u0441\u043f\u043e\u0441\u043e\u0431 \u0447\u0438\u0449\u0435: \u0441\u043e\u0431\u044b\u0442\u0438\u044f \u0441 <code>@TransactionalEventListener(AFTER_COMMIT)<\/code>. \u041e \u043d\u0451\u043c \u0447\u0435\u0440\u0435\u0437 \u044d\u043f\u0438\u0437\u043e\u0434, \u0438 \u0442\u0430\u043c \u0431\u0443\u0434\u0435\u0442 \u0434\u0435\u043b\u043e \u043e \u043f\u044f\u0442\u0438 \u0437\u0430\u0434\u0430\u0447\u0430\u0445-\u043f\u0440\u0438\u0437\u0440\u0430\u043a\u0430\u0445.<\/p>\n<p><strong>\u0412\u0442\u043e\u0440\u043e\u0435: \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0438\u043d\u0441\u0442\u0430\u043d\u0441\u043e\u0432.<\/strong> <code>activeTasksGauge<\/code> \u0436\u0438\u0432\u0451\u0442 \u0432 \u043f\u0430\u043c\u044f\u0442\u0438 \u043e\u0434\u043d\u043e\u0433\u043e \u0438\u043d\u0441\u0442\u0430\u043d\u0441\u0430. \u041f\u043e\u0434\u043d\u0438\u043c\u0435\u0442\u0435 \u0442\u0440\u0438 \u0440\u0435\u043f\u043b\u0438\u043a\u0438 \u043d\u0430\u0434 \u043e\u0431\u0449\u0435\u0439 \u0431\u0430\u0437\u043e\u0439, \u0438 \u043a\u0430\u0436\u0434\u0430\u044f \u0431\u0443\u0434\u0435\u0442 \u0432\u0438\u0434\u0435\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0441\u0432\u043e\u0438 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438, \u0430 \u043f\u043e\u0441\u043b\u0435 \u0440\u0435\u0441\u0442\u0430\u0440\u0442\u0430 \u043f\u0435\u0440\u0435\u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u043f\u043e\u043b\u043d\u044b\u043c \u0447\u0438\u0441\u043b\u043e\u043c \u0437\u0430\u0434\u0430\u0447 \u0438\u0437 \u0411\u0414. \u0421\u0443\u043c\u043c\u0430 \u043f\u043e \u0438\u043d\u0441\u0442\u0430\u043d\u0441\u0430\u043c \u043f\u0440\u0435\u0432\u0440\u0430\u0442\u0438\u0442\u0441\u044f \u0432 \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0442\u043d\u0443\u044e \u0436\u0438\u0432\u043e\u043f\u0438\u0441\u044c: \u0434\u043e\u0440\u043e\u0433\u043e, \u043d\u0435\u043f\u043e\u043d\u044f\u0442\u043d\u043e, \u043a \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u044f \u043d\u0435 \u0438\u043c\u0435\u0435\u0442. \u0414\u043b\u044f \u043e\u0434\u043d\u043e\u0439 \u0440\u0435\u043f\u043b\u0438\u043a\u0438 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043e\u0442\u043b\u0438\u0447\u043d\u043e. \u0414\u043b\u044f \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 &#8212; \u0447\u0438\u0442\u0430\u0439\u0442\u0435 gauge \u0438\u0437 \u0411\u0414 (\u0441 \u043a\u044d\u0448\u0435\u043c, \u043d\u0435 \u043d\u0430 \u043a\u0430\u0436\u0434\u044b\u0439 scrape) \u0438\u043b\u0438 \u0441\u0442\u0440\u043e\u0439\u0442\u0435 \u0435\u0433\u043e \u043f\u043e\u0432\u0435\u0440\u0445 counters \u0432 PromQL.<\/p>\n<h4>\u0428\u043f\u0430\u0440\u0433\u0430\u043b\u043a\u0430<\/h4>\n<div>\n<div class=\"table\">\n<table>\n<tbody>\n<tr>\n<th>\n<p align=\"left\">\u0421\u0446\u0435\u043d\u0430\u0440\u0438\u0439<\/p>\n<\/th>\n<th>\n<p align=\"left\">\u0422\u0438\u043f<\/p>\n<\/th>\n<th>\n<p align=\"left\">\u041f\u0440\u0438\u043c\u0435\u0440<\/p>\n<\/th>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">\u041f\u043e\u0434\u0441\u0447\u0451\u0442 \u0441\u043e\u0431\u044b\u0442\u0438\u0439<\/p>\n<\/td>\n<td>\n<p align=\"left\">Counter<\/p>\n<\/td>\n<td>\n<p align=\"left\"><code>orders.created<\/code><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">\u0422\u0435\u043a\u0443\u0449\u0435\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435<\/p>\n<\/td>\n<td>\n<p align=\"left\">Gauge<\/p>\n<\/td>\n<td>\n<p align=\"left\"><code>users.online.count<\/code><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">\u0412\u0440\u0435\u043c\u044f \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439<\/p>\n<\/td>\n<td>\n<p align=\"left\">Timer<\/p>\n<\/td>\n<td>\n<p align=\"left\"><code>order.processing.time<\/code><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">\u0420\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439<\/p>\n<\/td>\n<td>\n<p align=\"left\">Distribution Summary<\/p>\n<\/td>\n<td>\n<p align=\"left\"><code>order.items.count<\/code><\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<p>Counter \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442 \u043d\u0430 \u0432\u043e\u043f\u0440\u043e\u0441 \u00ab\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0432\u0441\u0435\u0433\u043e\u00bb, gauge &#8212; \u00ab\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u044f\u043c\u043e \u0441\u0435\u0439\u0447\u0430\u0441\u00bb.<\/p>\n<p>\u041d\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c \u043e\u0442\u0447\u0451\u0442\u0435 \u041b\u0451\u0448\u0430 \u043f\u043e\u043a\u0430\u0437\u0430\u043b \u043c\u044d\u0440\u0443 \u0433\u0440\u0430\u0444\u0438\u043a \u00ab\u0441\u043e\u0437\u0434\u0430\u043d\u043e \u0437\u0430\u0434\u0430\u0447 \/ \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u043e \u0437\u0430\u0434\u0430\u0447\u00bb. \u0411\u043e\u0440\u0438\u0441 \u0410\u0440\u043a\u0430\u0434\u044c\u0435\u0432\u0438\u0447 \u043a\u0438\u0432\u043d\u0443\u043b: \u00ab\u0412\u043e\u0442. \u0412\u043e\u0442 \u044d\u0442\u043e \u044f \u043f\u043e\u043d\u0438\u043c\u0430\u044e\u00bb. \u041c\u044b \u043d\u0430\u0448\u043b\u0438 \u043e\u0431\u0449\u0438\u0439 \u044f\u0437\u044b\u043a.<\/p>\n<hr\/>\n<h3>\u042d\u043f\u0438\u0437\u043e\u0434 7. \u0421\u0432\u043e\u044f \u0430\u0433\u0435\u043d\u0442\u0443\u0440\u0430: \u043a\u0430\u0441\u0442\u043e\u043c\u043d\u044b\u0435 \u043c\u0435\u0442\u0440\u0438\u043a\u0438<\/h3>\n<p>MeterRegistry &#8212; \u044d\u0442\u043e \u043a\u0430\u0440\u0442\u043e\u0442\u0435\u043a\u0430. \u0421\u044e\u0434\u0430 \u0441\u0442\u0435\u043a\u0430\u0435\u0442\u0441\u044f \u0432\u0441\u0451, \u043e\u0442\u0441\u044e\u0434\u0430 \u0443\u0445\u043e\u0434\u0438\u0442 \u043a \u0430\u0440\u0445\u0438\u0432\u0430\u0440\u0438\u0443\u0441\u0443. \u041d\u0430\u0441\u0442\u0440\u043e\u0438\u0448\u044c \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e &#8212; \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043d\u0430 \u0442\u0435\u0431\u044f. \u041d\u0430\u0441\u0442\u0440\u043e\u0438\u0448\u044c \u043d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e &#8212; \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043f\u0440\u043e\u0442\u0438\u0432 \u0442\u0435\u0431\u044f, \u043f\u0440\u0438\u0447\u0451\u043c \u0441 \u044d\u043d\u0442\u0443\u0437\u0438\u0430\u0437\u043c\u043e\u043c \u043d\u043e\u0432\u0438\u0447\u043a\u0430.<\/p>\n<h4>\u041a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044f MeterRegistry<\/h4>\n<pre><code class=\"java\">@Configurationpublic class MeterRegistryConfig {    \/\/ \u0422\u0435\u0433 application \u0437\u0434\u0435\u0441\u044c \u041d\u0415 \u0437\u0430\u0434\u0430\u0451\u043c - \u043e\u043d \u0443\u0436\u0435 \u0437\u0430\u0434\u0430\u043d \u0432 application.yml    \/\/ (management.metrics.tags.application). \u0414\u0432\u0430 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0430 \u043f\u0440\u0430\u0432\u0434\u044b \u0434\u043b\u044f    \/\/ \u043e\u0434\u043d\u043e\u0433\u043e \u0442\u0435\u0433\u0430 - \u044d\u0442\u043e \u043d\u0435 \u043d\u0430\u0434\u0451\u0436\u043d\u043e\u0441\u0442\u044c. \u042d\u0442\u043e \u0434\u0432\u0430 \u043c\u0435\u0441\u0442\u0430, \u0433\u0434\u0435 \u043c\u043e\u0436\u043d\u043e \u043e\u0448\u0438\u0431\u0438\u0442\u044c\u0441\u044f.    @Bean    public MeterRegistryCustomizer&lt;MeterRegistry&gt; commonTags() {        return registry -&gt; registry.config()                .commonTags(                        \"team\", \"backend\",                        \"version\", \"1.0.0\"                );    }    @Bean    public MeterRegistryCustomizer&lt;MeterRegistry&gt; metricsFilters() {        return registry -&gt; registry.config()                \/\/ \u0417\u0430\u0449\u0438\u0442\u0430 \u043e\u0442 cardinality explosion                .meterFilter(MeterFilter.maximumAllowableTags(                    \"http.server.requests\", \"uri\", 100, MeterFilter.deny()))                                \/\/ \u0418\u0433\u043d\u043e\u0440\u0438\u0440\u0443\u0435\u043c \u043f\u043e-\u043d\u0430\u0441\u0442\u043e\u044f\u0449\u0435\u043c\u0443 \u043b\u0438\u0448\u043d\u0435\u0435 (logback-\u043c\u0435\u0442\u0440\u0438\u043a\u0438).                \/\/ \u041d\u0415 \u043e\u0442\u043a\u043b\u044e\u0447\u0430\u0439\u0442\u0435 jvm.gc.pause - \u043d\u0430 \u043d\u0435\u0439 \u0434\u0435\u0440\u0436\u0430\u0442\u0441\u044f \u0430\u043b\u0435\u0440\u0442 \u043f\u043e GC,                \/\/ recording rule \u0438 \u043f\u0430\u043d\u0435\u043b\u044c \u0432 Grafana. \u041e\u0442\u043a\u043b\u044e\u0447\u0438\u0442\u0435 - \u0438 \u0443\u0437\u043d\u0430\u0435\u0442\u0435 \u043e \u043f\u0430\u0443\u0437\u0430\u0445                \/\/ GC \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u043c. \u041a\u0430\u043a \u043f\u0440\u0430\u0432\u0438\u043b\u043e, \u0443\u0436\u0435 \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u0441\u0430\u043c\u043e\u0433\u043e \u0438\u043d\u0446\u0438\u0434\u0435\u043d\u0442\u0430.                .meterFilter(MeterFilter.denyNameStartsWith(\"logback\"))                                \/\/ \u0413\u0438\u0441\u0442\u043e\u0433\u0440\u0430\u043c\u043c\u044b - \u0422\u041e\u041b\u042c\u041a\u041e \u0434\u043b\u044f \u0431\u0438\u0437\u043d\u0435\u0441-\u0442\u0430\u0439\u043c\u0435\u0440\u043e\u0432 tasks.*                \/\/ \u0412\u043a\u043b\u044e\u0447\u0438\u0442\u044c percentilesHistogram \u0434\u043b\u044f \u0412\u0421\u0415\u0425 \u0442\u0430\u0439\u043c\u0435\u0440\u043e\u0432 - \u0437\u043d\u0430\u0447\u0438\u0442                \/\/ \u043f\u043e\u0434\u0430\u0440\u0438\u0442\u044c \u043a\u0430\u0436\u0434\u043e\u043c\u0443 \u043f\u043e 60-70 \u0441\u0435\u0440\u0438\u0439 le=\"...\" \u043d\u0430 \u043a\u0430\u0436\u0434\u0443\u044e \u043a\u043e\u043c\u0431\u0438\u043d\u0430\u0446\u0438\u044e                \/\/ \u0442\u0435\u0433\u043e\u0432. \u0421\u0432\u043e\u0439 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 cardinality explosion, \u0441\u0434\u0435\u043b\u0430\u043d\u043d\u044b\u0439                \/\/ \u0441\u0432\u043e\u0438\u043c\u0438 \u0440\u0443\u043a\u0430\u043c\u0438. \u0418\u0437 \u043b\u0443\u0447\u0448\u0438\u0445 \u043f\u043e\u0431\u0443\u0436\u0434\u0435\u043d\u0438\u0439. \u041a\u0430\u043a \u043e\u0431\u044b\u0447\u043d\u043e.                .meterFilter(new MeterFilter() {                    @Override                    public DistributionStatisticConfig configure(                            Meter.Id id, DistributionStatisticConfig config) {                        if (id.getType() == Meter.Type.TIMER                                 &amp;&amp; id.getName().startsWith(\"tasks.\")) {                            return DistributionStatisticConfig.builder()                                    .percentilesHistogram(true)                                    .build()                                    .merge(config);                        }                        return config;                    }                });    }}<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p>\u0418 \u0435\u0449\u0451 \u043e\u0434\u043d\u0430 \u043e\u043f\u0435\u0440\u0430\u0442\u0438\u0432\u043d\u0430\u044f \u0441\u043f\u0440\u0430\u0432\u043a\u0430 \u043f\u0440\u043e \u043f\u0435\u0440\u0446\u0435\u043d\u0442\u0438\u043b\u0438, \u043f\u043e\u043a\u0430 \u043a\u0430\u0440\u0442\u043e\u0442\u0435\u043a\u0430 \u043e\u0442\u043a\u0440\u044b\u0442\u0430. \u0418\u0445 \u0434\u0432\u0430 \u0441\u043e\u0440\u0442\u0430: \u043a\u043b\u0438\u0435\u043d\u0442\u0441\u043a\u0438\u0435 (<code>publishPercentiles<\/code>) \u0438 \u0441\u0435\u0440\u0432\u0435\u0440\u043d\u044b\u0435 (\u0433\u0438\u0441\u0442\u043e\u0433\u0440\u0430\u043c\u043c\u0430 + <code>histogram_quantile<\/code>). \u041a\u043b\u0438\u0435\u043d\u0442\u0441\u043a\u0438\u0435 \u0441\u0447\u0438\u0442\u0430\u044e\u0442\u0441\u044f \u0432 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438 \u0438 <strong>\u043d\u0435 \u0430\u0433\u0440\u0435\u0433\u0438\u0440\u0443\u044e\u0442\u0441\u044f<\/strong> \u043c\u0435\u0436\u0434\u0443 \u0438\u043d\u0441\u0442\u0430\u043d\u0441\u0430\u043c\u0438: p99 \u0442\u0440\u0451\u0445 \u0440\u0435\u043f\u043b\u0438\u043a \u0438\u0437 \u0442\u0440\u0451\u0445 \u043a\u043b\u0438\u0435\u043d\u0442\u0441\u043a\u0438\u0445 p99 \u043d\u0435 \u0441\u043e\u0431\u0440\u0430\u0442\u044c. \u0421\u0435\u0440\u0432\u0435\u0440\u043d\u044b\u0435 \u0441\u0447\u0438\u0442\u0430\u044e\u0442\u0441\u044f \u0438\u0437 \u0431\u0430\u043a\u0435\u0442\u043e\u0432 \u0438 \u0430\u0433\u0440\u0435\u0433\u0438\u0440\u0443\u044e\u0442\u0441\u044f \u043a\u0430\u043a \u0443\u0433\u043e\u0434\u043d\u043e. \u041f\u0440\u0430\u0432\u0438\u043b\u043e \u043f\u0440\u043e\u0441\u0442\u043e\u0435: \u0433\u0438\u0441\u0442\u043e\u0433\u0440\u0430\u043c\u043c\u0430 &#8212; \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442, \u043a\u043b\u0438\u0435\u043d\u0442\u0441\u043a\u0438\u0435 \u043f\u0435\u0440\u0446\u0435\u043d\u0442\u0438\u043b\u0438 \u0440\u044f\u0434\u043e\u043c \u0441 \u043d\u0435\u0439 &#8212; \u043b\u0438\u0448\u043d\u0438\u0435 \u0441\u0435\u0440\u0438\u0438 \u0431\u0435\u0437 \u043d\u043e\u0432\u043e\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438.<\/p>\n<h4>@Timed vs \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043d\u044b\u0439 \u043f\u043e\u0434\u0445\u043e\u0434<\/h4>\n<p><strong>Timed &#8212; \u043f\u0440\u043e\u0441\u0442\u043e \u0438 \u0431\u044b\u0441\u0442\u0440\u043e:<\/strong><\/p>\n<pre><code class=\"java\">@Timed(value = \"task.service.create\", description = \"Time to create task\")public Task createTask(...) {    \/\/ \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0438\u0437\u043c\u0435\u0440\u044f\u0435\u0442\u0441\u044f}<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p><strong>\u041f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043d\u044b\u0439 \u043f\u043e\u0434\u0445\u043e\u0434 &#8212; \u043a\u043e\u0433\u0434\u0430 \u043d\u0443\u0436\u0435\u043d \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u044c:<\/strong><\/p>\n<pre><code class=\"java\">public Task createTask(...) {    return Timer.builder(\"task.service.create\")            .tag(\"priority\", priority.name())            .register(meterRegistry)            .recordCallable(() -&gt; {                \/\/ \u043b\u043e\u0433\u0438\u043a\u0430                return savedTask;            });}<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p>Timed &#8212; \u0434\u043b\u044f \u043f\u0440\u043e\u0441\u0442\u044b\u0445 \u0441\u043b\u0443\u0447\u0430\u0435\u0432. \u041f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043d\u044b\u0439 &#8212; \u043a\u043e\u0433\u0434\u0430 \u043d\u0443\u0436\u043d\u044b \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0442\u0435\u0433\u0438. \u041e\u0431\u0430 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0430 \u0437\u0430\u043a\u043e\u043d\u043d\u044b. \u041d\u0435\u0437\u0430\u043a\u043e\u043d\u043d\u044b\u0439 &#8212; \u043d\u0435 \u0438\u0437\u043c\u0435\u0440\u044f\u0442\u044c \u0432\u043e\u043e\u0431\u0449\u0435.<\/p>\n<h4>\u0414\u0435\u043b\u043e \u043e \u043f\u044f\u0442\u0438 \u043f\u0440\u0438\u0437\u0440\u0430\u043a\u0430\u0445, \u0438\u043b\u0438 Event-driven \u043c\u0435\u0442\u0440\u0438\u043a\u0438<\/h4>\n<p>\u041e\u0431\u0435\u0449\u0430\u043d\u043d\u0430\u044f \u0438\u0441\u0442\u043e\u0440\u0438\u044f. \u0427\u0435\u0442\u0432\u0435\u0440\u0433, \u0432\u0442\u043e\u0440\u0430\u044f \u043f\u043e\u043b\u043e\u0432\u0438\u043d\u0430 \u0434\u043d\u044f. \u0414\u0430\u043d\u044f \u0432\u0440\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0441 \u0434\u0430\u0448\u0431\u043e\u0440\u0434\u043e\u043c \u043d\u0430\u043f\u0435\u0440\u0435\u0432\u0435\u0441, \u043a\u0430\u043a \u0441 \u043e\u0440\u0434\u0435\u0440\u043e\u043c:<\/p>\n<p>\u2014 \u0421\u043c\u043e\u0442\u0440\u0438! \u0421\u043e\u0437\u0434\u0430\u043d\u043e 4 512 \u0437\u0430\u0434\u0430\u0447. \u0410 \u0432 \u0431\u0430\u0437\u0435 4 507. \u041a\u0443\u0434\u0430 \u0434\u0435\u043b\u0438\u0441\u044c \u043f\u044f\u0442\u044c \u0437\u0430\u0434\u0430\u0447?! \u2014 \u041d\u0438\u043a\u0443\u0434\u0430 \u043d\u0435 \u0434\u0435\u043b\u0438\u0441\u044c, \u0414\u0430\u043d\u044f. \u2014 \u0422\u043e \u0435\u0441\u0442\u044c \u043a\u0430\u043a? \u2014 \u0418\u0445 \u043d\u0438\u043a\u043e\u0433\u0434\u0430 \u043d\u0435 \u0431\u044b\u043b\u043e. \u0422\u044b \u0438\u0449\u0435\u0448\u044c \u043f\u044f\u0442\u0435\u0440\u044b\u0445, \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043d\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043e\u0432\u0430\u043b\u043e.<\/p>\n<p>\u041f\u044f\u0442\u044c \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0439 \u043e\u0442\u043a\u0430\u0442\u0438\u043b\u0438\u0441\u044c. \u0412\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u044f, \u043a\u043e\u043d\u0444\u043b\u0438\u043a\u0442, \u0447\u044c\u044f-\u0442\u043e \u043d\u0435\u0440\u0432\u043d\u0430\u044f \u0440\u0435\u0442\u0440\u0430\u0439-\u043b\u043e\u0433\u0438\u043a\u0430. \u041c\u043e\u0442\u0438\u0432 \u043d\u0435\u0432\u0430\u0436\u0435\u043d, \u0432\u0430\u0436\u0435\u043d \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c: counter \u0438\u043d\u043a\u0440\u0435\u043c\u0435\u043d\u0442\u0438\u043b\u0441\u044f <strong>\u0434\u043e<\/strong> \u043a\u043e\u043c\u043c\u0438\u0442\u0430, \u0430 \u043e\u0442\u043a\u0430\u0442 \u0441\u0447\u0451\u0442\u0447\u0438\u043a \u043d\u0430\u0437\u0430\u0434 \u043d\u0435 \u043e\u0442\u043c\u0430\u0442\u044b\u0432\u0430\u0435\u0442. Counter \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u043e\u0442\u043c\u0430\u0442\u044b\u0432\u0430\u0435\u0442.<\/p>\n<p>\u041b\u0435\u043a\u0430\u0440\u0441\u0442\u0432\u043e: Spring Events \u043f\u043b\u044e\u0441 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u0430\u044f \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u044f. \u0411\u0438\u0437\u043d\u0435\u0441-\u043b\u043e\u0433\u0438\u043a\u0430 \u043f\u0443\u0431\u043b\u0438\u043a\u0443\u0435\u0442 \u0441\u043e\u0431\u044b\u0442\u0438\u0435, \u0441\u043b\u0443\u0448\u0430\u0442\u0435\u043b\u044c \u0432\u0435\u0434\u0451\u0442 \u0443\u0447\u0451\u0442 \u0438 \u0443\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0442\u043e, \u0447\u0442\u043e \u0440\u0435\u0430\u043b\u044c\u043d\u043e \u0437\u0430\u0444\u0438\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u043e \u0432 \u0431\u0430\u0437\u0435:<\/p>\n<pre><code class=\"java\">\/\/ \u0421\u043e\u0431\u044b\u0442\u0438\u044fpublic record TaskCreatedEvent(Task task) {}public record TaskCompletedEvent(Task task, Duration processingTime) {}public record TaskStatusChangedEvent(Task task, TaskStatus previousStatus, TaskStatus newStatus) {}\/\/ \u0421\u043b\u0443\u0448\u0430\u0442\u0435\u043b\u044c@Componentpublic class MetricsEventListener {    private final MeterRegistry meterRegistry;    public MetricsEventListener(MeterRegistry meterRegistry) {        this.meterRegistry = meterRegistry;    }    \/\/ \u041d\u0415 @EventListener, \u0430 @TransactionalEventListener(AFTER_COMMIT).    \/\/ \u0421\u043e\u0431\u044b\u0442\u0438\u0435 \u043f\u0443\u0431\u043b\u0438\u043a\u0443\u0435\u0442\u0441\u044f \u0432\u043d\u0443\u0442\u0440\u0438 @Transactional-\u043c\u0435\u0442\u043e\u0434\u0430 \u0441\u0435\u0440\u0432\u0438\u0441\u0430. \u041e\u0431\u044b\u0447\u043d\u044b\u0439    \/\/ @EventListener \u0441\u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043d\u0435\u043c\u0435\u0434\u043b\u0435\u043d\u043d\u043e - \u0438 \u043f\u0440\u0438 \u043e\u0442\u043a\u0430\u0442\u0435 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0438    \/\/ \u0441\u0447\u0451\u0442\u0447\u0438\u043a \u043e\u0441\u0442\u0430\u043d\u0435\u0442\u0441\u044f \u0443\u0432\u0435\u043b\u0438\u0447\u0435\u043d\u043d\u044b\u043c, \u0445\u043e\u0442\u044f \u0437\u0430\u0434\u0430\u0447\u0438 \u0432 \u0411\u0414 \u043d\u0435\u0442.    \/\/ AFTER_COMMIT \u0441\u0447\u0438\u0442\u0430\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0442\u043e, \u0447\u0442\u043e \u0440\u0435\u0430\u043b\u044c\u043d\u043e \u0437\u0430\u0444\u0438\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u043e.    \/\/ fallbackExecution = true - \u0447\u0442\u043e\u0431\u044b \u0441\u043b\u0443\u0448\u0430\u0442\u0435\u043b\u044c \u0440\u0430\u0431\u043e\u0442\u0430\u043b \u0438 \u0432\u043d\u0435 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0438.    @TransactionalEventListener(phase = TransactionPhase.AFTER_COMMIT,                                 fallbackExecution = true)    public void handleTaskCreated(TaskCreatedEvent event) {        meterRegistry.counter(\"events.tasks.created.by.priority\",                \"priority\", event.task().getPriority().name().toLowerCase()        ).increment();    }    @TransactionalEventListener(phase = TransactionPhase.AFTER_COMMIT,                                 fallbackExecution = true)    public void handleTaskCompleted(TaskCompletedEvent event) {        meterRegistry.timer(\"events.tasks.completed.duration\",                \"priority\", event.task().getPriority().name().toLowerCase()        ).record(event.processingTime());    }    @TransactionalEventListener(phase = TransactionPhase.AFTER_COMMIT,                                 fallbackExecution = true)    public void handleStatusChanged(TaskStatusChangedEvent event) {        meterRegistry.counter(\"events.tasks.status.changed\",                \"from\", event.previousStatus().name().toLowerCase(),                \"to\", event.newStatus().name().toLowerCase()        ).increment();    }}<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p><strong>\u041f\u043e\u0447\u0435\u043c\u0443 \u044d\u0442\u043e \u0445\u043e\u0440\u043e\u0448\u043e:<\/strong><\/p>\n<ul>\n<li>\n<p>Separation of Concerns: \u0441\u0435\u0440\u0432\u0438\u0441 \u0447\u0438\u0441\u0442.<\/p>\n<\/li>\n<li>\n<p>\u0422\u0435\u0441\u0442\u0438\u0440\u0443\u0435\u043c\u043e\u0441\u0442\u044c: \u043c\u043e\u043a\u0430\u0435\u0442\u0435 \u0438 \u0442\u0435\u0441\u0442\u0438\u0440\u0443\u0435\u0442\u0435 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e.<\/p>\n<\/li>\n<li>\n<p>\u0413\u0438\u0431\u043a\u043e\u0441\u0442\u044c: \u043d\u043e\u0432\u044b\u0439 \u0441\u043b\u0443\u0448\u0430\u0442\u0435\u043b\u044c? \u0414\u043e\u0431\u0430\u0432\u0438\u043b\u0438. \u0421\u0435\u0440\u0432\u0438\u0441 \u043d\u0435 \u0442\u0440\u043e\u0433\u0430\u043b\u0438.<\/p>\n<\/li>\n<li>\n<p>\u0422\u043e\u0447\u043d\u043e\u0441\u0442\u044c: AFTER_COMMIT \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442, \u0447\u0442\u043e \u043c\u0435\u0442\u0440\u0438\u043a\u0430 \u043d\u0435 \u0432\u0440\u0451\u0442 \u043f\u0440\u0438 \u043e\u0442\u043a\u0430\u0442\u0430\u0445. \u041f\u0440\u044f\u043c\u044b\u0435 \u0438\u043d\u043a\u0440\u0435\u043c\u0435\u043d\u0442\u044b \u0438\u0437 \u043f\u0440\u043e\u0448\u043b\u043e\u0433\u043e \u044d\u043f\u0438\u0437\u043e\u0434\u0430 \u044d\u0442\u0438\u043c \u043f\u043e\u0445\u0432\u0430\u0441\u0442\u0430\u0442\u044c\u0441\u044f \u043d\u0435 \u043c\u043e\u0433\u0443\u0442. \u041f\u0440\u043e\u0441\u0442\u043e\u0442\u0430 \u043f\u0440\u043e\u0442\u0438\u0432 \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u0438, \u0432\u044b\u0431\u0438\u0440\u0430\u0439\u0442\u0435 \u043f\u043e \u0434\u0435\u043b\u0443.<\/p>\n<\/li>\n<\/ul>\n<hr\/>\n<h3>\u042d\u043f\u0438\u0437\u043e\u0434 8. \u0413\u0440\u0435\u0439\u0441: \u0434\u043e\u0441\u043a\u0430 \u0441 \u0444\u043e\u0442\u043e\u0433\u0440\u0430\u0444\u0438\u044f\u043c\u0438 \u0438 \u043a\u0440\u0430\u0441\u043d\u044b\u043c\u0438 \u043d\u0438\u0442\u043a\u0430\u043c\u0438<\/h3>\n<p>\u0421\u043e\u0431\u0440\u0430\u0442\u044c \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u0438\u044f &#8212; \u043f\u043e\u043b\u0434\u0435\u043b\u0430. \u0412 \u043a\u0430\u0436\u0434\u043e\u043c \u043f\u0440\u0438\u043b\u0438\u0447\u043d\u043e\u043c \u0434\u0435\u0442\u0435\u043a\u0442\u0438\u0432\u0435 \u0435\u0441\u0442\u044c \u0441\u0442\u0435\u043d\u0430: \u0444\u043e\u0442\u043e\u0433\u0440\u0430\u0444\u0438\u0438, \u043a\u0430\u0440\u0442\u0430 \u0433\u043e\u0440\u043e\u0434\u0430, \u043a\u0440\u0430\u0441\u043d\u044b\u0435 \u043d\u0438\u0442\u043a\u0438 \u043c\u0435\u0436\u0434\u0443 \u043a\u043d\u043e\u043f\u043a\u0430\u043c\u0438. \u0423 \u043d\u0430\u0441 \u044d\u0442\u0443 \u0441\u0442\u0435\u043d\u0443 \u0440\u0438\u0441\u0443\u0435\u0442 \u0413\u0440\u0435\u0439\u0441. Grafana. \u041e\u043d\u0430 \u0431\u0435\u0440\u0451\u0442 \u0441\u0443\u0445\u0438\u0435 \u0446\u0438\u0444\u0440\u044b \u0430\u0440\u0445\u0438\u0432\u0430\u0440\u0438\u0443\u0441\u0430 \u0438 \u0434\u0435\u043b\u0430\u0435\u0442 \u0438\u0437 \u043d\u0438\u0445 \u043a\u0430\u0440\u0442\u0438\u043d\u0443, \u043f\u043e \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0437\u0430 \u0442\u0440\u0438 \u0441\u0435\u043a\u0443\u043d\u0434\u044b \u0432\u0438\u0434\u043d\u043e, \u0433\u043e\u0440\u0438\u043c \u0438\u043b\u0438 \u043d\u0435 \u0433\u043e\u0440\u0438\u043c.<\/p>\n<p>\u0414\u0430\u0448\u0431\u043e\u0440\u0434 &#8212; \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442, \u043d\u0435 \u0443\u043a\u0440\u0430\u0448\u0435\u043d\u0438\u0435. \u041a\u0430\u0436\u0434\u0430\u044f \u043f\u0430\u043d\u0435\u043b\u044c \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442 \u043d\u0430 \u0432\u043e\u043f\u0440\u043e\u0441. \u041d\u0435 \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442 &#8212; \u0441\u043d\u0438\u043c\u0438\u0442\u0435 \u0441\u043e \u0441\u0442\u0435\u043d\u044b. \u0414\u0430, \u0438 \u0442\u0443 \u043a\u0440\u0430\u0441\u0438\u0432\u0443\u044e \u0442\u043e\u0436\u0435. \u041e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u0442\u0443 \u043a\u0440\u0430\u0441\u0438\u0432\u0443\u044e.<\/p>\n<h4>\u0413\u043e\u0442\u043e\u0432\u044b\u0435 \u0434\u0430\u0448\u0431\u043e\u0440\u0434\u044b<\/h4>\n<p>\u041d\u0435 \u0438\u0437\u043e\u0431\u0440\u0435\u0442\u0430\u0439\u0442\u0435 \u0432\u0435\u043b\u043e\u0441\u0438\u043f\u0435\u0434. \u0412\u0435\u043b\u043e\u0441\u0438\u043f\u0435\u0434 \u0443\u0436\u0435 \u0438\u0437\u043e\u0431\u0440\u0435\u0442\u0451\u043d, \u0443 \u043d\u0435\u0433\u043e \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u044f \u0438 \u0441\u043e\u043e\u0431\u0449\u0435\u0441\u0442\u0432\u043e.<\/p>\n<ol>\n<li>\n<p>Grafana \u2192 Dashboards \u2192 Import<\/p>\n<\/li>\n<li>\n<p>ID: <strong>4701<\/strong> (JVM Micrometer)<\/p>\n<\/li>\n<li>\n<p>\u0412\u044b\u0431\u0440\u0430\u0442\u044c Prometheus datasource<\/p>\n<\/li>\n<li>\n<p>Import<\/p>\n<\/li>\n<\/ol>\n<p>\u0413\u043e\u0442\u043e\u0432\u043e. JVM-\u043c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u043d\u0433 \u0438\u0437 \u043a\u043e\u0440\u043e\u0431\u043a\u0438. \u0415\u0449\u0451:<\/p>\n<ul>\n<li>\n<p><strong>11378<\/strong> &#8212; Spring Boot Statistics<\/p>\n<\/li>\n<li>\n<p><strong>6417<\/strong> &#8212; Kubernetes Cluster<\/p>\n<\/li>\n<\/ul>\n<h4>\u0421\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u0439 \u0434\u043e\u0441\u043a\u0438<\/h4>\n<p>\u041d\u0430\u0448\u0430 \u0441\u0442\u0435\u043d\u0430 \u0443\u0441\u0442\u0430\u043a\u0430\u043d\u0438\u043b\u0430\u0441\u044c \u0432 \u0448\u0435\u0441\u0442\u044c \u0440\u044f\u0434\u043e\u0432. \u0421\u0432\u0435\u0440\u0445\u0443 \u0432\u043d\u0438\u0437, \u043e\u0442 \u00ab\u0433\u043e\u0440\u0438\u043c \u0438\u043b\u0438 \u043d\u0435\u0442\u00bb \u043a \u0434\u0435\u0442\u0430\u043b\u044f\u043c:<\/p>\n<p><strong>Row 1: Overview<\/strong> &#8212; \u043f\u0435\u0440\u0432\u044b\u0439 \u0432\u0437\u0433\u043b\u044f\u0434. \u0422\u0440\u0438 \u0441\u0435\u043a\u0443\u043d\u0434\u044b, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043d\u044f\u0442\u044c, \u0432\u0441\u0451 \u043b\u0438 \u0432 \u043f\u043e\u0440\u044f\u0434\u043a\u0435.<\/p>\n<ul>\n<li>\n<p>RPS (Stat panel)<\/p>\n<\/li>\n<li>\n<p>Error Rate % (Stat panel)<\/p>\n<\/li>\n<li>\n<p>p99 Latency (Stat panel)<\/p>\n<\/li>\n<li>\n<p>Active Tasks (Stat panel)<\/p>\n<\/li>\n<\/ul>\n<p><strong>Row 2: JVM Health<\/strong> &#8212; \u0437\u0434\u043e\u0440\u043e\u0432\u044c\u0435 \u043c\u0430\u0448\u0438\u043d\u044b.<\/p>\n<ul>\n<li>\n<p>Heap Memory (Time series)<\/p>\n<\/li>\n<li>\n<p>Threads (Time series)<\/p>\n<\/li>\n<li>\n<p>GC Pauses (Time series)<\/p>\n<\/li>\n<\/ul>\n<p><strong>Row 3: HTTP Details<\/strong> &#8212; \u0447\u0442\u043e \u0432\u0438\u0434\u0438\u0442 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c.<\/p>\n<ul>\n<li>\n<p>Latency Percentiles (Time series)<\/p>\n<\/li>\n<li>\n<p>Request Rate by Endpoint (Time series)<\/p>\n<\/li>\n<\/ul>\n<p><strong>Row 4: Database<\/strong> &#8212; \u0447\u0442\u043e \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043f\u043e\u0434 \u043a\u0430\u043f\u043e\u0442\u043e\u043c.<\/p>\n<ul>\n<li>\n<p>Connection Pool (Time series)<\/p>\n<\/li>\n<li>\n<p>Repository Duration (Time series)<\/p>\n<\/li>\n<\/ul>\n<p><strong>Row 5: Business<\/strong> &#8212; \u0447\u0442\u043e \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0443\u0435\u0442 \u043c\u044d\u0440\u0438\u044e.<\/p>\n<ul>\n<li>\n<p>Tasks Created\/Completed (Time series)<\/p>\n<\/li>\n<li>\n<p>Tasks by Priority (Bar chart)<\/p>\n<\/li>\n<\/ul>\n<p><strong>Row 6: SLO \/ Error Budget<\/strong> &#8212; \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u043c \u043b\u0438 \u043c\u044b \u043e\u0431\u0435\u0449\u0430\u043d\u0438\u044f (\u043f\u0440\u043e SLO \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u044d\u043f\u0438\u0437\u043e\u0434, \u043f\u043e\u0442\u0435\u0440\u043f\u0438\u0442\u0435).<\/p>\n<ul>\n<li>\n<p>Availability, Error Budget Remaining, Burn Rate<\/p>\n<\/li>\n<\/ul>\n<p>\u0412\u0430\u0436\u043d\u0430\u044f \u0443\u043b\u0438\u043a\u0430, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043c\u044b \u0441\u0430\u043c\u0438 \u0441\u043f\u043e\u0442\u043a\u043d\u0443\u043b\u0438\u0441\u044c: \u043f\u0430\u043d\u0435\u043b\u0438 Overview \u0434\u043e\u043b\u0436\u043d\u044b \u0438\u0441\u043a\u043b\u044e\u0447\u0430\u0442\u044c actuator-\u0442\u0440\u0430\u0444\u0438\u043a (<code>uri!~\"\/actuator.*\"<\/code>), \u043a\u0430\u043a \u0438 \u043f\u0430\u043d\u0435\u043b\u0438 \u043b\u0430\u0442\u0435\u043d\u0442\u043d\u043e\u0441\u0442\u0438. \u0418\u043d\u0430\u0447\u0435 Prometheus, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u043a\u0440\u0435\u0439\u043f\u0438\u0442 \u043c\u0435\u0442\u0440\u0438\u043a\u0438 \u043a\u0430\u0436\u0434\u044b\u0435 5 \u0441\u0435\u043a\u0443\u043d\u0434, \u0441\u0432\u043e\u0438\u043c\u0438 \u0431\u044b\u0441\u0442\u0440\u044b\u043c\u0438 \u0434\u0432\u0443\u0445\u0441\u043e\u0442\u043a\u0430\u043c\u0438 \u043f\u0440\u0438\u0443\u043a\u0440\u0430\u0448\u0438\u0432\u0430\u0435\u0442 \u0432\u0430\u043c \u0438 RPS, \u0438 error rate. \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f \u0442\u043e\u043f\u0442\u0443\u043d, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u043b\u0435\u0434\u0438\u0442 \u0441\u0430\u043c \u0437\u0430 \u0441\u043e\u0431\u043e\u0439 \u0438 \u043f\u0438\u0448\u0435\u0442 \u0432 \u043e\u0442\u0447\u0451\u0442\u0435, \u0447\u0442\u043e \u043e\u0431\u044a\u0435\u043a\u0442 \u0432\u0451\u043b \u0441\u0435\u0431\u044f \u043e\u0431\u0440\u0430\u0437\u0446\u043e\u0432\u043e.<\/p>\n<h4>Variables: \u043e\u0434\u043d\u0430 \u0434\u043e\u0441\u043a\u0430 \u043d\u0430 \u0432\u0441\u0435 \u0440\u0430\u0439\u043e\u043d\u044b<\/h4>\n<pre><code class=\"json\">{  \"templating\": {    \"list\": [      {        \"name\": \"application\",        \"type\": \"query\",        \"query\": \"label_values(jvm_memory_used_bytes, application)\",        \"refresh\": 1      },      {        \"name\": \"instance\",        \"type\": \"query\",         \"query\": \"label_values(jvm_memory_used_bytes{application=\\\"$application\\\"}, instance)\",        \"refresh\": 1      }    ]  }}<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p>\u041e\u0434\u0438\u043d \u0434\u0430\u0448\u0431\u043e\u0440\u0434. \u0412\u0441\u0435 \u0441\u0435\u0440\u0432\u0438\u0441\u044b. \u041f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0435\u0441\u044c \u0447\u0435\u0440\u0435\u0437 \u0432\u044b\u043f\u0430\u0434\u0430\u044e\u0449\u0438\u0439 \u0441\u043f\u0438\u0441\u043e\u043a.<\/p>\n<h4>Grafana Provisioning: \u0434\u043e\u0441\u043a\u0430 \u0432 Git<\/h4>\n<p>\u0414\u0430\u0448\u0431\u043e\u0440\u0434\u044b \u0432 Git &#8212; \u044d\u0442\u043e \u043a\u0443\u043b\u044c\u0442\u0443\u0440\u0430. \u041d\u0435 \u0432 \u0433\u043e\u043b\u043e\u0432\u0430\u0445, \u043d\u0435 \u0432 \u0437\u0430\u043a\u043b\u0430\u0434\u043a\u0430\u0445, \u043d\u0435 \u00ab\u0443 \u0412\u0430\u0441\u0438 \u0441\u043f\u0440\u043e\u0441\u0438, \u043e\u043d \u0434\u0435\u043b\u0430\u043b\u00bb. \u0412\u0430\u0441\u044f \u0443\u0432\u043e\u043b\u0438\u0442\u0441\u044f. Git \u043d\u0435 \u0443\u0432\u043e\u043b\u0438\u0442\u0441\u044f.<\/p>\n<p><strong>grafana\/datasources.yml:<\/strong><\/p>\n<pre><code class=\"yaml\">apiVersion: 1datasources:  - name: Prometheus    type: prometheus    access: proxy    url: http:\/\/prometheus:9090    isDefault: true    editable: true   # \u0432 \u0434\u0435\u043c\u043e \u0443\u0434\u043e\u0431\u043d\u043e; \u0432 production - false, \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a \u043f\u0440\u0430\u0432\u0434\u044b \u0432 Git    jsonData:      # \u0414\u043e\u043b\u0436\u0435\u043d \u0441\u043e\u0432\u043f\u0430\u0434\u0430\u0442\u044c \u0441\u043e scrape_interval \u0432\u0430\u0448\u0435\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f.      # \u041f\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u0435 \u0431\u043e\u043b\u044c\u0448\u0435 - Grafana \u0431\u0443\u0434\u0435\u0442 \u0440\u0438\u0441\u043e\u0432\u0430\u0442\u044c \u0433\u0440\u0443\u0431\u0435\u0435, \u0447\u0435\u043c \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u0442\u0435.      timeInterval: \"5s\"      httpMethod: \"POST\"<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p><strong>grafana\/dashboards\/dashboard.yml:<\/strong><\/p>\n<pre><code class=\"yaml\">apiVersion: 1providers:  - name: 'TODO App Dashboards'    orgId: 1    folder: 'TODO App'    folderUid: 'todo-app'    type: file    disableDeletion: false    updateIntervalSeconds: 30    allowUiUpdates: true    options:      path: \/etc\/grafana\/provisioning\/dashboards<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p><strong>\u042d\u043a\u0441\u043f\u043e\u0440\u0442:<\/strong><\/p>\n<pre><code class=\"bash\">curl -s -H \"Authorization: Bearer $API_KEY\" \\  \"http:\/\/localhost:3000\/api\/dashboards\/uid\/$UID\" \\  | jq '.dashboard' &gt; dashboard.json<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<hr\/>\n<h3>\u042d\u043f\u0438\u0437\u043e\u0434 9. \u041a\u043e\u043c\u043c\u0443\u0442\u0430\u0442\u043e\u0440: \u0434\u0435\u043b\u043e \u043e \u0434\u0432\u0430\u0434\u0446\u0430\u0442\u0438 \u0434\u0432\u0443\u0445 \u0437\u0432\u043e\u043d\u043a\u0430\u0445<\/h3>\n<p>\u0414\u043e\u0441\u043a\u0430 &#8212; \u0445\u043e\u0440\u043e\u0448\u043e. \u041d\u043e \u0434\u0435\u0442\u0435\u043a\u0442\u0438\u0432 \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043d\u0430 \u0434\u043e\u0441\u043a\u0443 \u043a\u0440\u0443\u0433\u043b\u044b\u0435 \u0441\u0443\u0442\u043a\u0438. \u0423 \u0434\u0435\u0442\u0435\u043a\u0442\u0438\u0432\u0430 \u0435\u0441\u0442\u044c \u0436\u0438\u0437\u043d\u044c. \u041f\u043e \u043a\u0440\u0430\u0439\u043d\u0435\u0439 \u043c\u0435\u0440\u0435, \u0442\u0430\u043a \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043e \u0432 \u0435\u0433\u043e \u0442\u0440\u0443\u0434\u043e\u0432\u043e\u043c \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0435. \u0414\u043b\u044f \u0432\u0441\u0435\u0433\u043e \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u0434\u0438\u0441\u043f\u0435\u0442\u0447\u0435\u0440 \u043d\u0430 \u043a\u043e\u043c\u043c\u0443\u0442\u0430\u0442\u043e\u0440\u0435 &#8212; Alertmanager. \u041e\u043d \u0437\u0432\u043e\u043d\u0438\u0442, \u043a\u043e\u0433\u0434\u0430 \u0432 \u0433\u043e\u0440\u043e\u0434\u0435 \u0431\u0435\u0434\u0430. \u0412\u043e\u0432\u0440\u0435\u043c\u044f.<\/p>\n<p>\u0412 \u043d\u043e\u0447\u044c \u043d\u0430 \u0432\u0442\u043e\u0440\u043d\u0438\u043a \u0441\u043b\u0443\u0447\u0438\u043b\u0441\u044f \u043e\u0431\u0440\u044f\u0434 \u043f\u043e\u0441\u0432\u044f\u0449\u0435\u043d\u0438\u044f. \u0422\u0435\u0441\u0442\u043e\u0432\u044b\u0439 \u0441\u0442\u0435\u043d\u0434 \u043f\u0440\u0438\u043b\u0451\u0433 \u043d\u0430 \u0434\u0432\u0430\u0434\u0446\u0430\u0442\u044c \u043c\u0438\u043d\u0443\u0442, \u0438 \u043a\u0430\u043f\u0438\u0442\u0430\u043d\u0443 \u041b\u0451\u0448\u0435 \u043f\u043e\u0437\u0432\u043e\u043d\u0438\u043b\u0438 <strong>\u0434\u0432\u0430\u0434\u0446\u0430\u0442\u044c \u0434\u0432\u0430 \u0440\u0430\u0437\u0430<\/strong>. \u041f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0443\u043f\u0430\u043b\u043e &#8212; \u0437\u0432\u043e\u043d\u043e\u043a. \u0412\u0441\u043b\u0435\u0434 \u0437\u0430 \u043d\u0438\u043c heap &#8212; \u0437\u0432\u043e\u043d\u043e\u043a. \u041b\u0430\u0442\u0435\u043d\u0442\u043d\u043e\u0441\u0442\u044c &#8212; \u0437\u0432\u043e\u043d\u043e\u043a. \u041f\u0443\u043b \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0439 &#8212; \u0437\u0432\u043e\u043d\u043e\u043a. Error rate &#8212; \u0434\u0432\u0430 \u0437\u0432\u043e\u043d\u043a\u0430, warning \u0438 critical, \u0447\u0442\u043e\u0431\u044b \u043d\u0430\u0432\u0435\u0440\u043d\u044f\u043a\u0430. \u0418 \u0432\u0441\u0451 \u044d\u0442\u043e \u043a\u0430\u0436\u0434\u044b\u0435 \u043f\u044f\u0442\u044c \u043c\u0438\u043d\u0443\u0442 \u043f\u043e \u043a\u0440\u0443\u0433\u0443.<\/p>\n<p>\u0423\u0442\u0440\u043e\u043c \u041b\u0451\u0448\u0430 \u0432\u043e\u0448\u0451\u043b \u0432 \u0443\u0447\u0430\u0441\u0442\u043e\u043a \u043f\u043e\u0445\u043e\u0434\u043a\u043e\u0439 \u0447\u0435\u043b\u043e\u0432\u0435\u043a\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0437\u0430 \u043d\u043e\u0447\u044c \u0434\u0432\u0430\u0434\u0446\u0430\u0442\u044c \u0434\u0432\u0430 \u0440\u0430\u0437\u0430 \u0443\u0437\u043d\u0430\u043b \u043e\u0434\u043d\u0443 \u0438 \u0442\u0443 \u0436\u0435 \u043d\u043e\u0432\u043e\u0441\u0442\u044c:<\/p>\n<p>\u2014 \u042f \u043f\u043e\u043d\u044f\u043b \u0434\u0432\u0435 \u0432\u0435\u0449\u0438. \u041f\u0435\u0440\u0432\u0430\u044f: \u0441\u0438\u0433\u043d\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442. \u0412\u0442\u043e\u0440\u0430\u044f: \u0442\u0430\u043a \u0436\u0438\u0442\u044c \u043d\u0435\u043b\u044c\u0437\u044f.<\/p>\n<p>\u0422\u0430\u043a \u043c\u044b \u043f\u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u043b\u0438\u0441\u044c \u0441 routing, silencing \u0438 inhibition. \u041d\u043e \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u0441\u0430\u043c\u0438 \u043e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u043a\u0438.<\/p>\n<h4>Alert Rules<\/h4>\n<pre><code class=\"yaml\"># prometheus\/alert-rules.ymlgroups:  - name: jvm_alerts    rules:      # \u0421\u0443\u043c\u043c\u0438\u0440\u0443\u0435\u043c \u043f\u043e \u043f\u0443\u043b\u0430\u043c! \u0411\u0435\u0437 sum \u0430\u043b\u0435\u0440\u0442 \u0441\u0440\u0430\u0432\u043d\u0438\u0432\u0430\u0435\u0442 \u043a\u0430\u0436\u0434\u044b\u0439 \u043f\u0443\u043b \u0441 \u0435\u0433\u043e      # \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u043c \u043c\u0430\u043a\u0441\u0438\u043c\u0443\u043c\u043e\u043c, \u0430 Eden \u043f\u0435\u0440\u0435\u0434 \u0441\u0431\u043e\u0440\u043a\u043e\u0439 \u0432\u0441\u0435\u0433\u0434\u0430 \u043f\u043e\u0447\u0442\u0438 \u043f\u043e\u043b\u043e\u043d.      # \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0441\u0442\u0438 - \u0432 \u044d\u043f\u0438\u0437\u043e\u0434\u0435 \u043f\u0440\u043e JVM.      - alert: HighHeapUsage        expr: |          sum by (application, instance) (jvm_memory_used_bytes{area=\"heap\"})          \/          sum by (application, instance) (jvm_memory_max_bytes{area=\"heap\"} != -1) &gt; 0.8        for: 5m        labels:          severity: warning        annotations:          summary: \"High JVM Heap Usage ({{ $labels.instance }})\"          description: \"Heap &gt; 80% for 5 minutes (current: {{ $value | humanizePercentage }})\"          runbook_url: \"https:\/\/wiki.example.com\/runbooks\/jvm-heap\"      - alert: CriticalHeapUsage        expr: |          sum by (application, instance) (jvm_memory_used_bytes{area=\"heap\"})          \/          sum by (application, instance) (jvm_memory_max_bytes{area=\"heap\"} != -1) &gt; 0.95        for: 2m        labels:          severity: critical        annotations:          summary: \"Critical JVM Heap Usage\"          description: \"Heap &gt; 95% - OOM imminent!\"  - name: http_alerts    rules:      # \u0418\u0441\u043a\u043b\u044e\u0447\u0430\u0435\u043c \/actuator: Prometheus \u0441\u0430\u043c \u0441\u043a\u0440\u0435\u0439\u043f\u0438\u0442 \u043c\u0435\u0442\u0440\u0438\u043a\u0438 \u043a\u0430\u0436\u0434\u044b\u0435 5 \u0441\u0435\u043a\u0443\u043d\u0434,      # \u0438 \u044d\u0442\u043e\u0442 \u043f\u043e\u0442\u043e\u043a \u0431\u044b\u0441\u0442\u0440\u044b\u0445 \u0443\u0441\u043f\u0435\u0448\u043d\u044b\u0445 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u0440\u0430\u0437\u0431\u0430\u0432\u043b\u044f\u0435\u0442 \u0434\u043e\u043b\u044e \u043e\u0448\u0438\u0431\u043e\u043a.      - alert: HighErrorRate        expr: |          sum(rate(http_server_requests_seconds_count{status=~\"5..\", uri!~\"\/actuator.*\"}[5m]))           \/ sum(rate(http_server_requests_seconds_count{uri!~\"\/actuator.*\"}[5m])) &gt; 0.05        for: 5m        labels:          severity: warning        annotations:          summary: \"Error rate above 5%\"      - alert: HighLatencyP99        expr: |          histogram_quantile(0.99,             sum(rate(http_server_requests_seconds_bucket{uri!~\"\/actuator.*\"}[5m])) by (le)) &gt; 2        for: 5m        labels:          severity: warning        annotations:          summary: \"p99 latency above 2s\"      # \u0410\u043b\u0435\u0440\u0442 \"\u0442\u0440\u0430\u0444\u0438\u043a\u0430 \u043d\u0435\u0442 \u0441\u043e\u0432\u0441\u0435\u043c\" - \u043f\u043e\u043c\u043d\u0438\u0442\u0435 \u0434\u0435\u043b\u043e \u043e \u043c\u043e\u043b\u0447\u0430\u043d\u0438\u0438 \u0438\u0437 \u044d\u043f\u0438\u0437\u043e\u0434\u0430      # \u043f\u0440\u043e PromQL? \u0412\u043e\u0442 \u0433\u0434\u0435 \u043e\u043d\u043e \u0441\u0442\u0440\u0435\u043b\u044f\u0435\u0442. \u0411\u0435\u0437 \"or vector(0)\" \u044d\u0442\u043e\u0442 \u0430\u043b\u0435\u0440\u0442      # \u043c\u043e\u043b\u0447\u0430\u043b \u0431\u044b \u0438\u043c\u0435\u043d\u043d\u043e \u0442\u043e\u0433\u0434\u0430, \u043a\u043e\u0433\u0434\u0430 \u0441\u0435\u0440\u0438\u0439 \u043d\u0435\u0442 \u0432\u043e\u043e\u0431\u0449\u0435.      - alert: NoRequests        expr: |          (sum(rate(http_server_requests_seconds_count{uri!~\"\/actuator.*\"}[5m])) or vector(0)) == 0        for: 5m        labels:          severity: critical        annotations:          summary: \"No HTTP requests received\"  - name: database_alerts    rules:      - alert: ConnectionPoolExhausted        expr: hikaricp_connections_pending &gt; 0        for: 2m        labels:          severity: warning        annotations:          summary: \"Connection pool has pending requests\"  - name: application_alerts    rules:      - alert: ApplicationDown        expr: up{job=\"todo-app\"} == 0        for: 1m        labels:          severity: critical        annotations:          summary: \"Application is down\"<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<h4>\u041a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044f Alertmanager<\/h4>\n<pre><code class=\"yaml\"># prometheus\/alertmanager.ymlglobal:  resolve_timeout: 5mroute:  group_by: ['alertname', 'severity']  group_wait: 30s  group_interval: 5m  repeat_interval: 4h  receiver: 'default-receiver'    routes:    - match:        severity: critical      receiver: 'critical-receiver'      group_wait: 10s      repeat_interval: 1h    - match:        severity: warning      receiver: 'warning-receiver'receivers:  - name: 'default-receiver'    email_configs:      - to: 'team@example.com'        send_resolved: true  - name: 'critical-receiver'    slack_configs:      - api_url: 'https:\/\/hooks.slack.com\/services\/...'        channel: '#alerts-critical'        title: '\ud83d\udea8 {{ .Status | toUpper }}: {{ .CommonAnnotations.summary }}'        text: |          {{ range .Alerts }}          *Alert:* {{ .Labels.alertname }}          *Severity:* {{ .Labels.severity }}          *Description:* {{ .Annotations.description }}          {{ end }}        send_resolved: true        pagerduty_configs:      - service_key: 'your-pagerduty-key'        send_resolved: true  - name: 'warning-receiver'    slack_configs:      - api_url: 'https:\/\/hooks.slack.com\/services\/...'        channel: '#alerts-warning'        send_resolved: true<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<h4>Silencing: \u0442\u0438\u0448\u0438\u043d\u0430 \u043f\u043e \u043e\u0440\u0434\u0435\u0440\u0443<\/h4>\n<p>\u041f\u043b\u0430\u043d\u043e\u0432\u044b\u0435 \u0440\u0430\u0431\u043e\u0442\u044b? \u0412\u044b\u043f\u0438\u0448\u0438\u0442\u0435 \u0442\u0438\u0448\u0438\u043d\u0435 \u043e\u0440\u0434\u0435\u0440.<\/p>\n<pre><code class=\"bash\">curl -X POST http:\/\/localhost:9093\/api\/v2\/silences \\  -H \"Content-Type: application\/json\" \\  -d '{    \"matchers\": [      {\"name\": \"alertname\", \"value\": \"HighHeapUsage\", \"isRegex\": false},      {\"name\": \"instance\", \"value\": \"app:8080\", \"isRegex\": false}    ],    \"startsAt\": \"2024-01-15T10:00:00Z\",    \"endsAt\": \"2024-01-15T12:00:00Z\",    \"createdBy\": \"admin\",    \"comment\": \"\u041f\u043b\u0430\u043d\u043e\u0432\u043e\u0435 \u043e\u0431\u0441\u043b\u0443\u0436\u0438\u0432\u0430\u043d\u0438\u0435\"  }'<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p>\u0418\u043b\u0438 \u0447\u0435\u0440\u0435\u0437 UI: <a href=\"http:\/\/localhost:9093\/#\/silences\" rel=\"noopener noreferrer nofollow\">http:\/\/localhost:9093\/#\/silences<\/a><\/p>\n<h4>Inhibition: \u0433\u043b\u0443\u0448\u0438\u043c \u044d\u0445\u043e<\/h4>\n<p>\u0412\u0435\u0440\u043d\u0451\u043c\u0441\u044f \u043a \u0434\u0432\u0430\u0434\u0446\u0430\u0442\u0438 \u0434\u0432\u0443\u043c \u0437\u0432\u043e\u043d\u043a\u0430\u043c. \u041f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0443\u043f\u0430\u043b\u043e &#8212; \u044d\u0442\u043e <strong>\u043e\u0434\u043d\u0430<\/strong> \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430. \u041d\u043e \u0432\u0441\u043b\u0435\u0434 \u0437\u0430 \u043d\u0435\u0439 \u0433\u043e\u043b\u043e\u0441\u0438\u0442 \u0432\u0441\u0451, \u0447\u0442\u043e \u043e\u0442 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0437\u0430\u0432\u0438\u0441\u0438\u0442. \u0417\u0430 \u043e\u0434\u043d\u043e \u043f\u0440\u0435\u0441\u0442\u0443\u043f\u043b\u0435\u043d\u0438\u0435 \u0434\u0432\u0430\u0434\u0446\u0430\u0442\u044c \u0432\u044b\u0437\u043e\u0432\u043e\u0432 \u043d\u0430 \u043c\u0435\u0441\u0442\u043e.<\/p>\n<p>Inhibition \u043f\u043e\u0434\u0430\u0432\u043b\u044f\u0435\u0442 \u043b\u0438\u0448\u043d\u0435\u0435:<\/p>\n<pre><code class=\"yaml\">inhibit_rules:  # \u041a\u0440\u0438\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 heap \u043f\u043e\u0434\u0430\u0432\u043b\u044f\u0435\u0442 \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 \u043e heap  - source_match:      alertname: CriticalHeapUsage    target_match:      alertname: HighHeapUsage    equal: ['instance']  # \u041a\u0440\u0438\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 error rate \u043f\u043e\u0434\u0430\u0432\u043b\u044f\u0435\u0442 warning \u043f\u043e error rate  - source_match:      alertname: CriticalErrorRate    target_match:      alertname: HighErrorRate    equal: ['application']    # \u0415\u0441\u043b\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 down - \u043c\u043e\u043b\u0447\u0438\u043c \u043e\u0431\u043e \u0432\u0441\u0451\u043c \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u043e\u043c  - source_match:      alertname: ApplicationDown    target_match_re:      alertname: (HighHeapUsage|HighErrorRate|HighLatency.*)    equal: ['instance']  # \u0415\u0441\u043b\u0438 \u0431\u0430\u0437\u0430 \u043d\u0435\u0434\u043e\u0441\u0442\u0443\u043f\u043d\u0430 - \u043d\u0435 \u0440\u0443\u0433\u0430\u0435\u043c\u0441\u044f \u043d\u0430 \u043f\u0443\u043b  - source_match:      alertname: DatabaseDown    target_match:      alertname: ConnectionPoolExhausted    equal: ['instance']<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p>\u0410 \u0442\u0435\u043f\u0435\u0440\u044c \u0442\u043e\u043d\u043a\u043e\u0441\u0442\u044c, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043b\u043e\u0432\u044f\u0442\u0441\u044f \u0434\u0430\u0436\u0435 \u0432\u0435\u0442\u0435\u0440\u0430\u043d\u044b. \u041c\u044b \u043f\u043e\u043f\u0430\u043b\u0438\u0441\u044c \u043b\u0438\u0447\u043d\u043e: \u044f \u043d\u0430\u043f\u0438\u0441\u0430\u043b \u00ab\u0443\u043d\u0438\u0432\u0435\u0440\u0441\u0430\u043b\u044c\u043d\u043e\u0435\u00bb \u043f\u0440\u0430\u0432\u0438\u043b\u043e \u00abcritical \u043f\u043e\u0434\u0430\u0432\u043b\u044f\u0435\u0442 warning\u00bb, <code>equal: ['alertname']<\/code>. \u041a\u0440\u0430\u0441\u0438\u0432\u043e. \u041b\u0430\u043a\u043e\u043d\u0438\u0447\u043d\u043e. <strong>\u041d\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442.<\/strong> \u041f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e <code>equal<\/code> \u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u0442\u043e\u0447\u043d\u043e\u0433\u043e \u0441\u043e\u0432\u043f\u0430\u0434\u0435\u043d\u0438\u044f alertname, \u0430 \u043f\u0430\u0440\u044b \u043d\u0430\u0437\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u043f\u043e-\u0440\u0430\u0437\u043d\u043e\u043c\u0443: <code>CriticalHeapUsage<\/code> \u0438 <code>HighHeapUsage<\/code> &#8212; \u0434\u0432\u0430 \u0440\u0430\u0437\u043d\u044b\u0445 \u0438\u043c\u0435\u043d\u0438. \u0423\u043d\u0438\u0432\u0435\u0440\u0441\u0430\u043b\u044c\u043d\u043e\u0435 \u043f\u0440\u0430\u0432\u0438\u043b\u043e \u043c\u043e\u043b\u0447\u0430 \u043d\u0435 \u043f\u043e\u0434\u0430\u0432\u0438\u043b\u043e \u043d\u0438\u0447\u0435\u0433\u043e, \u0438 \u041b\u0451\u0448\u0435 \u043f\u043e\u0437\u0432\u043e\u043d\u0438\u043b\u0438 \u043e\u0431\u0430. \u0421\u043d\u043e\u0432\u0430. \u041e\u043d \u043f\u0440\u0438\u043d\u044f\u043b \u044d\u0442\u043e \u043a\u0430\u043a \u043c\u0443\u0436\u0447\u0438\u043d\u0430: \u043c\u043e\u043b\u0447\u0430 \u043f\u043e\u043a\u0430\u0437\u0430\u043b \u043c\u043d\u0435 \u0441\u0447\u0451\u0442\u0447\u0438\u043a \u043f\u0440\u043e\u043f\u0443\u0449\u0435\u043d\u043d\u044b\u0445.<\/p>\n<p>\u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u0430\u0440\u044b \u0437\u0430\u0434\u0430\u0451\u043c \u044f\u0432\u043d\u043e. \u0421\u043a\u0443\u0447\u043d\u043e? \u0421\u043a\u0443\u0447\u043d\u043e. \u0417\u0430\u0442\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442.<\/p>\n<p>\u041e\u0434\u043d\u0430 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 &#8212; \u043e\u0434\u0438\u043d \u0437\u0432\u043e\u043d\u043e\u043a. \u0412\u0441\u0451 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u043e\u0435 \u043f\u043e\u0434\u0430\u0432\u043b\u0435\u043d\u043e. \u0422\u0438\u0448\u0438\u043d\u0430 \u0438 \u043f\u043e\u0440\u044f\u0434\u043e\u043a.<\/p>\n<hr\/>\n<h3>\u042d\u043f\u0438\u0437\u043e\u0434 10. \u0410\u0440\u0445\u0438\u0432: Recording Rules<\/h3>\n<p>\u041d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0434\u043e\u043f\u0440\u043e\u0441\u044b \u0441\u0442\u043e\u044f\u0442 \u0434\u043e\u0440\u043e\u0433\u043e. <code>histogram_quantile<\/code> \u043f\u043e \u043c\u0438\u043b\u043b\u0438\u043e\u043d\u0430\u043c \u0442\u043e\u0447\u0435\u043a &#8212; \u044d\u0442\u043e \u043d\u0435 \u0431\u0435\u0441\u043f\u043b\u0430\u0442\u043d\u043e. \u0410 \u0435\u0441\u043b\u0438 \u044d\u0442\u043e\u0442 \u0434\u043e\u043f\u0440\u043e\u0441 \u043f\u0440\u043e\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u0432 \u0442\u0440\u0451\u0445 \u0434\u0430\u0448\u0431\u043e\u0440\u0434\u0430\u0445 \u0438 \u0434\u0432\u0443\u0445 \u0430\u043b\u0435\u0440\u0442\u0430\u0445? \u041f\u044f\u0442\u044c \u0440\u0430\u0437 \u0441\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u0442\u044c \u0441\u0432\u0438\u0434\u0435\u0442\u0435\u043b\u044f \u043e\u0431 \u043e\u0434\u043d\u043e\u043c \u0438 \u0442\u043e\u043c \u0436\u0435\u2026 \u0442\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0447\u0435\u043d\u044c \u043f\u043b\u043e\u0445\u0438\u0435 \u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u0438 \u0438 \u043e\u0447\u0435\u043d\u044c \u0434\u043e\u0440\u043e\u0433\u0438\u0435 \u0430\u0434\u0432\u043e\u043a\u0430\u0442\u044b.<\/p>\n<p>Recording Rules &#8212; \u044d\u0442\u043e \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b \u0434\u043e\u043f\u0440\u043e\u0441\u0430, \u043f\u043e\u0434\u0448\u0438\u0442\u044b\u0439 \u0432 \u0434\u0435\u043b\u043e. \u0421\u043f\u0440\u043e\u0441\u0438\u043b\u0438 \u043e\u0434\u0438\u043d \u0440\u0430\u0437, \u0437\u0430\u043f\u0438\u0441\u0430\u043b\u0438, \u0434\u0430\u043b\u044c\u0448\u0435 \u0432\u0441\u0435 \u0447\u0438\u0442\u0430\u044e\u0442 \u0437\u0430\u043f\u0438\u0441\u044c. \u0420\u0430\u0437 \u0432 15 \u0441\u0435\u043a\u0443\u043d\u0434 \u0441\u0432\u0435\u0436\u0430\u044f \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0430.<\/p>\n<h4>\u041a\u043e\u0433\u0434\u0430 \u043d\u0443\u0436\u043d\u044b<\/h4>\n<ul>\n<li>\n<p>\u0417\u0430\u043f\u0440\u043e\u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0432 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u043c\u0435\u0441\u0442\u0430\u0445.<\/p>\n<\/li>\n<li>\n<p>\u0417\u0430\u043f\u0440\u043e\u0441 \u0442\u044f\u0436\u0451\u043b\u044b\u0439.<\/p>\n<\/li>\n<li>\n<p>\u041d\u0443\u0436\u043d\u0430 \u0438\u0441\u0442\u043e\u0440\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u0430\u0433\u0440\u0435\u0433\u0430\u0446\u0438\u044f.<\/p>\n<\/li>\n<\/ul>\n<h4>\u0421\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441<\/h4>\n<pre><code class=\"yaml\"># prometheus\/recording-rules.ymlgroups:  - name: http_recording_rules    interval: 15s    rules:      # RPS      - record: job:http_requests:rate5m        expr: sum(rate(http_server_requests_seconds_count[5m])) by (job, application)      # Error rate      - record: job:http_errors:rate5m_ratio        expr: |          sum(rate(http_server_requests_seconds_count{status=~\"5..\"}[5m])) by (job, application)          \/          sum(rate(http_server_requests_seconds_count[5m])) by (job, application)      # p99      - record: job:http_latency:p99_5m        expr: |          histogram_quantile(0.99,             sum(rate(http_server_requests_seconds_bucket[5m])) by (le, job, application))      # p50      - record: job:http_latency:p50_5m        expr: |          histogram_quantile(0.50,             sum(rate(http_server_requests_seconds_bucket[5m])) by (le, job, application))  - name: jvm_recording_rules    rules:      # Heap usage ratio - \u0438 \u0441\u043d\u043e\u0432\u0430 \u0444\u0438\u043b\u044c\u0442\u0440 != -1, \u0443 \u043f\u0443\u043b\u043e\u0432 \u0431\u0435\u0437 \u043c\u0430\u043a\u0441\u0438\u043c\u0443\u043c\u0430      # jvm_memory_max_bytes \u0440\u0430\u0432\u0435\u043d -1 \u0438 \u043f\u043e\u0440\u0442\u0438\u0442 \u0441\u0443\u043c\u043c\u0443      - record: job:jvm_heap:usage_ratio        expr: |          sum(jvm_memory_used_bytes{area=\"heap\"}) by (job, application, instance)          \/          sum(jvm_memory_max_bytes{area=\"heap\"} != -1) by (job, application, instance)      # GC time ratio      - record: job:jvm_gc:time_ratio_5m        expr: sum(rate(jvm_gc_pause_seconds_sum[5m])) by (job, application)  - name: business_recording_rules    rules:      # Task creation rate      - record: app:tasks:creation_rate_5m        expr: sum(rate(tasks_created_total[5m])) by (application)      # Task completion rate      - record: app:tasks:completion_rate_5m        expr: sum(rate(tasks_completed_total[5m])) by (application)      # Backlog growth      - record: app:tasks:backlog_growth_rate_5m        expr: |          sum(rate(tasks_created_total[5m])) by (application)          - sum(rate(tasks_completed_total[5m])) by (application)<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<h4>Naming Convention<\/h4>\n<p>\u0424\u043e\u0440\u043c\u0430\u0442: <code>level:metric:operations<\/code><\/p>\n<div>\n<div class=\"table\">\n<table>\n<tbody>\n<tr>\n<th>\n<p align=\"left\">\u0427\u0430\u0441\u0442\u044c<\/p>\n<\/th>\n<th>\n<p align=\"left\">\u041e\u043f\u0438\u0441\u0430\u043d\u0438\u0435<\/p>\n<\/th>\n<th>\n<p align=\"left\">\u041f\u0440\u0438\u043c\u0435\u0440\u044b<\/p>\n<\/th>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">level<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0423\u0440\u043e\u0432\u0435\u043d\u044c \u0430\u0433\u0440\u0435\u0433\u0430\u0446\u0438\u0438<\/p>\n<\/td>\n<td>\n<p align=\"left\"><code>job<\/code>, <code>instance<\/code>, <code>app<\/code><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">metric<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0411\u0430\u0437\u043e\u0432\u0430\u044f \u043c\u0435\u0442\u0440\u0438\u043a\u0430<\/p>\n<\/td>\n<td>\n<p align=\"left\"><code>http_requests<\/code>, <code>jvm_heap<\/code><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">operations<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u041e\u043f\u0435\u0440\u0430\u0446\u0438\u0438<\/p>\n<\/td>\n<td>\n<p align=\"left\"><code>rate5m<\/code>, <code>p99_5m<\/code>, <code>ratio<\/code><\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<h4>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435<\/h4>\n<p>\u0411\u044b\u043b\u043e:<\/p>\n<pre><code>histogram_quantile(0.99, sum(rate(http_server_requests_seconds_bucket[5m])) by (le, job))<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p>\u0421\u0442\u0430\u043b\u043e:<\/p>\n<pre><code>job:http_latency:p99_5m<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p>\u041a\u043e\u0440\u043e\u0447\u0435. \u0411\u044b\u0441\u0442\u0440\u0435\u0435. \u0418 \u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u043a\u0430\u0436\u0434\u044b\u0439 \u0440\u0430\u0437 \u0432\u0441\u043f\u043e\u043c\u0438\u043d\u0430\u0442\u044c \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441.<\/p>\n<hr\/>\n<h3>\u042d\u043f\u0438\u0437\u043e\u0434 11. \u0414\u043e\u0433\u043e\u0432\u043e\u0440 \u0441 \u0433\u043e\u0440\u043e\u0434\u043e\u043c: SLO, SLI \u0438 43 \u043c\u0438\u043d\u0443\u0442\u044b<\/h3>\n<p>\u0424\u0438\u043d\u0430\u043b\u044c\u043d\u044b\u0439 \u043e\u0442\u0447\u0451\u0442 \u0432 \u043c\u044d\u0440\u0438\u0438. \u0411\u043e\u0440\u0438\u0441 \u0410\u0440\u043a\u0430\u0434\u044c\u0435\u0432\u0438\u0447 \u043f\u0440\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u043b \u0432\u0441\u0435 \u043d\u0430\u0448\u0438 \u0434\u043e\u0441\u043a\u0438, \u043d\u0438\u0442\u043a\u0438 \u0438 \u0444\u043e\u0442\u043e\u0433\u0440\u0430\u0444\u0438\u0438 \u0438 \u0437\u0430\u0434\u0430\u043b \u0432\u043e\u043f\u0440\u043e\u0441, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u0442\u043e\u0438\u043b \u0432\u0441\u0435\u0445 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0445:<\/p>\n<p>\u2014 \u0425\u043e\u0440\u043e\u0448\u043e. \u0410 \u043e\u0431\u0435\u0449\u0430\u043d\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u044b \u0434\u0430\u043b\u0438 \u043a\u043b\u0438\u0435\u043d\u0442\u0430\u043c, \u043c\u044b \u0438\u0445 \u0434\u0435\u0440\u0436\u0438\u043c? \u0414\u0430 \u0438\u043b\u0438 \u043d\u0435\u0442?<\/p>\n<p>\u0412\u043e\u0442 \u043e\u043d, \u0433\u043b\u0430\u0432\u043d\u044b\u0439 \u0432\u043e\u043f\u0440\u043e\u0441. \u0411\u0435\u0437 \u043f\u0435\u0440\u0446\u0435\u043d\u0442\u0438\u043b\u0435\u0439, \u0431\u0435\u0437 <code>histogram_quantile<\/code>. \u0414\u0430 \u0438\u043b\u0438 \u043d\u0435\u0442. \u041d\u0430 \u0442\u0430\u043a\u0438\u0435 \u0432\u043e\u043f\u0440\u043e\u0441\u044b \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442 SLO: \u0434\u043e\u0433\u043e\u0432\u043e\u0440, \u043f\u043e\u0434 \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u0441\u0442\u043e\u0438\u0442 \u0432\u0430\u0448\u0430 \u043f\u043e\u0434\u043f\u0438\u0441\u044c.<\/p>\n<h4>\u041e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f<\/h4>\n<p><strong>SLI (Service Level Indicator)<\/strong> &#8212; \u0447\u0442\u043e \u0438\u0437\u043c\u0435\u0440\u044f\u0435\u043c:<\/p>\n<ul>\n<li>\n<p>Availability: \u0434\u043e\u043b\u044f \u0443\u0441\u043f\u0435\u0448\u043d\u044b\u0445 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432.<\/p>\n<\/li>\n<li>\n<p>Latency: \u0434\u043e\u043b\u044f \u0431\u044b\u0441\u0442\u0440\u044b\u0445 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432.<\/p>\n<\/li>\n<\/ul>\n<p><strong>SLO (Service Level Objective)<\/strong> &#8212; \u0446\u0435\u043b\u0435\u0432\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435:<\/p>\n<ul>\n<li>\n<p>Availability: 99.9%<\/p>\n<\/li>\n<li>\n<p>Latency p99: &lt; 500ms<\/p>\n<\/li>\n<\/ul>\n<p><strong>Error Budget<\/strong> &#8212; \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043c\u043e\u0436\u043d\u043e \u043e\u0448\u0438\u0431\u0430\u0442\u044c\u0441\u044f:<\/p>\n<ul>\n<li>\n<p>SLO 99.9% = 0.1% \u043e\u0448\u0438\u0431\u043e\u043a \u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u043e.<\/p>\n<\/li>\n<li>\n<p>30 \u0434\u043d\u0435\u0439 \u00d7 24\u0447 \u00d7 60\u043c\u0438\u043d = 43 200 \u043c\u0438\u043d\u0443\u0442.<\/p>\n<\/li>\n<li>\n<p>Error Budget = 43 200 \u00d7 0.001 = <strong>43 \u043c\u0438\u043d\u0443\u0442\u044b<\/strong>.<\/p>\n<\/li>\n<\/ul>\n<p>\u0421\u043e\u0440\u043e\u043a \u0442\u0440\u0438 \u043c\u0438\u043d\u0443\u0442\u044b \u0437\u0430 \u043c\u0435\u0441\u044f\u0446. \u0412\u0441\u0435\u0433\u043e \u0441\u043e\u0440\u043e\u043a \u0442\u0440\u0438. \u041d\u0430 \u0432\u0441\u0451. \u041d\u0430 \u0431\u0430\u0433\u0438, \u043d\u0430 \u0434\u0435\u043f\u043b\u043e\u0438, \u043d\u0430 \u00ab\u043d\u0443 \u0442\u0443\u0442 \u043c\u044b \u043d\u0435 \u043e\u0436\u0438\u0434\u0430\u043b\u0438\u00bb. \u0421\u043e\u0440\u043e\u043a \u0442\u0440\u0438 \u043c\u0438\u043d\u0443\u0442\u044b, \u0438 \u0431\u044e\u0434\u0436\u0435\u0442 \u0438\u0441\u0447\u0435\u0440\u043f\u0430\u043d. \u041f\u043e\u0442\u043e\u043c \u043d\u0430\u0447\u0438\u043d\u0430\u044e\u0442\u0441\u044f \u0440\u0430\u0437\u0433\u043e\u0432\u043e\u0440\u044b, \u043f\u043e\u0441\u043b\u0435 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0445\u043e\u0447\u0435\u0442\u0441\u044f \u0441\u043c\u0435\u043d\u0438\u0442\u044c \u0444\u0430\u043c\u0438\u043b\u0438\u044e \u0438 \u0433\u043e\u0440\u043e\u0434. \u042f \u0432 \u0442\u0430\u043a\u0438\u0445 \u0443\u0447\u0430\u0441\u0442\u0432\u043e\u0432\u0430\u043b. \u0424\u0430\u043c\u0438\u043b\u0438\u044e \u043e\u0441\u0442\u0430\u0432\u0438\u043b, \u043f\u0440\u0438\u0432\u044b\u0447\u043a\u0443 \u0441\u0447\u0438\u0442\u0430\u0442\u044c \u0431\u044e\u0434\u0436\u0435\u0442 \u043f\u0440\u0438\u043e\u0431\u0440\u0451\u043b.<\/p>\n<h4>Recording Rules \u0434\u043b\u044f SLI<\/h4>\n<pre><code class=\"yaml\"># prometheus\/slo-rules.ymlgroups:  - name: slo_recording_rules    rules:      # Availability SLI.      # \u0412\u0410\u0416\u041d\u041e: \u0438\u0441\u043a\u043b\u044e\u0447\u0430\u0435\u043c \/actuator - Prometheus \u0441\u0430\u043c \u0441\u043a\u0440\u0435\u0439\u043f\u0438\u0442 \u043c\u0435\u0442\u0440\u0438\u043a\u0438 \u043a\u0430\u0436\u0434\u044b\u0435      # 5 \u0441\u0435\u043a\u0443\u043d\u0434, healthcheck \u0434\u0451\u0440\u0433\u0430\u0435\u0442 \/actuator\/health. \u042d\u0442\u043e \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u044b\u0439 \u043f\u043e\u0442\u043e\u043a      # \u0431\u044b\u0441\u0442\u0440\u044b\u0445 \u0443\u0441\u043f\u0435\u0448\u043d\u044b\u0445 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0443\u043b\u0443\u0447\u0448\u0430\u0435\u0442 SLI, \u043d\u0435 \u0438\u043c\u0435\u044f \u043d\u0438\u043a\u0430\u043a\u043e\u0433\u043e      # \u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u044f \u043a \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f\u043c. SLO - \u043f\u0440\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439.      - record: sli:http_availability:ratio_rate5m        expr: |          sum(rate(http_server_requests_seconds_count{status!~\"5..\", uri!~\"\/actuator.*\"}[5m])) by (application)          \/          sum(rate(http_server_requests_seconds_count{uri!~\"\/actuator.*\"}[5m])) by (application)      # Latency SLI: \u0434\u043e\u043b\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 &lt; 500ms      # (\u0431\u0430\u043a\u0435\u0442 le=\"0.5\" \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0435\u0441\u043b\u0438 \u0432 application.yml \u0437\u0430\u0434\u0430\u043d\u0430      #  SLO-\u0433\u0440\u0430\u043d\u0438\u0446\u0430 500ms - \u0441\u043c. \u044d\u043f\u0438\u0437\u043e\u0434 \u043f\u0440\u043e \u043f\u0440\u043e\u0441\u043b\u0443\u0448\u043a\u0443)      - record: sli:http_latency_500ms:ratio_rate5m        expr: |          sum(rate(http_server_requests_seconds_bucket{le=\"0.5\", uri!~\"\/actuator.*\"}[5m])) by (application)          \/          sum(rate(http_server_requests_seconds_count{uri!~\"\/actuator.*\"}[5m])) by (application)      # Burn rate - \u043a\u043e\u0440\u043e\u0442\u043a\u043e\u0435 \u043e\u043a\u043d\u043e: \u043d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0431\u044b\u0441\u0442\u0440\u043e      # \u043c\u044b \u0442\u0440\u0430\u0442\u0438\u043c \u0431\u044e\u0434\u0436\u0435\u0442 \u041f\u0420\u042f\u041c\u041e \u0421\u0415\u0419\u0427\u0410\u0421.      - record: slo:error_budget:burn_rate_5m        expr: |          (1 - sli:http_availability:ratio_rate5m) \/ (1 - 0.999)  # \u0414\u043b\u0438\u043d\u043d\u044b\u0435 \u043e\u043a\u043d\u0430 \u0432\u044b\u043d\u043e\u0441\u0438\u043c \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u0443\u044e \u0433\u0440\u0443\u043f\u043f\u0443 \u0441 interval: 1m.  # rate[30d] - \u0434\u043e\u0440\u043e\u0433\u043e\u0439 \u0437\u0430\u043f\u0440\u043e\u0441, \u0438 \u043f\u0435\u0440\u0435\u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c \u0435\u0433\u043e \u043a\u0430\u0436\u0434\u044b\u0435 15 \u0441\u0435\u043a\u0443\u043d\u0434 -  # \u044d\u0442\u043e \u0440\u043e\u0432\u043d\u043e \u0442\u043e\u0442 \u0441\u043b\u0443\u0447\u0430\u0439 \"\u0437\u0430\u043f\u0440\u043e\u0441 \u0442\u044f\u0436\u0435\u043b\u0435\u0435 \u043e\u0442\u0432\u0435\u0442\u0430\" \u0438\u0437 \u044d\u043f\u0438\u0437\u043e\u0434\u0430 \u043f\u0440\u043e recording  # rules. \u0411\u044e\u0434\u0436\u0435\u0442 \u0437\u0430 \u043c\u0435\u0441\u044f\u0446 \u043d\u0435 \u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u0437\u0430 15 \u0441\u0435\u043a\u0443\u043d\u0434. \u0420\u0430\u0437 \u0432 \u043c\u0438\u043d\u0443\u0442\u0443 - \u0449\u0435\u0434\u0440\u043e.  - name: slo_recording_rules_long    interval: 1m    rules:      # Availability \u0437\u0430 \u041e\u041a\u041d\u041e SLO (30 \u0434\u043d\u0435\u0439). \u0422\u0440\u0435\u0431\u0443\u0435\u0442 retention &gt;= 30d.      # \u041d\u044e\u0430\u043d\u0441: \u043d\u0430 \u0441\u0432\u0435\u0436\u0435\u043c \u0441\u0442\u0435\u043d\u0434\u0435 rate[30d] \u0441\u0447\u0438\u0442\u0430\u0435\u0442\u0441\u044f \u043f\u043e \u0442\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u043c, \u0447\u0442\u043e \u0435\u0441\u0442\u044c.      # \u041f\u0435\u0440\u0432\u044b\u0435 \u043d\u0435\u0434\u0435\u043b\u0438 error budget - \u043e\u0446\u0435\u043d\u043a\u0430, \u0430 \u043d\u0435 \u0444\u0430\u043a\u0442. \u0418\u043c\u0435\u0439\u0442\u0435 \u0432 \u0432\u0438\u0434\u0443.      - record: sli:http_availability:ratio_rate30d        expr: |          sum(rate(http_server_requests_seconds_count{status!~\"5..\", uri!~\"\/actuator.*\"}[30d])) by (application)          \/          sum(rate(http_server_requests_seconds_count{uri!~\"\/actuator.*\"}[30d])) by (application)      # Error Budget remaining (\u0434\u043b\u044f SLO 99.9%).      # \u0412\u0410\u0416\u041d\u041e: \u0431\u044e\u0434\u0436\u0435\u0442 - \u0432\u0435\u043b\u0438\u0447\u0438\u043d\u0430 \u0437\u0430 \u043c\u0435\u0441\u044f\u0446, \u0430 \u043d\u0435 \u0437\u0430 5 \u043c\u0438\u043d\u0443\u0442.      # \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0441\u0447\u0438\u0442\u0430\u0435\u043c \u043f\u043e 30-\u0434\u043d\u0435\u0432\u043d\u043e\u043c\u0443 \u043e\u043a\u043d\u0443, \u0430 \u043d\u0435 \u043f\u043e rate5m.      - record: slo:error_budget:remaining_ratio        expr: |          1 - (            (1 - sli:http_availability:ratio_rate30d)            \/ (1 - 0.999)          )<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p>\u0417\u0434\u0435\u0441\u044c \u043b\u0435\u0433\u043a\u043e \u043f\u0435\u0440\u0435\u043f\u0443\u0442\u0430\u0442\u044c \u0434\u0432\u0430 \u0440\u0430\u0437\u043d\u044b\u0445 \u0434\u043e\u043f\u0440\u043e\u0441\u0430. \u00ab\u0421\u043a\u043e\u043b\u044c\u043a\u043e \u0431\u044e\u0434\u0436\u0435\u0442\u0430 \u043e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u0437\u0430 \u043c\u0435\u0441\u044f\u0446?\u00bb &#8212; \u044d\u0442\u043e <code>remaining_ratio<\/code> \u043f\u043e 30-\u0434\u043d\u0435\u0432\u043d\u043e\u043c\u0443 \u043e\u043a\u043d\u0443. \u00ab\u041a\u0430\u043a \u0431\u044b\u0441\u0442\u0440\u043e \u043c\u044b \u0435\u0433\u043e \u0436\u0436\u0451\u043c \u043f\u0440\u044f\u043c\u043e \u0441\u0435\u0439\u0447\u0430\u0441?\u00bb &#8212; \u044d\u0442\u043e burn rate \u043f\u043e \u043a\u043e\u0440\u043e\u0442\u043a\u043e\u043c\u0443 \u043e\u043a\u043d\u0443. \u0421\u0447\u0438\u0442\u0430\u0442\u044c \u043e\u0441\u0442\u0430\u0442\u043e\u043a \u043c\u0435\u0441\u044f\u0447\u043d\u043e\u0433\u043e \u0431\u044e\u0434\u0436\u0435\u0442\u0430 \u043f\u043e \u043f\u044f\u0442\u0438\u043c\u0438\u043d\u0443\u0442\u043a\u0435 &#8212; \u0432\u0441\u0451 \u0440\u0430\u0432\u043d\u043e \u0447\u0442\u043e \u0437\u0430\u043a\u0440\u044b\u0432\u0430\u0442\u044c \u0434\u0435\u043b\u043e \u043f\u043e \u043e\u0434\u043d\u043e\u0439 \u0443\u043b\u0438\u043a\u0435. \u041f\u0440\u0438\u0441\u044f\u0436\u043d\u044b\u0435 \u043d\u0435 \u043e\u0446\u0435\u043d\u044f\u0442. Prometheus \u0442\u043e\u0436\u0435.<\/p>\n<h4>\u0410\u043b\u0435\u0440\u0442\u044b \u043d\u0430 Burn Rate<\/h4>\n<p>\u0421\u0440\u0430\u0437\u0443 \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0443 \u043e \u0441\u043e\u0431\u043b\u0430\u0437\u043d\u0435. \u0425\u043e\u0447\u0435\u0442\u0441\u044f \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043f\u0440\u043e\u0441\u0442\u043e <code>burn_rate_5m &gt; 10<\/code> \u0438 \u0441\u0434\u0430\u0442\u044c \u0432 \u0430\u0440\u0445\u0438\u0432. \u041d\u0435 \u0434\u0435\u043b\u0430\u0439\u0442\u0435 \u0442\u0430\u043a. \u0410\u043b\u0435\u0440\u0442 \u043d\u0430 \u043e\u0434\u043d\u043e \u043a\u043e\u0440\u043e\u0442\u043a\u043e\u0435 \u043e\u043a\u043d\u043e \u0448\u0443\u043c\u0438\u0442: \u0434\u0451\u0440\u043d\u0443\u043b\u0441\u044f error rate \u043d\u0430 \u043c\u0438\u043d\u0443\u0442\u0443, \u0434\u0435\u0436\u0443\u0440\u043d\u043e\u043c\u0443 \u043f\u043e\u0437\u0432\u043e\u043d\u0438\u043b\u0438, \u0430 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0443\u0436\u0435 \u043d\u0435\u0442. \u041a\u0430\u043d\u043e\u043d\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u043f\u0440\u0438\u0451\u043c \u0438\u0437 \u0443\u0447\u0435\u0431\u043d\u0438\u043a\u0430 Google SRE &#8212; multi-window: \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0430\u0442\u044c \u0432\u0441\u043f\u043b\u0435\u0441\u043a \u0434\u0432\u0443\u043c\u044f \u043e\u043a\u043d\u0430\u043c\u0438, \u043a\u043e\u0440\u043e\u0442\u043a\u0438\u043c \u0438 \u0434\u043b\u0438\u043d\u043d\u044b\u043c. \u0415\u0441\u043b\u0438 \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u0438\u044f \u0434\u0430\u043b\u0438 \u043e\u0431\u0430 \u0441\u0432\u0438\u0434\u0435\u0442\u0435\u043b\u044f, \u0434\u0435\u043b\u043e \u043d\u0430\u0441\u0442\u043e\u044f\u0449\u0435\u0435: \u0431\u0443\u0434\u0438\u043c \u0447\u0435\u043b\u043e\u0432\u0435\u043a\u0430. \u0415\u0441\u043b\u0438 \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u0438\u043d &#8212; \u043f\u0435\u0440\u0435\u0436\u0434\u0451\u043c \u0438 \u043f\u043e\u043d\u0430\u0431\u043b\u044e\u0434\u0430\u0435\u043c.<\/p>\n<pre><code class=\"yaml\"># Fast burn (page): \u0431\u044e\u0434\u0436\u0435\u0442 \u0433\u043e\u0440\u0438\u0442 \u043e\u0447\u0435\u043d\u044c \u0431\u044b\u0441\u0442\u0440\u043e.# 14.4x = \u043c\u0435\u0441\u044f\u0447\u043d\u044b\u0439 \u0431\u044e\u0434\u0436\u0435\u0442 \u0441\u0433\u043e\u0440\u0438\u0442 \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0437\u0430 2 \u0434\u043d\u044f.# \u041f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0430\u0435\u043c \u043a\u043e\u0440\u043e\u0442\u043a\u0438\u043c (5m) \u0418 \u0434\u043b\u0438\u043d\u043d\u044b\u043c (1h) \u043e\u043a\u043d\u043e\u043c.- alert: HighErrorBudgetBurn  expr: |    slo:error_budget:burn_rate_5m &gt; 14.4    and    slo:error_budget:burn_rate_1h &gt; 14.4  for: 2m  labels:    severity: critical  annotations:    summary: \"Fast error budget burn\"    description: |      Burn rate &gt; 14.4x confirmed on 5m and 1h windows.      At this rate, monthly error budget will be exhausted in ~2 days.# Slow burn (ticket): \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u0430\u044f \u0434\u0435\u0433\u0440\u0430\u0434\u0430\u0446\u0438\u044f, 6x \u043d\u0430 \u043e\u043a\u043d\u0430\u0445 30m \u0438 6h.- alert: ElevatedErrorBudgetBurn  expr: |    slo:error_budget:burn_rate_30m &gt; 6    and    slo:error_budget:burn_rate_6h &gt; 6  for: 15m  labels:    severity: warning  annotations:    summary: \"Elevated error budget burn\"- alert: ErrorBudgetExhausted  expr: slo:error_budget:remaining_ratio &lt; 0  for: 5m  labels:    severity: critical  annotations:    summary: \"Error budget exhausted\"- alert: ErrorBudgetHalfConsumed  expr: slo:error_budget:remaining_ratio &lt; 0.5  for: 1h  labels:    severity: warning  annotations:    summary: \"More than 50% error budget consumed\"    description: \"{{ $value | humanizePercentage }} of error budget remaining\"<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p>Burn Rate = 14.4 \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442: \u0431\u044e\u0434\u0436\u0435\u0442 \u043e\u0448\u0438\u0431\u043e\u043a \u0442\u0440\u0430\u0442\u0438\u0442\u0441\u044f \u0432 \u0447\u0435\u0442\u044b\u0440\u043d\u0430\u0434\u0446\u0430\u0442\u044c \u0440\u0430\u0437 \u0431\u044b\u0441\u0442\u0440\u0435\u0435, \u0447\u0435\u043c \u043c\u043e\u0436\u043d\u043e. \u041f\u0440\u0438 \u0442\u0430\u043a\u043e\u043c \u0442\u0435\u043c\u043f\u0435 \u043c\u0435\u0441\u044f\u0447\u043d\u044b\u0439 \u0431\u044e\u0434\u0436\u0435\u0442 \u0437\u0430\u043a\u043e\u043d\u0447\u0438\u0442\u0441\u044f \u0437\u0430 \u0434\u0432\u0430 \u0434\u043d\u044f. \u041e\u0442\u043a\u0443\u0434\u0430 \u0432\u0437\u044f\u043b\u043e\u0441\u044c \u0438\u043c\u0435\u043d\u043d\u043e 14.4? \u0418\u0437 Google SRE Workbook: 14.4x \u043d\u0430 \u043e\u043a\u043d\u0435 1h \u0441\u0436\u0438\u0433\u0430\u0435\u0442 2% \u043c\u0435\u0441\u044f\u0447\u043d\u043e\u0433\u043e \u0431\u044e\u0434\u0436\u0435\u0442\u0430 \u0437\u0430 \u0447\u0430\u0441. \u0414\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0441\u0442\u0440\u0430\u0448\u043d\u043e, \u0447\u0442\u043e\u0431\u044b \u0431\u0443\u0434\u0438\u0442\u044c \u0447\u0435\u043b\u043e\u0432\u0435\u043a\u0430. Recording rules \u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043e\u0447\u043d\u044b\u0445 \u043e\u043a\u043e\u043d (30m, 1h, 6h) \u043b\u0435\u0436\u0430\u0442 \u0432 <code>slo-rules.yml<\/code> \u0434\u0435\u043c\u043e-\u043f\u0440\u043e\u0435\u043a\u0442\u0430.<\/p>\n<h4>\u0414\u0430\u0448\u0431\u043e\u0440\u0434 SLO<\/h4>\n<p>\u0412 \u0434\u0435\u043c\u043e-\u0434\u0430\u0448\u0431\u043e\u0440\u0434\u0435 \u044d\u0442\u043e \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u0440\u044f\u0434 \u00abSLO \/ Error Budget\u00bb: \u0442\u0440\u0438 \u043f\u0430\u043d\u0435\u043b\u0438, \u043f\u043e \u043e\u0434\u043d\u043e\u0439 \u043d\u0430 \u043a\u0430\u0436\u0434\u044b\u0439 \u0432\u043e\u043f\u0440\u043e\u0441. \u00ab\u041a\u0430\u043a \u043c\u044b \u0441\u0435\u0439\u0447\u0430\u0441?\u00bb, \u00ab\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0431\u044e\u0434\u0436\u0435\u0442\u0430 \u043e\u0441\u0442\u0430\u043b\u043e\u0441\u044c?\u00bb \u0438 \u00ab\u043a\u0430\u043a \u0431\u044b\u0441\u0442\u0440\u043e \u0442\u0440\u0430\u0442\u0438\u043c?\u00bb.<\/p>\n<p><strong>Panel 1: Current Availability<\/strong><\/p>\n<pre><code>sli:http_availability:ratio_rate5m * 100<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p>Thresholds: Green &gt; 99.9%, Yellow &gt; 99%, Red &lt; 99%<\/p>\n<p><strong>Panel 2: Error Budget Remaining<\/strong><\/p>\n<pre><code>slo:error_budget:remaining_ratio * 100<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p>Thresholds: Green &gt; 50%, Yellow &gt; 20%, Red &lt; 20%<\/p>\n<p><strong>Panel 3: Burn Rate<\/strong><\/p>\n<pre><code>slo:error_budget:burn_rate_5m<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p>\u0421 \u043b\u0438\u043d\u0438\u0435\u0439 \u043d\u0430 1 (\u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u044b\u0439 \u0442\u0435\u043c\u043f) \u0438 14.4 (\u043a\u0440\u0438\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439).<\/p>\n<p>\u0411\u043e\u0440\u0438\u0441 \u0410\u0440\u043a\u0430\u0434\u044c\u0435\u0432\u0438\u0447 \u0438\u0437 \u0432\u0441\u0435\u0445 \u043f\u0430\u043d\u0435\u043b\u0435\u0439 \u043f\u043e\u043b\u044e\u0431\u0438\u043b \u0438\u043c\u0435\u043d\u043d\u043e Error Budget. \u00ab\u042d\u0442\u043e \u044f \u043f\u043e\u043d\u0438\u043c\u0430\u044e, \u2014 \u0441\u043a\u0430\u0437\u0430\u043b \u043e\u043d. \u2014 \u042d\u0442\u043e \u043a\u0430\u043a \u0434\u0435\u043d\u044c\u0433\u0438\u00bb. \u041c\u044b \u043d\u0435 \u0441\u0442\u0430\u043b\u0438 \u0435\u0433\u043e \u043f\u043e\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c. \u041f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043e\u043d \u043f\u0440\u0430\u0432.<\/p>\n<hr\/>\n<h3>\u042d\u043f\u0438\u0437\u043e\u0434 12. \u0414\u0435\u043b\u043e \u043e \u043a\u0430\u0440\u0434\u0438\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u0438: \u0421\u0435\u0440\u0451\u0433\u0438\u043d\u0430 \u0438\u0441\u043f\u043e\u0432\u0435\u0434\u044c<\/h3>\n<p>\u041a\u043e\u0433\u0434\u0430 \u0443 \u043d\u0430\u0441 \u0432\u0441\u0451 \u0431\u043e\u043b\u0435\u0435-\u043c\u0435\u043d\u0435\u0435 \u0437\u0430\u0440\u0430\u0431\u043e\u0442\u0430\u043b\u043e, \u0432 \u0443\u0447\u0430\u0441\u0442\u043e\u043a \u0437\u0430\u0448\u0451\u043b \u0421\u0435\u0440\u0451\u0433\u0430. \u0421\u0435\u043b. \u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u043b \u043d\u0430 \u0434\u043e\u0441\u043a\u0438. \u041a\u0438\u0432\u043d\u0443\u043b. \u0414\u043e\u0441\u0442\u0430\u043b \u0438\u0437 \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0435\u0433\u043e \u043a\u0430\u0440\u043c\u0430\u043d\u0430 \u043d\u0435 \u0444\u043b\u044f\u0433\u0443, \u0430 \u0442\u0435\u0440\u043c\u043e\u0441 \u0441 \u0447\u0430\u0435\u043c &#8212; \u0433\u043e\u0434\u044b \u0431\u0435\u0440\u0443\u0442 \u0441\u0432\u043e\u0451. \u0418 \u0441\u043a\u0430\u0437\u0430\u043b:<\/p>\n<p>\u2014 \u0425\u043e\u0440\u043e\u0448\u043e \u0443 \u0432\u0430\u0441. \u0410 \u0442\u0435\u043f\u0435\u0440\u044c \u044f \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0443, \u043a\u0430\u043a \u043c\u044b \u043e\u0434\u043d\u0430\u0436\u0434\u044b \u0443\u0431\u0438\u043b\u0438 Prometheus. \u0421\u0432\u043e\u0438\u043c\u0438 \u0440\u0443\u043a\u0430\u043c\u0438. \u0418\u0437 \u043b\u0443\u0447\u0448\u0438\u0445 \u043f\u043e\u0431\u0443\u0436\u0434\u0435\u043d\u0438\u0439. \u0412\u0441\u0435 \u0445\u0443\u0434\u0448\u0438\u0435 \u0434\u0435\u043b\u0430 \u0432 \u044d\u0442\u043e\u043c \u0433\u043e\u0440\u043e\u0434\u0435 \u043d\u0430\u0447\u0438\u043d\u0430\u044e\u0442\u0441\u044f \u0441\u043e \u0441\u043b\u043e\u0432 \u00ab\u0438\u0437 \u043b\u0443\u0447\u0448\u0438\u0445 \u043f\u043e\u0431\u0443\u0436\u0434\u0435\u043d\u0438\u0439\u00bb.<\/p>\n<p>\u041c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u043d\u0433 \u043c\u043e\u0436\u0435\u0442 \u043d\u0430\u0432\u0440\u0435\u0434\u0438\u0442\u044c. \u0417\u0432\u0443\u0447\u0438\u0442 \u043a\u0430\u043a \u043f\u0430\u0440\u0430\u0434\u043e\u043a\u0441, \u043d\u043e \u0435\u0441\u043b\u0438 \u0437\u0430\u0441\u0443\u043d\u0443\u0442\u044c user_id \u0432 \u0442\u0435\u0433\u0438 \u043c\u0435\u0442\u0440\u0438\u043a, Prometheus \u0441\u043e\u0436\u0440\u0451\u0442 \u0432\u0441\u044e \u043f\u0430\u043c\u044f\u0442\u044c. \u0418 \u0442\u043e\u0433\u0434\u0430 \u0443 \u0432\u0430\u0441 \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u043d\u0438 \u043c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u043d\u0433\u0430, \u043d\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f. \u0422\u043e\u043b\u044c\u043a\u043e \u0442\u0438\u0448\u0438\u043d\u0430, \u0434\u043e\u0436\u0434\u044c \u0438 \u0421\u0435\u0440\u0451\u0433\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u044d\u0442\u0443 \u0438\u0441\u0442\u043e\u0440\u0438\u044e \u043d\u043e\u0432\u044b\u043c \u043a\u043e\u043c\u0430\u043d\u0434\u0430\u043c.<\/p>\n<h4>Cardinality Explosion<\/h4>\n<p>\u041a\u0430\u0436\u0434\u0430\u044f \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u0430\u044f \u043a\u043e\u043c\u0431\u0438\u043d\u0430\u0446\u0438\u044f labels &#8212; \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u0430\u044f time series. \u041f\u044f\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 method \u00d7 \u0434\u0432\u0430\u0434\u0446\u0430\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 endpoint \u00d7 \u0434\u0435\u0441\u044f\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 status = 1000 \u0441\u0435\u0440\u0438\u0439. \u041d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e. \u0416\u0438\u0432\u0451\u043c.<\/p>\n<p>\u0410 \u0442\u0435\u043f\u0435\u0440\u044c \u0434\u043e\u0431\u0430\u0432\u044c\u0442\u0435 user_id. \u041c\u0438\u043b\u043b\u0438\u043e\u043d \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 \u00d7 1000 = \u043c\u0438\u043b\u043b\u0438\u0430\u0440\u0434 \u0441\u0435\u0440\u0438\u0439. Prometheus \u043d\u0435 \u0441\u043a\u0430\u0436\u0435\u0442 \u00ab\u043d\u0435\u0442\u00bb. Prometheus \u043d\u0435 \u0441\u043a\u0430\u0436\u0435\u0442 \u043d\u0438\u0447\u0435\u0433\u043e. \u041e\u043d \u043f\u0440\u043e\u0441\u0442\u043e \u043c\u043e\u043b\u0447\u0430 \u0443\u043c\u0440\u0451\u0442. \u041a\u0430\u043a \u0442\u0430 JVM \u0438\u0437 \u043f\u0440\u043e\u043b\u043e\u0433\u0430. \u0423 \u043d\u0438\u0445 \u0432\u043e\u043e\u0431\u0449\u0435 \u043c\u043d\u043e\u0433\u043e \u043e\u0431\u0449\u0435\u0433\u043e: \u043e\u0431\u0430 \u0443\u0445\u043e\u0434\u044f\u0442 \u043d\u0435 \u043f\u0440\u043e\u0449\u0430\u044f\u0441\u044c.<\/p>\n<p>\u0421\u0435\u0440\u0451\u0433\u0438\u043d\u0430 \u0431\u0440\u0438\u0433\u0430\u0434\u0430 \u0441\u0434\u0435\u043b\u0430\u043b\u0430 \u0438\u043c\u0435\u043d\u043d\u043e \u044d\u0442\u043e. \u00ab\u041d\u0430\u043c \u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u0432\u0438\u0434\u0435\u0442\u044c \u043b\u0430\u0442\u0435\u043d\u0442\u043d\u043e\u0441\u0442\u044c \u043f\u043e \u043a\u0430\u0436\u0434\u043e\u043c\u0443 \u043a\u043b\u0438\u0435\u043d\u0442\u0443, \u2014 \u0433\u043e\u0432\u043e\u0440\u0438\u0442 \u043e\u043d, \u0433\u043b\u044f\u0434\u044f \u043a\u0443\u0434\u0430-\u0442\u043e \u0441\u043a\u0432\u043e\u0437\u044c \u0441\u0442\u0435\u043d\u0443. \u2014 \u041c\u044b \u0435\u0451 \u0443\u0432\u0438\u0434\u0435\u043b\u0438. \u0421\u0435\u043a\u0443\u043d\u0434 \u0442\u0440\u0438\u0434\u0446\u0430\u0442\u044c \u0432\u0438\u0434\u0435\u043b\u0438. \u041f\u043e\u0442\u043e\u043c \u043d\u0435 \u0432\u0438\u0434\u0435\u043b\u0438 \u0443\u0436\u0435 \u043d\u0438\u0447\u0435\u0433\u043e\u00bb.<\/p>\n<p><strong>\u041f\u043b\u043e\u0445\u043e:<\/strong><\/p>\n<pre><code class=\"java\">\/\/ \u041d\u0418\u041a\u041e\u0413\u0414\u0410 \u0442\u0430\u043a \u043d\u0435 \u0434\u0435\u043b\u0430\u0439\u0442\u0435!meterRegistry.counter(\"api.requests\",    \"user_id\", userId,        \/\/ \u041c\u0438\u043b\u043b\u0438\u043e\u043d\u044b \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439    \"request_id\", requestId   \/\/ \u0423\u043d\u0438\u043a\u0430\u043b\u0435\u043d \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u0430).increment();<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p><strong>\u0425\u043e\u0440\u043e\u0448\u043e:<\/strong><\/p>\n<pre><code class=\"java\">meterRegistry.counter(\"api.requests\",    \"method\", \"GET\",          \/\/ ~5 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439    \"endpoint\", \"\/api\/tasks\", \/\/ ~20 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439    \"status\", \"200\"           \/\/ ~10 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439).increment();<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p><strong>\u041f\u0440\u0430\u0432\u0438\u043b\u043e:<\/strong> \u0432 \u0442\u0435\u0433\u0430\u0445 \u0442\u043e\u043b\u044c\u043a\u043e \u0442\u043e, \u0447\u0442\u043e \u0438\u043c\u0435\u0435\u0442 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u043d\u043e\u0435 \u0447\u0438\u0441\u043b\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439. Method, status, endpoint. \u041d\u0435 user_id. \u041d\u0435 session_id. \u041d\u0435 request_id. \u041d\u0438\u043a\u043e\u0433\u0434\u0430. \u0414\u0430\u0436\u0435 \u0435\u0441\u043b\u0438 \u043e\u0447\u0435\u043d\u044c \u0445\u043e\u0447\u0435\u0442\u0441\u044f. \u0414\u0430\u0436\u0435 \u0435\u0441\u043b\u0438 \u043e\u0447\u0435\u043d\u044c-\u043e\u0447\u0435\u043d\u044c \u0445\u043e\u0447\u0435\u0442\u0441\u044f \u0438 \u043f\u0440\u043e\u0434\u0430\u043a\u0442 \u0441\u043c\u043e\u0442\u0440\u0438\u0442 \u043d\u0430 \u0432\u0430\u0441 \u0433\u043b\u0430\u0437\u0430\u043c\u0438 \u043a\u043e\u0442\u0430 \u0438\u0437 \u00ab\u0428\u0440\u0435\u043a\u0430\u00bb.<\/p>\n<p>\u041e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u043a\u0430. \u041f\u043e\u0432\u0435\u0441\u044c\u0442\u0435 \u043d\u0430 \u043c\u043e\u043d\u0438\u0442\u043e\u0440:<\/p>\n<p><strong>\u0427\u0442\u043e \u0432 \u0442\u0435\u0433\u0438 \u043c\u043e\u0436\u043d\u043e<\/strong> &#8212; \u043a\u043e\u043d\u0435\u0447\u043d\u043e\u0435, \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0443\u0435\u043c\u043e\u0435 \u0447\u0438\u0441\u043b\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439:<\/p>\n<ul>\n<li>\n<p>HTTP method: GET, POST, PUT, DELETE. \u041f\u044f\u0442\u044c \u0448\u0442\u0443\u043a, \u0438 \u0442\u0435 \u043f\u043e \u043f\u0440\u0430\u0437\u0434\u043d\u0438\u043a\u0430\u043c.<\/p>\n<\/li>\n<li>\n<p>Status code: 200, 404, 500. \u0414\u0435\u0441\u044f\u0442\u043e\u043a.<\/p>\n<\/li>\n<li>\n<p>Endpoint, \u043d\u043e \u0431\u0435\u0437 path variables! <code>\/api\/tasks\/{id}<\/code>, \u0430 \u043d\u0435 <code>\/api\/tasks\/42<\/code>.<\/p>\n<\/li>\n<li>\n<p>Environment: prod, stage, dev. \u0422\u0440\u0438 \u0441\u043b\u043e\u0432\u0430.<\/p>\n<\/li>\n<\/ul>\n<p><strong>\u0427\u0442\u043e \u0432 \u0442\u0435\u0433\u0438 \u043d\u0435\u043b\u044c\u0437\u044f<\/strong> &#8212; \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u0441\u0442\u043e\u043b\u044c\u043a\u043e, \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043e\u043a\u0443\u0440\u043a\u043e\u0432 \u043f\u043e\u0434 \u043e\u043a\u043d\u0430\u043c\u0438 \u0443\u0447\u0430\u0441\u0442\u043a\u0430:<\/p>\n<ul>\n<li>\n<p>user_id, session_id, request_id: \u0443 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0441\u0432\u043e\u0439, \u0438 \u0437\u0430\u0432\u0442\u0440\u0430 \u0438\u0445 \u0431\u043e\u043b\u044c\u0448\u0435.<\/p>\n<\/li>\n<li>\n<p>timestamp: \u0443\u043d\u0438\u043a\u0430\u043b\u0435\u043d \u0432\u0441\u0435\u0433\u0434\u0430. \u041f\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044e.<\/p>\n<\/li>\n<li>\n<p>\u041b\u044e\u0431\u043e\u0435 unbounded-\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435: \u0435\u0441\u043b\u0438 \u043d\u0435 \u043c\u043e\u0436\u0435\u0442\u0435 \u043d\u0430\u0437\u0432\u0430\u0442\u044c \u0432\u0435\u0440\u0445\u043d\u044e\u044e \u0433\u0440\u0430\u043d\u0438\u0446\u0443, \u044d\u0442\u043e \u043d\u0435 \u0442\u0435\u0433. \u042d\u0442\u043e \u0431\u043e\u043c\u0431\u0430 \u0441 \u0447\u0430\u0441\u043e\u0432\u044b\u043c \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c\u043e\u043c \u0438 \u0432\u0430\u0448\u0438\u043c\u0438 \u043e\u0442\u043f\u0435\u0447\u0430\u0442\u043a\u0430\u043c\u0438.<\/p>\n<\/li>\n<\/ul>\n<p>\u0420\u0430\u0437\u043d\u0438\u0446\u0430 \u043f\u0440\u043e\u0441\u0442\u0430\u044f. \u041c\u043e\u0436\u043d\u043e &#8212; \u0442\u043e, \u0447\u0442\u043e \u0432\u044b \u0441\u043f\u043e\u0441\u043e\u0431\u043d\u044b \u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u0438\u0442\u044c \u043d\u0430 \u043f\u0430\u043b\u044c\u0446\u0430\u0445. \u041d\u0435\u043b\u044c\u0437\u044f &#8212; \u0442\u043e, \u0447\u0442\u043e \u0441\u0447\u0438\u0442\u0430\u0435\u0442\u0441\u044f \u00ab\u043c\u043d\u043e\u0433\u043e\u00bb \u0438 \u0437\u0430\u0432\u0442\u0440\u0430 \u0441\u0442\u0430\u043d\u0435\u0442 \u00ab\u0435\u0449\u0451 \u0431\u043e\u043b\u044c\u0448\u0435\u00bb.<\/p>\n<h4>\u0417\u0430\u0449\u0438\u0442\u0430 \u0447\u0435\u0440\u0435\u0437 MeterFilter<\/h4>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0421\u0435\u0440\u0451\u0433\u0438\u043d\u043e\u0439 \u0438\u0441\u043f\u043e\u0432\u0435\u0434\u0438 \u043c\u044b \u043f\u043e\u0441\u0442\u0430\u0432\u0438\u043b\u0438 \u043f\u0440\u0435\u0434\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u0435\u043b\u0438. \u041b\u044e\u0434\u044f\u043c \u043d\u0430\u0434\u043e \u0434\u043e\u0432\u0435\u0440\u044f\u0442\u044c. \u041d\u043e \u0432 \u044d\u0442\u043e\u043c \u0433\u043e\u0440\u043e\u0434\u0435 \u0434\u043e\u0432\u0435\u0440\u0438\u0435 \u043e\u0444\u043e\u0440\u043c\u043b\u044f\u044e\u0442 \u043f\u0438\u0441\u044c\u043c\u0435\u043d\u043d\u043e.<\/p>\n<pre><code class=\"java\">\/\/ \u0412\u043d\u0438\u043c\u0430\u043d\u0438\u0435: \u043f\u043e\u0441\u043b\u0435 \u0441\u043e\u0442\u043e\u0433\u043e \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u043e\u0433\u043e uri \u043d\u043e\u0432\u044b\u0435 \u043c\u0435\u0442\u0440\u0438\u043a\u0438 \u0431\u0443\u0434\u0443\u0442 \u041c\u041e\u041b\u0427\u0410\/\/ \u043e\u0442\u0431\u0440\u043e\u0448\u0435\u043d\u044b. \u042d\u0442\u043e \u0441\u0442\u0440\u0430\u0445\u043e\u0432\u043a\u0430 \u043e\u0442 \u0432\u0437\u0440\u044b\u0432\u0430, \u0430 \u043d\u0435 \u043d\u043e\u0440\u043c\u0430 \u0436\u0438\u0437\u043d\u0438: \u0435\u0441\u043b\u0438 \u043b\u0438\u043c\u0438\u0442\/\/ \u0441\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442 - \u0437\u043d\u0430\u0447\u0438\u0442, \u0432 uri \u043f\u043e\u043f\u0430\u0434\u0430\u0435\u0442 \u0447\u0442\u043e-\u0442\u043e \u0432\u044b\u0441\u043e\u043a\u043e\u043a\u0430\u0440\u0434\u0438\u043d\u0430\u043b\u044c\u043d\u043e\u0435,\/\/ \u0438 \u0447\u0438\u043d\u0438\u0442\u044c \u043d\u0443\u0436\u043d\u043e \u043f\u0440\u0438\u0447\u0438\u043d\u0443, \u0430 \u043d\u0435 \u043f\u043e\u0434\u043d\u0438\u043c\u0430\u0442\u044c \u043b\u0438\u043c\u0438\u0442.@Beanpublic MeterFilter cardinalityLimiter() {    return MeterFilter.maximumAllowableTags(        \"http.server.requests\", \"uri\", 100,         MeterFilter.deny()    );}@Beanpublic MeterFilter denyHighCardinality() {    return new MeterFilter() {        @Override        public MeterFilterReply accept(Meter.Id id) {            if (id.getTag(\"user_id\") != null || id.getTag(\"request_id\") != null) {                log.warn(\"Blocked high-cardinality tag: {}\", id);                return MeterFilterReply.DENY;            }            return MeterFilterReply.NEUTRAL;        }    };}<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<h4>Gauge \u0441 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u043c \u043a \u0411\u0414<\/h4>\n<pre><code class=\"java\">\/\/ \u041f\u043b\u043e\u0445\u043e: \u0437\u0430\u043f\u0440\u043e\u0441 \u043a\u0430\u0436\u0434\u044b\u0435 15 \u0441\u0435\u043a\u0443\u043d\u0434Gauge.builder(\"tasks.count\", () -&gt; taskRepository.count())    .register(meterRegistry);\/\/ \u0425\u043e\u0440\u043e\u0448\u043e: \u043a\u044d\u0448\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435private final AtomicLong taskCount = new AtomicLong();Gauge.builder(\"tasks.count\", taskCount, AtomicLong::get)    .register(meterRegistry);\/\/ \u041e\u0431\u043d\u043e\u0432\u043b\u044f\u0435\u043c \u043f\u0440\u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f\u0445public void createTask(...) {    taskCount.incrementAndGet();}<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p>\u041f\u0435\u0440\u0432\u044b\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 &#8212; \u0437\u0430\u043f\u0440\u043e\u0441 \u043a \u0411\u0414 \u043a\u0430\u0436\u0434\u044b\u0435 15 \u0441\u0435\u043a\u0443\u043d\u0434. \u041c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u043d\u0433, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u0442 \u0441\u0438\u0441\u0442\u0435\u043c\u0443, &#8212; \u044d\u0442\u043e \u043f\u043e\u0436\u0430\u0440\u043d\u044b\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u0434\u0436\u0438\u0433\u0430\u0435\u0442 \u0437\u0434\u0430\u043d\u0438\u0435, \u0447\u0442\u043e\u0431\u044b \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u0441\u0438\u0433\u043d\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e.<\/p>\n<h4>\u041e\u0442\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u043d\u0435\u043d\u0443\u0436\u043d\u043e\u0433\u043e<\/h4>\n<pre><code class=\"java\">@Beanpublic MeterFilter disableUnneeded() {    return MeterFilter.deny(id -&gt; {        String name = id.getName();        return name.startsWith(\"jvm.memory.pool\") ||               name.startsWith(\"jvm.buffer\") ||               name.contains(\"logback\");    });}<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p>\u041d\u0435 \u0432\u0441\u0451, \u0447\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0434\u0441\u043b\u0443\u0448\u0430\u0442\u044c, \u043d\u0443\u0436\u043d\u043e \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c. \u041c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u043d\u0433 &#8212; \u043d\u0435 \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435. \u0421\u043e\u0431\u0438\u0440\u0430\u0439\u0442\u0435 \u0442\u043e, \u043d\u0430 \u0447\u0442\u043e \u0431\u0443\u0434\u0435\u0442\u0435 \u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c. \u041e\u0441\u0442\u0430\u043b\u044c\u043d\u043e\u0435 &#8212; \u043c\u0430\u043a\u0443\u043b\u0430\u0442\u0443\u0440\u0430.<\/p>\n<hr\/>\n<h3>\u042d\u043f\u0438\u0437\u043e\u0434 13. \u041a\u043e\u0434\u0435\u043a\u0441: \u0447\u0442\u043e \u043e\u0442\u043b\u0438\u0447\u0430\u0435\u0442 \u0434\u0435\u0442\u0435\u043a\u0442\u0438\u0432\u0430 \u043e\u0442 \u0447\u0435\u043b\u043e\u0432\u0435\u043a\u0430 \u0441 \u043b\u0443\u043f\u043e\u0439<\/h3>\n<h4>\u0418\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u0435 \u043c\u0435\u0442\u0440\u0438\u043a<\/h4>\n<div>\n<div class=\"table\">\n<table>\n<tbody>\n<tr>\n<th>\n<p align=\"left\">\u041f\u0440\u0430\u0432\u0438\u043b\u043e<\/p>\n<\/th>\n<th>\n<p align=\"left\">\u0418\u043c\u044f meter\u2019\u0430 \u0432 \u043a\u043e\u0434\u0435<\/p>\n<\/th>\n<th>\n<p align=\"left\">\u041c\u0435\u0442\u0440\u0438\u043a\u0430 \u0432 Prometheus<\/p>\n<\/th>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">snake_case (\u0447\u0435\u0440\u0435\u0437 \u0442\u043e\u0447\u043a\u0438)<\/p>\n<\/td>\n<td>\n<p align=\"left\"><code>http.requests<\/code><\/p>\n<\/td>\n<td>\n<p align=\"left\"><code>http_requests_total<\/code><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">Counter &#8212; \u0411\u0415\u0417 <code>_total<\/code> \u0432 \u0438\u043c\u0435\u043d\u0438<\/p>\n<\/td>\n<td>\n<p align=\"left\"><code>orders.created<\/code><\/p>\n<\/td>\n<td>\n<p align=\"left\"><code>orders_created_total<\/code><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\"><code>_seconds<\/code> \u0434\u043b\u044f \u0432\u0440\u0435\u043c\u0435\u043d\u0438<\/p>\n<\/td>\n<td>\n<p align=\"left\"><code>request.duration<\/code> (Timer)<\/p>\n<\/td>\n<td>\n<p align=\"left\"><code>request_duration_seconds<\/code><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\"><code>_bytes<\/code> \u0434\u043b\u044f \u0440\u0430\u0437\u043c\u0435\u0440\u0430<\/p>\n<\/td>\n<td>\n<p align=\"left\"><code>response.size<\/code><\/p>\n<\/td>\n<td>\n<p align=\"left\"><code>response_size_bytes<\/code><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">\u0411\u0435\u0437 \u0441\u0443\u0444\u0444\u0438\u043a\u0441\u0430 \u0434\u043b\u044f Gauge<\/p>\n<\/td>\n<td>\n<p align=\"left\"><code>active.users<\/code><\/p>\n<\/td>\n<td>\n<p align=\"left\"><code>active_users<\/code><\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<p><strong>\u0413\u043b\u0430\u0432\u043d\u0430\u044f \u043b\u043e\u0432\u0443\u0448\u043a\u0430 \u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u044f \u0432 Micrometer.<\/strong> \u041c\u044b \u0432 \u043d\u0435\u0451 \u043d\u0430\u0441\u0442\u0443\u043f\u0438\u043b\u0438, \u044f \u043e\u0431\u0435\u0449\u0430\u043b \u0432\u0435\u0441\u0442\u0438 \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b \u0447\u0435\u0441\u0442\u043d\u043e. \u0421\u0443\u0444\u0444\u0438\u043a\u0441 <code>_total<\/code> \u0434\u043b\u044f \u0441\u0447\u0451\u0442\u0447\u0438\u043a\u043e\u0432 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u0430\u043c Micrometer, \u0432 \u0438\u043c\u044f \u0435\u0433\u043e \u043f\u0438\u0441\u0430\u0442\u044c \u041d\u0415 \u043d\u0443\u0436\u043d\u043e. \u0414\u0430\u043d\u044f \u043d\u0430\u0437\u0432\u0430\u043b \u0441\u0447\u0451\u0442\u0447\u0438\u043a <code>orders.created.total<\/code>, \u0438 \u0432 Prometheus \u0432\u044b\u0448\u043b\u043e <code>orders_created_total_total<\/code>. \u0414\u0432\u0430\u0436\u0434\u044b. \u0418 \u0432\u0441\u0435 recording rules, \u0430\u043b\u0435\u0440\u0442\u044b \u0438 \u043f\u0430\u043d\u0435\u043b\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0438\u0441\u043a\u0430\u043b\u0438 <code>orders_created_total<\/code>, \u043d\u0430\u0448\u043b\u0438 \u043f\u0443\u0441\u0442\u043e\u0442\u0443. \u0413\u0440\u0430\u0444\u0438\u043a \u0440\u043e\u0432\u043d\u044b\u0439. \u041f\u043e\u043b\u0434\u043d\u044f \u0434\u0443\u043c\u0430\u043b\u0438, \u0447\u0442\u043e \u0431\u0438\u0437\u043d\u0435\u0441 \u0432\u0441\u0442\u0430\u043b, \u0430 \u0431\u0438\u0437\u043d\u0435\u0441 \u0440\u0430\u0431\u043e\u0442\u0430\u043b.<\/p>\n<p>\u0412 \u0434\u0435\u043c\u043e-\u043f\u0440\u043e\u0435\u043a\u0442\u0435 \u0442\u0435\u043f\u0435\u0440\u044c \u0436\u0438\u0432\u0451\u0442 \u0442\u0435\u0441\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442 \u0438\u043c\u0435\u043d\u043d\u043e \u044d\u0442\u043e: \u0447\u0442\u043e \u043c\u0435\u0442\u0440\u0438\u043a\u0438 \u044d\u043a\u0441\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u044e\u0442\u0441\u044f \u043f\u043e\u0434 \u043e\u0436\u0438\u0434\u0430\u0435\u043c\u044b\u043c\u0438 \u0438\u043c\u0435\u043d\u0430\u043c\u0438 \u0438 \u0431\u0435\u0437 \u0437\u0430\u0434\u0432\u043e\u0435\u043d\u043d\u043e\u0433\u043e \u0441\u0443\u0444\u0444\u0438\u043a\u0441\u0430. \u0421\u043c\u0435\u0448\u043d\u043e? \u0410 \u0432\u044b \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0439\u0442\u0435 \u043f\u043e\u043b\u0434\u043d\u044f \u0440\u0430\u0437\u044b\u0441\u043a\u0438\u0432\u0430\u0442\u044c \u0437\u0430\u043a\u0430\u0437\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0438\u043a\u0443\u0434\u0430 \u043d\u0435 \u043f\u0440\u043e\u043f\u0430\u0434\u0430\u043b\u0438. \u041f\u0435\u0440\u0435\u0441\u0442\u0430\u0451\u0442 \u0431\u044b\u0442\u044c \u0441\u043c\u0435\u0448\u043d\u043e. \u0421\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u0442\u0435\u0441\u0442\u043e\u043c.<\/p>\n<p>\u0421\u043e\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u044f &#8212; \u0432\u0435\u0449\u044c \u0441\u043a\u0443\u0447\u043d\u0430\u044f. \u041d\u043e \u0431\u0435\u0437 \u043d\u0438\u0445 \u0447\u0435\u0440\u0435\u0437 \u043f\u043e\u043b\u0433\u043e\u0434\u0430 \u0432\u044b \u0441\u0430\u043c\u0438 \u043d\u0435 \u043e\u043f\u043e\u0437\u043d\u0430\u0435\u0442\u0435, \u0447\u0442\u043e \u0437\u0430 \u0444\u0438\u0433\u0443\u0440\u0430\u043d\u0442 \u044d\u0442\u043e\u0442 <code>reqDurMs<\/code> \u0438 \u043f\u043e \u043a\u0430\u043a\u043e\u043c\u0443 \u0434\u0435\u043b\u0443 \u043f\u0440\u043e\u0445\u043e\u0434\u0438\u0442. \u0410 <code>request_duration_seconds<\/code> \u0447\u0438\u0442\u0430\u0435\u0442\u0441\u044f \u0441\u0445\u043e\u0434\u0443.<\/p>\n<h4>Thread Safety<\/h4>\n<pre><code class=\"java\">\/\/ \u041f\u043b\u043e\u0445\u043e - race conditionprivate int activeUsers;\/\/ \u0425\u043e\u0440\u043e\u0448\u043eprivate final AtomicInteger activeUsers = new AtomicInteger();\/\/ \u0414\u043b\u044f high-contentionprivate final LongAdder requestCount = new LongAdder();<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<h4>\u0411\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u044c Actuator<\/h4>\n<pre><code class=\"java\">@Configuration@EnableWebSecuritypublic class SecurityConfig {    @Bean    @Order(1)    public SecurityFilterChain actuatorSecurity(HttpSecurity http) throws Exception {        http            .securityMatcher(\"\/actuator\/**\")            .authorizeHttpRequests(auth -&gt; auth                .requestMatchers(\"\/actuator\/health\").permitAll()                .requestMatchers(\"\/actuator\/info\").permitAll()                .requestMatchers(\"\/actuator\/prometheus\").hasRole(\"METRICS\")                .requestMatchers(\"\/actuator\/**\").hasRole(\"ADMIN\")            )            .httpBasic(Customizer.withDefaults());        return http.build();    }    @Bean    @Order(2)    public SecurityFilterChain apiSecurity(HttpSecurity http) throws Exception {        http            .securityMatcher(\"\/api\/**\")            .authorizeHttpRequests(auth -&gt; auth                .anyRequest().hasRole(\"USER\")            )            .httpBasic(Customizer.withDefaults())            .csrf(csrf -&gt; csrf.disable());        return http.build();    }    @Bean    public InMemoryUserDetailsManager userDetailsService(PasswordEncoder passwordEncoder) {        UserDetails user = User.builder()            .username(\"user\")            .password(passwordEncoder.encode(\"user\"))            .roles(\"USER\")            .build();                UserDetails prometheus = User.builder()            .username(\"prometheus\")            .password(passwordEncoder.encode(\"prometheus\"))            .roles(\"METRICS\")            .build();                UserDetails admin = User.builder()            .username(\"admin\")            .password(passwordEncoder.encode(\"admin\"))            .roles(\"ADMIN\", \"METRICS\", \"USER\")            .build();                return new InMemoryUserDetailsManager(user, prometheus, admin);    }    @Bean    public PasswordEncoder passwordEncoder() {        return new BCryptPasswordEncoder();    }}<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p><code>\/actuator\/health<\/code> \u043e\u0442\u043a\u0440\u044b\u0442 \u0434\u043b\u044f \u0432\u0441\u0435\u0445: load balancer \u0434\u043e\u043b\u0436\u0435\u043d \u0437\u043d\u0430\u0442\u044c, \u0436\u0438\u0432\u043e \u043b\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435. <code>\/actuator\/prometheus<\/code> &#8212; \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f Prometheus, \u043f\u043e \u043f\u0440\u043e\u043f\u0443\u0441\u043a\u0443. \u0412\u0441\u0451 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u043e\u0435 &#8212; \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u0430\u0434\u043c\u0438\u043d\u0430. \u0418 \u043d\u0435 \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u0439\u0442\u0435 \u0432 <code>exposure.include<\/code> \u044d\u043d\u0434\u043f\u043e\u0438\u043d\u0442\u044b \u00ab\u043d\u0430 \u0432\u0441\u044f\u043a\u0438\u0439 \u0441\u043b\u0443\u0447\u0430\u0439\u00bb: \u0432 <code>\/actuator\/env<\/code> \u043c\u043e\u0433\u0443\u0442 \u043b\u0435\u0436\u0430\u0442\u044c \u043f\u0430\u0440\u043e\u043b\u0438. \u0410 \u043f\u0430\u0440\u043e\u043b\u0438 \u0432 \u044d\u0442\u043e\u043c \u0433\u043e\u0440\u043e\u0434\u0435 &#8212; \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0435, \u0447\u0442\u043e \u0435\u0449\u0451 \u0441\u0442\u043e\u0438\u0442 \u0431\u0435\u0440\u0435\u0447\u044c.<\/p>\n<p>\u0418 \u0447\u0435\u0441\u0442\u043d\u0430\u044f \u043e\u0433\u043e\u0432\u043e\u0440\u043a\u0430 \u043f\u0440\u043e \u0446\u0435\u043d\u0443 \u043e\u0445\u0440\u0430\u043d\u044b. Basic auth \u0441 BCrypt &#8212; \u044d\u0442\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u043f\u0430\u0440\u043e\u043b\u044f \u043d\u0430 <strong>\u043a\u0430\u0436\u0434\u044b\u0439<\/strong> scrape. BCrypt \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u044b\u0439 \u043d\u0430\u043c\u0435\u0440\u0435\u043d\u043d\u043e, \u0442\u0430\u043a\u0430\u044f \u0443 \u043d\u0435\u0433\u043e \u043f\u0440\u043e\u0444\u0435\u0441\u0441\u0438\u044f: \u0434\u0435\u0441\u044f\u0442\u043a\u0438 \u043c\u0438\u043b\u043b\u0438\u0441\u0435\u043a\u0443\u043d\u0434 CPU \u043d\u0430 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0443. \u0421\u043a\u0440\u0435\u0439\u043f\u0438\u0442\u0435 \u043a\u0430\u0436\u0434\u044b\u0435 5 \u0441\u0435\u043a\u0443\u043d\u0434 &#8212; \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0435 \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u044b\u0439 \u0444\u043e\u043d\u043e\u0432\u044b\u0439 \u043d\u0430\u043b\u043e\u0433, \u0438 \u043e\u043d \u0436\u0435 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043a \u043b\u0430\u0442\u0435\u043d\u0442\u043d\u043e\u0441\u0442\u0438 \u044d\u043d\u0434\u043f\u043e\u0438\u043d\u0442\u0430 \u043c\u0435\u0442\u0440\u0438\u043a. \u0414\u043b\u044f \u0434\u0435\u043c\u043e \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e. \u0414\u043b\u044f production \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u0442\u0435 \u0432 \u0441\u0442\u043e\u0440\u043e\u043d\u0443 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0433\u043e management-\u043f\u043e\u0440\u0442\u0430 (<code>management.server.port<\/code>), \u0437\u0430\u043a\u0440\u044b\u0442\u043e\u0433\u043e \u043d\u0430 \u0441\u0435\u0442\u0435\u0432\u043e\u043c \u0443\u0440\u043e\u0432\u043d\u0435, \u0438\u043b\u0438 mTLS. \u041f\u0443\u0441\u0442\u044c \u0436\u0435\u043b\u0435\u0437\u043e \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u0442\u0441\u044f \u0434\u0435\u043b\u043e\u043c, \u0430 \u043d\u0435 \u0441\u0432\u0435\u0440\u044f\u0435\u0442 \u043e\u0434\u0438\u043d \u0438 \u0442\u043e\u0442 \u0436\u0435 \u043f\u0440\u043e\u043f\u0443\u0441\u043a \u0434\u0432\u0435\u043d\u0430\u0434\u0446\u0430\u0442\u044c \u0440\u0430\u0437 \u0432 \u043c\u0438\u043d\u0443\u0442\u0443.<\/p>\n<hr\/>\n<h3>\u042d\u043f\u0438\u0437\u043e\u0434 14. \u041f\u0435\u0440\u0435\u0434 \u0432\u044b\u0445\u043e\u0434\u043e\u043c \u043d\u0430 \u0434\u0435\u0436\u0443\u0440\u0441\u0442\u0432\u043e: Production Checklist<\/h3>\n<h4>Retention Policy<\/h4>\n<pre><code class=\"yaml\">prometheus:  command:    # 31 \u0434\u0435\u043d\u044c - \u043c\u0438\u043d\u0438\u043c\u0443\u043c, \u043f\u0440\u0438 \u043a\u043e\u0442\u043e\u0440\u043e\u043c 30-\u0434\u043d\u0435\u0432\u043d\u043e\u0435 \u043e\u043a\u043d\u043e SLO \u0438\u043c\u0435\u0435\u0442 \u0434\u0430\u043d\u043d\u044b\u0435    - '--storage.tsdb.retention.time=31d'    - '--storage.tsdb.retention.size=10GB'<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p>\u0421\u0447\u0438\u0442\u0430\u0435\u0442\u0435 SLO \u043f\u043e 30-\u0434\u043d\u0435\u0432\u043d\u043e\u043c\u0443 \u043e\u043a\u043d\u0443 &#8212; \u0434\u0435\u0440\u0436\u0438\u0442\u0435 retention \u0445\u043e\u0442\u044f \u0431\u044b 31 \u0434\u0435\u043d\u044c, \u0438\u043d\u0430\u0447\u0435 \u0431\u044e\u0434\u0436\u0435\u0442 \u043e\u0448\u0438\u0431\u043e\u043a \u0431\u0443\u0434\u0435\u0442 \u0441\u0447\u0438\u0442\u0430\u0442\u044c\u0441\u044f \u043f\u043e \u043d\u0435\u043f\u043e\u043b\u043d\u043e\u043c\u0443 \u0434\u0435\u043b\u0443. \u0411\u0435\u0437 SLO \u0445\u0432\u0430\u0442\u0438\u0442 \u0438 15 \u0434\u043d\u0435\u0439 \u0434\u043b\u044f \u043e\u043f\u0435\u0440\u0430\u0442\u0438\u0432\u043d\u043e\u0439 \u0440\u0430\u0431\u043e\u0442\u044b. \u0414\u043b\u044f \u0434\u043e\u043b\u0433\u043e\u0441\u0440\u043e\u0447\u043d\u043e\u0433\u043e \u0430\u0440\u0445\u0438\u0432\u0430 &#8212; Thanos, Cortex, Mimir. \u0425\u0440\u0430\u043d\u0438\u0442\u044c \u043c\u0435\u0442\u0440\u0438\u043a\u0438 \u0437\u0430 \u0433\u043e\u0434 \u0432 Prometheus \u043c\u043e\u0436\u043d\u043e, \u043d\u043e \u043d\u0435 \u043d\u0443\u0436\u043d\u043e.<\/p>\n<h4>Backup \u0434\u0430\u0448\u0431\u043e\u0440\u0434\u043e\u0432<\/h4>\n<pre><code class=\"bash\">#!\/bin\/bashGRAFANA_URL=\"http:\/\/localhost:3000\"API_KEY=\"your-api-key\"dashboards=$(curl -s -H \"Authorization: Bearer $API_KEY\" \\  \"$GRAFANA_URL\/api\/search?type=dash-db\" | jq -r '.[].uid')for uid in $dashboards; do  curl -s -H \"Authorization: Bearer $API_KEY\" \\    \"$GRAFANA_URL\/api\/dashboards\/uid\/$uid\" \\    &gt; \"backup\/dashboard-$uid.json\"done<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<h4>\u041c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u043d\u0433 \u043c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u043d\u0433\u0430<\/h4>\n<p>\u0414\u0430. \u0421\u0442\u043e\u0440\u043e\u0436 \u0442\u043e\u0436\u0435 \u0441\u043c\u0435\u0440\u0442\u0435\u043d. \u0418 \u0435\u0441\u043b\u0438 \u043e\u043d \u0443\u043f\u0430\u0434\u0451\u0442, \u0432\u044b \u043d\u0435 \u0443\u0437\u043d\u0430\u0435\u0442\u0435: \u0437\u0432\u043e\u043d\u0438\u0442\u044c \u043e \u0435\u0433\u043e \u043f\u0430\u0434\u0435\u043d\u0438\u0438 \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u043b \u043e\u043d \u0441\u0430\u043c. \u0420\u0435\u043a\u0443\u0440\u0441\u0438\u044f. \u0421\u0442\u0430\u0440\u044b\u0439 \u0432\u043e\u043f\u0440\u043e\u0441 \u00ab\u043a\u0442\u043e \u0441\u0442\u043e\u0440\u043e\u0436\u0438\u0442 \u0441\u0442\u043e\u0440\u043e\u0436\u0435\u0439?\u00bb \u0432 \u044d\u0442\u043e\u043c \u0433\u043e\u0440\u043e\u0434\u0435 \u0438\u043c\u0435\u0435\u0442 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u0439 \u043e\u0442\u0432\u0435\u0442: \u0432\u0442\u043e\u0440\u043e\u0439 \u0441\u0442\u043e\u0440\u043e\u0436.<\/p>\n<pre><code class=\"yaml\">- alert: PrometheusDown  expr: up{job=\"prometheus\"} == 0  for: 1m  labels:    severity: critical- alert: GrafanaDown    expr: up{job=\"grafana\"} == 0  for: 1m  labels:    severity: critical<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p>\u0414\u043b\u044f \u043f\u043e\u043b\u043d\u043e\u0439 \u0443\u0432\u0435\u0440\u0435\u043d\u043d\u043e\u0441\u0442\u0438 &#8212; external monitoring. Uptime Robot, Pingdom. \u041a\u0442\u043e-\u0442\u043e \u0441\u043d\u0430\u0440\u0443\u0436\u0438 \u0434\u043e\u043b\u0436\u0435\u043d \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0442\u044c \u0442\u0435\u0445, \u043a\u0442\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442.<\/p>\n<h4>Runbooks<\/h4>\n<p>\u041a\u0430\u0436\u0434\u044b\u0439 \u0430\u043b\u0435\u0440\u0442 &#8212; \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 runbook.<\/p>\n<pre><code class=\"yaml\">annotations:  runbook_url: \"https:\/\/wiki.example.com\/runbooks\/high-heap\"<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p>Runbook &#8212; \u044d\u0442\u043e \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f \u0434\u043b\u044f \u0434\u0435\u0436\u0443\u0440\u043d\u043e\u0433\u043e \u0432 \u0442\u0440\u0438 \u0447\u0430\u0441\u0430 \u043d\u043e\u0447\u0438. \u0414\u043b\u044f \u0447\u0435\u043b\u043e\u0432\u0435\u043a\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u043e\u0441\u043d\u0443\u043b\u0441\u044f, \u043f\u043b\u043e\u0445\u043e \u0441\u043e\u043e\u0431\u0440\u0430\u0436\u0430\u0435\u0442 \u0438 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0432\u0430\u0441 \u043d\u0435\u043d\u0430\u0432\u0438\u0434\u0438\u0442. \u041f\u0438\u0448\u0438\u0442\u0435 \u0442\u0430\u043a, \u0447\u0442\u043e\u0431\u044b \u043e\u043d \u043f\u043e\u043d\u044f\u043b \u0441 \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u0440\u0430\u0437\u0430. \u0410 \u043f\u0438\u0448\u0435\u0442\u0435 \u0432\u044b \u0435\u0433\u043e, \u043c\u0435\u0436\u0434\u0443 \u043f\u0440\u043e\u0447\u0438\u043c, \u0441\u0435\u0431\u0435: \u0447\u0435\u0440\u0435\u0437 \u043f\u043e\u043b\u0433\u043e\u0434\u0430 \u044d\u0442\u0438\u043c \u0434\u0435\u0436\u0443\u0440\u043d\u044b\u043c \u0431\u0443\u0434\u0435\u0442\u0435 \u0432\u044b.<\/p>\n<p>\u0421\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430:<\/p>\n<ol>\n<li>\n<p>\u0427\u0442\u043e \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442 \u0430\u043b\u0435\u0440\u0442<\/p>\n<\/li>\n<li>\n<p>\u041a\u0430\u043a \u0434\u0438\u0430\u0433\u043d\u043e\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c<\/p>\n<\/li>\n<li>\n<p>\u041a\u0440\u0430\u0442\u043a\u043e\u0441\u0440\u043e\u0447\u043d\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435<\/p>\n<\/li>\n<li>\n<p>\u0414\u043e\u043b\u0433\u043e\u0441\u0440\u043e\u0447\u043d\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435<\/p>\n<\/li>\n<li>\n<p>\u041a\u043e\u043c\u0443 \u0437\u0432\u043e\u043d\u0438\u0442\u044c, \u0435\u0441\u043b\u0438 \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u043f\u043e\u043c\u043e\u0433\u043b\u043e<\/p>\n<\/li>\n<\/ol>\n<h4>\u0427\u0435\u043a\u043b\u0438\u0441\u0442<\/h4>\n<p>\u041a\u0430\u043f\u0438\u0442\u0430\u043d \u041b\u0451\u0448\u0430 \u0440\u0430\u0441\u043f\u0435\u0447\u0430\u0442\u0430\u043b \u0435\u0433\u043e \u0438 \u043f\u043e\u0432\u0435\u0441\u0438\u043b \u043d\u0430\u0434 \u0441\u0442\u043e\u043b\u043e\u043c. \u0420\u044f\u0434\u043e\u043c \u0441 \u0444\u043e\u0442\u043e\u0433\u0440\u0430\u0444\u0438\u0435\u0439 \u0442\u043e\u0439 \u0441\u0430\u043c\u043e\u0439 JVM. \u0427\u0442\u043e\u0431\u044b \u043f\u043e\u043c\u043d\u0438\u0442\u044c.<\/p>\n<ul>\n<li>\n<p>[ ] Actuator endpoints \u0437\u0430\u0449\u0438\u0449\u0435\u043d\u044b<\/p>\n<\/li>\n<li>\n<p>[ ] Prometheus scrape \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 (Targets)<\/p>\n<\/li>\n<li>\n<p>[ ] Grafana datasource \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043d<\/p>\n<\/li>\n<li>\n<p>[ ] Grafana provisioning \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043d (\u0434\u0430\u0448\u0431\u043e\u0440\u0434\u044b \u0432 Git)<\/p>\n<\/li>\n<li>\n<p>[ ] \u0414\u0430\u0448\u0431\u043e\u0440\u0434\u044b \u0441\u043e\u0437\u0434\u0430\u043d\u044b<\/p>\n<\/li>\n<li>\n<p>[ ] Recording rules \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043d\u044b<\/p>\n<\/li>\n<li>\n<p>[ ] Alert rules \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043d\u044b (heap, errors, app down)<\/p>\n<\/li>\n<li>\n<p>[ ] Inhibition rules \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043d\u044b (\u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u0435\u043d\u044b! \u043f\u043e\u043c\u043d\u0438\u0442\u0435 \u043f\u0440\u043e equal)<\/p>\n<\/li>\n<li>\n<p>[ ] Contact points \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 (\u0442\u0435\u0441\u0442\u043e\u0432\u044b\u0439 \u0430\u043b\u0435\u0440\u0442)<\/p>\n<\/li>\n<li>\n<p>[ ] SLO\/SLI \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u044b<\/p>\n<\/li>\n<li>\n<p>[ ] Error Budget \u043c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u0442\u0441\u044f<\/p>\n<\/li>\n<li>\n<p>[ ] Retention policy \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043d<\/p>\n<\/li>\n<li>\n<p>[ ] \u0411\u044d\u043a\u0430\u043f\u044b \u0434\u0430\u0448\u0431\u043e\u0440\u0434\u043e\u0432 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u044b<\/p>\n<\/li>\n<li>\n<p>[ ] Runbooks \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u044b<\/p>\n<\/li>\n<\/ul>\n<p>\u041f\u0440\u043e\u0439\u0434\u0438\u0442\u0435\u0441\u044c \u043f\u043e \u0441\u043f\u0438\u0441\u043a\u0443. \u041a\u0430\u0436\u0434\u044b\u0439 \u043f\u0440\u043e\u043f\u0443\u0449\u0435\u043d\u043d\u044b\u0439 \u043f\u0443\u043d\u043a\u0442 \u0440\u0430\u043d\u043e \u0438\u043b\u0438 \u043f\u043e\u0437\u0434\u043d\u043e \u043e\u0431\u0435\u0440\u043d\u0451\u0442\u0441\u044f \u043d\u043e\u0447\u043d\u044b\u043c \u0437\u0432\u043e\u043d\u043a\u043e\u043c, \u0438, \u043f\u043e \u0437\u0430\u043a\u043e\u043d\u0443 \u0436\u0430\u043d\u0440\u0430, \u0432 \u0441\u0430\u043c\u044b\u0439 \u043d\u0435\u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0449\u0438\u0439 \u043c\u043e\u043c\u0435\u043d\u0442.<\/p>\n<hr\/>\n<h3>\u042d\u043f\u0438\u043b\u043e\u0433. \u0421\u043d\u043e\u0432\u0430 \u0432\u043e\u0441\u043a\u0440\u0435\u0441\u0435\u043d\u044c\u0435<\/h3>\n<p>\u041f\u0440\u043e\u0448\u043b\u043e \u0434\u0432\u0430 \u043c\u0435\u0441\u044f\u0446\u0430. \u0412\u043e\u0441\u043a\u0440\u0435\u0441\u0435\u043d\u044c\u0435, \u0432\u043e\u0441\u0435\u043c\u044c \u0432\u0435\u0447\u0435\u0440\u0430. \u0414\u043e\u0436\u0434\u044c \u0442\u043e\u0442 \u0436\u0435. \u0413\u043e\u0440\u044f\u0447\u0438\u0439 \u0443\u0436\u0438\u043d. \u0417\u0430\u0437\u0432\u043e\u043d\u0438\u043b \u0442\u0435\u043b\u0435\u0444\u043e\u043d. \u041b\u0451\u0448\u0430.<\/p>\n<p>\u0421\u0435\u0440\u0434\u0446\u0435 \u0451\u043a\u043d\u0443\u043b\u043e \u043f\u043e \u0441\u0442\u0430\u0440\u043e\u0439 \u043f\u0430\u043c\u044f\u0442\u0438. \u0420\u0435\u0444\u043b\u0435\u043a\u0441\u044b \u0432 \u043d\u0430\u0448\u0435\u043c \u0434\u0435\u043b\u0435 \u0443\u0445\u043e\u0434\u044f\u0442 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u043c\u0438.<\/p>\n<p>\u2014 \u0412\u0438\u0434\u0435\u043b \u0430\u043b\u0435\u0440\u0442? \u2014 \u0441\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u0435\u0442 \u041b\u0451\u0448\u0430. \u2014 \u0412\u0438\u0434\u0435\u043b. HighHeapUsage, warning, \u0440\u043e\u0441\u0442 \u0441\u043e \u0432\u0442\u043e\u0440\u043d\u0438\u043a\u0430. \u2014 \u0423\u0442\u0435\u0447\u043a\u0430? \u2014 \u041f\u043e\u0445\u043e\u0436\u0435. \u042f \u0443\u0436\u0435 \u0433\u043b\u044f\u043d\u0443\u043b \u0434\u043e\u0441\u043a\u0443: Metaspace \u0441\u0442\u0430\u0431\u0438\u043b\u0435\u043d, \u0440\u0430\u0441\u0442\u0451\u0442 Old Gen. \u0417\u0430\u0432\u0442\u0440\u0430 \u0441 \u0443\u0442\u0440\u0430 \u0432\u043e\u0437\u044c\u043c\u0443 heap dump \u0438 \u043f\u0440\u043e\u0432\u0435\u0434\u0443 \u043e\u043f\u043e\u0437\u043d\u0430\u043d\u0438\u0435. \u2014 \u0422\u043e \u0435\u0441\u0442\u044c\u2026 \u0441\u0435\u0433\u043e\u0434\u043d\u044f \u043d\u0438\u0447\u0435\u0433\u043e \u0434\u0435\u043b\u0430\u0442\u044c \u043d\u0435 \u043d\u0430\u0434\u043e? \u2014 \u0421\u0435\u0433\u043e\u0434\u043d\u044f \u043d\u0438\u0447\u0435\u0433\u043e \u0434\u0435\u043b\u0430\u0442\u044c \u043d\u0435 \u043d\u0430\u0434\u043e. \u0414\u043e 95% \u0435\u043c\u0443 \u0435\u0449\u0451 \u0434\u043d\u0435\u0439 \u043f\u044f\u0442\u044c. \u0412\u0437\u044f\u043b\u0438 \u043d\u0430 \u043f\u043e\u0434\u0445\u043e\u0434\u0435. \u2014 \u0421\u043b\u0443\u0448\u0430\u0439, \u2014 \u0433\u043e\u0432\u043e\u0440\u0438\u0442 \u041b\u0451\u0448\u0430, \u0438 \u044f \u0441\u043b\u044b\u0448\u0443, \u043a\u0430\u043a \u043e\u043d \u0443\u043b\u044b\u0431\u0430\u0435\u0442\u0441\u044f. \u2014 \u0410 \u0432\u0435\u0434\u044c \u0440\u0430\u043d\u044c\u0448\u0435 \u043c\u044b \u0431\u044b \u0443\u0437\u043d\u0430\u043b\u0438 \u043e\u0431 \u044d\u0442\u043e\u043c \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435 \u0432\u043e\u0441\u043a\u0440\u0435\u0441\u0435\u043d\u044c\u0435. \u0412 \u0440\u0430\u0439\u043e\u043d\u0435 \u043f\u043e\u043b\u0443\u043d\u043e\u0447\u0438. \u041e\u0442 \u043c\u044d\u0440\u0430. \u2014 \u0420\u0430\u043d\u044c\u0448\u0435 \u2014 \u0434\u0430.<\/p>\n<p>\u042f \u043f\u043e\u0432\u0435\u0441\u0438\u043b \u0442\u0440\u0443\u0431\u043a\u0443 \u0438 \u0434\u043e\u0435\u043b \u0443\u0436\u0438\u043d. \u0413\u043e\u0440\u044f\u0447\u0438\u0439, \u043f\u0440\u043e\u0448\u0443 \u0437\u0430\u043d\u0435\u0441\u0442\u0438 \u0432 \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b.<\/p>\n<p>\u0412\u043e\u0442 \u0438 \u0432\u0441\u044f \u0440\u0430\u0437\u043d\u0438\u0446\u0430, \u0435\u0441\u043b\u0438 \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c\u0441\u044f. \u041d\u0435 \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u043f\u0440\u0435\u0441\u0442\u0443\u043f\u043b\u0435\u043d\u0438\u044f \u0438\u0441\u0447\u0435\u0437\u043b\u0438: \u043e\u043d\u0438 \u043d\u0435 \u0438\u0441\u0447\u0435\u0437\u0430\u044e\u0442. \u0410 \u0432 \u0442\u043e\u043c, <strong>\u043a\u043e\u0433\u0434\u0430<\/strong> \u0432\u044b \u043e \u043d\u0438\u0445 \u0443\u0437\u043d\u0430\u0451\u0442\u0435. \u0417\u0430 \u043f\u044f\u0442\u044c \u0434\u043d\u0435\u0439 \u0434\u043e \u0440\u0430\u0437\u0432\u044f\u0437\u043a\u0438, \u0437\u0430 \u0447\u0430\u0448\u043a\u043e\u0439 \u043a\u043e\u0444\u0435. \u0418\u043b\u0438 \u0447\u0435\u0440\u0435\u0437 \u0447\u0435\u0442\u044b\u0440\u0435 \u0447\u0430\u0441\u0430 \u043f\u043e\u0441\u043b\u0435, \u043b\u0438\u0446\u043e\u043c \u0432 \u043d\u043e\u0443\u0442\u0431\u0443\u043a. \u041c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u043d\u0433 \u043d\u0435 \u0434\u0435\u043b\u0430\u0435\u0442 \u0441\u0438\u0441\u0442\u0435\u043c\u0443 \u043d\u0430\u0434\u0451\u0436\u043d\u0435\u0435. \u041c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u043d\u0433 \u0434\u0435\u043b\u0430\u0435\u0442 \u0432\u0430\u0441 \u0442\u0435\u043c, \u043a\u0442\u043e \u0443\u0437\u043d\u0430\u0451\u0442 \u043f\u0435\u0440\u0432\u044b\u043c. \u041e\u0441\u0442\u0430\u043b\u044c\u043d\u043e\u0435 &#8212; \u0434\u0435\u043b\u043e \u0442\u0435\u0445\u043d\u0438\u043a\u0438.<\/p>\n<p><strong>\u041c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u044b \u0434\u0435\u043b\u0430 \u2116 1142, \u043f\u043e \u044d\u043f\u0438\u0437\u043e\u0434\u0430\u043c:<\/strong><\/p>\n<ul>\n<li>\n<p>\u0411\u044b\u0441\u0442\u0440\u044b\u0439 \u0441\u0442\u0430\u0440\u0442: Prometheus + Grafana \u0437\u0430 10 \u043c\u0438\u043d\u0443\u0442<\/p>\n<\/li>\n<li>\n<p>PromQL: \u0447\u0442\u0435\u043d\u0438\u0435, \u0437\u0430\u043f\u0438\u0441\u044c \u0438 \u0434\u0435\u043b\u043e \u043e \u043c\u043e\u043b\u0447\u0430\u043d\u0438\u0438, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043f\u0440\u0438\u0442\u0432\u043e\u0440\u044f\u043b\u043e\u0441\u044c \u043d\u0443\u043b\u0451\u043c<\/p>\n<\/li>\n<li>\n<p>JVM: heap (\u0441 \u0441\u0443\u043c\u043c\u043e\u0439 \u043f\u043e \u043f\u0443\u043b\u0430\u043c!), GC, threads, off-heap<\/p>\n<\/li>\n<li>\n<p>HTTP: RED method, \u043f\u0435\u0440\u0446\u0435\u043d\u0442\u0438\u043b\u0438, \u043a\u0430\u0441\u0442\u043e\u043c\u043d\u044b\u0435 \u0442\u0435\u0433\u0438<\/p>\n<\/li>\n<li>\n<p>Database: HikariCP, AOP \u0434\u043b\u044f repository<\/p>\n<\/li>\n<li>\n<p>\u0411\u0438\u0437\u043d\u0435\u0441-\u043c\u0435\u0442\u0440\u0438\u043a\u0438: Counter, Gauge, Timer, Distribution Summary \u0438 \u0447\u0435\u0441\u0442\u043d\u043e\u0441\u0442\u044c \u043f\u0440\u043e \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0438<\/p>\n<\/li>\n<li>\n<p>\u041a\u0430\u0441\u0442\u043e\u043c\u043d\u044b\u0435 \u043c\u0435\u0442\u0440\u0438\u043a\u0438: MeterRegistry, event-driven \u043f\u043e\u0434\u0445\u043e\u0434 \u0441 AFTER_COMMIT<\/p>\n<\/li>\n<li>\n<p>Grafana: \u0434\u0430\u0448\u0431\u043e\u0440\u0434\u044b, variables, provisioning<\/p>\n<\/li>\n<li>\n<p>Alertmanager: routing, silencing, inhibition (\u044f\u0432\u043d\u044b\u043c\u0438 \u043f\u0430\u0440\u0430\u043c\u0438!)<\/p>\n<\/li>\n<li>\n<p>Recording Rules: \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432<\/p>\n<\/li>\n<li>\n<p>SLO\/SLI: Error Budget, multi-window Burn Rate<\/p>\n<\/li>\n<li>\n<p>\u0413\u0440\u0430\u0431\u043b\u0438: cardinality, naming, security<\/p>\n<\/li>\n<\/ul>\n<p><strong>\u041d\u0430\u043f\u0443\u0442\u0441\u0442\u0432\u0438\u0435 \u0442\u0435\u043c, \u0443 \u043a\u043e\u0433\u043e \u0432\u043e\u0441\u043a\u0440\u0435\u0441\u043d\u044b\u0439 \u0437\u0432\u043e\u043d\u043e\u043a \u0435\u0449\u0451 \u0432\u043f\u0435\u0440\u0435\u0434\u0438:<\/strong><\/p>\n<ol>\n<li>\n<p>\u041d\u0430\u0447\u043d\u0438\u0442\u0435 \u0441 JVM + HTTP \u043c\u0435\u0442\u0440\u0438\u043a: \u043e\u043d\u0438 \u043f\u043e\u043a\u0440\u044b\u0432\u0430\u044e\u0442 80% \u043f\u0440\u0435\u0441\u0442\u0443\u043f\u043b\u0435\u043d\u0438\u0439.<\/p>\n<\/li>\n<li>\n<p>\u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0439\u0442\u0435 \u0431\u0438\u0437\u043d\u0435\u0441-\u043c\u0435\u0442\u0440\u0438\u043a\u0438 \u043f\u043e\u0441\u0442\u0435\u043f\u0435\u043d\u043d\u043e: \u0434\u0432\u0435-\u0442\u0440\u0438 \u043a\u043b\u044e\u0447\u0435\u0432\u044b\u0445.<\/p>\n<\/li>\n<li>\n<p>\u0422\u0435\u0441\u0442\u0438\u0440\u0443\u0439\u0442\u0435 \u0430\u043b\u0435\u0440\u0442\u044b: \u0443\u0431\u0435\u0434\u0438\u0442\u0435\u0441\u044c, \u0447\u0442\u043e \u0437\u0432\u043e\u043d\u043a\u0438 \u0434\u043e\u0445\u043e\u0434\u044f\u0442. \u0418 \u0447\u0442\u043e inhibition \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0433\u043b\u0443\u0448\u0438\u0442 \u044d\u0445\u043e.<\/p>\n<\/li>\n<li>\n<p>\u041f\u0438\u0448\u0438\u0442\u0435 runbooks: \u0431\u0443\u0434\u0443\u0449\u0438\u0439 \u0432\u044b, \u043f\u043e\u0434\u043d\u044f\u0442\u044b\u0439 \u043f\u043e \u0442\u0440\u0435\u0432\u043e\u0433\u0435, \u043d\u0435 \u0437\u0430\u0431\u0443\u0434\u0435\u0442 \u044d\u0442\u043e\u0439 \u0443\u0441\u043b\u0443\u0433\u0438.<\/p>\n<\/li>\n<\/ol>\n<hr\/>\n<h3>\u0414\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0440\u0435\u0441\u0443\u0440\u0441\u044b<\/h3>\n<p><strong>\u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f:<\/strong><\/p>\n<ul>\n<li>\n<p><a href=\"https:\/\/micrometer.io\/docs\" rel=\"noopener noreferrer nofollow\">Micrometer<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/prometheus.io\/docs\/practices\/naming\/\" rel=\"noopener noreferrer nofollow\">Prometheus Best Practices<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/docs.spring.io\/spring-boot\/docs\/current\/reference\/html\/actuator.html\" rel=\"noopener noreferrer nofollow\">Spring Boot Actuator<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/prometheus.io\/docs\/alerting\/latest\/configuration\/\" rel=\"noopener noreferrer nofollow\">Alertmanager Configuration<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/grafana.com\/docs\/grafana\/latest\/administration\/provisioning\/\" rel=\"noopener noreferrer nofollow\">Grafana Provisioning<\/a><\/p>\n<\/li>\n<\/ul>\n<p><strong>\u0413\u043e\u0442\u043e\u0432\u044b\u0435 \u0434\u0430\u0448\u0431\u043e\u0440\u0434\u044b:<\/strong><\/p>\n<ul>\n<li>\n<p>JVM (Micrometer): <a href=\"https:\/\/grafana.com\/grafana\/dashboards\/4701\" rel=\"noopener noreferrer nofollow\">ID 4701<\/a><\/p>\n<\/li>\n<li>\n<p>Spring Boot Statistics: <a href=\"https:\/\/grafana.com\/grafana\/dashboards\/11378\" rel=\"noopener noreferrer nofollow\">ID 11378<\/a><\/p>\n<\/li>\n<li>\n<p>SLO Dashboard: <a href=\"https:\/\/grafana.com\/grafana\/dashboards\/14348\" rel=\"noopener noreferrer nofollow\">ID 14348<\/a><\/p>\n<\/li>\n<\/ul>\n<p><strong>PromQL:<\/strong><\/p>\n<ul>\n<li>\n<p><a href=\"https:\/\/promlabs.com\/promql-cheat-sheet\/\" rel=\"noopener noreferrer nofollow\">PromQL Cheat Sheet<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/prometheus.io\/docs\/practices\/rules\/\" rel=\"noopener noreferrer nofollow\">Recording Rules Best Practices<\/a><\/p>\n<\/li>\n<\/ul>\n<p><strong>SLO:<\/strong><\/p>\n<ul>\n<li>\n<p><a href=\"https:\/\/sre.google\/sre-book\/service-level-objectives\/\" rel=\"noopener noreferrer nofollow\">Google SRE Book: SLOs<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/sre.google\/workbook\/alerting-on-slos\/\" rel=\"noopener noreferrer nofollow\">Google SRE Workbook: Alerting on SLOs<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/github.com\/slok\/sloth\" rel=\"noopener noreferrer nofollow\">Sloth &#8212; SLO Generator<\/a><\/p>\n<\/li>\n<\/ul>\n<hr\/>\n<p><strong>\u0414\u0435\u043c\u043e-\u043f\u0440\u043e\u0435\u043a\u0442:<\/strong> \u0432\u0441\u0435 \u0432\u0435\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0435 \u0434\u043e\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c\u0441\u0442\u0432\u0430 &#8212; <a href=\"https:\/\/github.com\/PrikGeorge\/micrometer-prometheus-grafana\" rel=\"noopener noreferrer nofollow\">\u0432 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438<\/a> . \u0417\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u0435 <code>docker-compose up<\/code> \u0438 \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0438\u0440\u0443\u0439\u0442\u0435. \u0412 Docker-\u043f\u0440\u043e\u0444\u0438\u043b\u0435 \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0439 \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440 \u0441\u0430\u043c \u0441\u043e\u0437\u0434\u0430\u0451\u0442 \u0437\u0430\u0434\u0430\u0447\u0438 \u0438 \u0434\u0451\u0440\u0433\u0430\u0435\u0442 \u044d\u043d\u0434\u043f\u043e\u0438\u043d\u0442 \u0441 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u0437\u0430\u0434\u0435\u0440\u0436\u043a\u043e\u0439 \u0438 \u0440\u0435\u0434\u043a\u0438\u043c\u0438 \u043e\u0448\u0438\u0431\u043a\u0430\u043c\u0438: \u0433\u0440\u0430\u0444\u0438\u043a\u0438, \u043f\u0435\u0440\u0446\u0435\u043d\u0442\u0438\u043b\u0438, error rate \u0438 burn rate \u043e\u0436\u0438\u0432\u0430\u044e\u0442 \u0441\u0440\u0430\u0437\u0443, \u0431\u0435\u0437 \u0440\u0443\u0447\u043d\u043e\u0433\u043e \u00ab\u043f\u043e\u0442\u044b\u043a\u0430\u0442\u044c\u00bb.<\/p>\n<p>\u0415\u0441\u043b\u0438 \u0441\u0442\u0430\u0442\u044c\u044f \u0431\u044b\u043b\u0430 \u043f\u043e\u043b\u0435\u0437\u043d\u0430 &#8212; \u0441\u0442\u0430\u0432\u044c\u0442\u0435 \u043f\u043b\u044e\u0441 \u0438 \u043f\u043e\u0434\u043f\u0438\u0441\u044b\u0432\u0430\u0439\u0442\u0435\u0441\u044c \u043d\u0430  <a href=\"https:\/\/t.me\/JavaZavrOfficial\" rel=\"noopener noreferrer nofollow\">\u0442\u0435\u043b\u0435\u0433\u0440\u0430\u043c \u043a\u0430\u043d\u0430\u043b<\/a><\/p>\n<\/div>\n<p>\u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/1046239\/\">https:\/\/habr.com\/ru\/articles\/1046239\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u041e\u043d\u0430 \u0443\u043c\u0435\u0440\u043b\u0430 \u0432 \u0432\u043e\u0441\u043a\u0440\u0435\u0441\u0435\u043d\u044c\u0435 \u0432\u0435\u0447\u0435\u0440\u043e\u043c, \u0438 \u043d\u0438\u043a\u0442\u043e \u043d\u0435 \u0443\u0441\u043b\u044b\u0448\u0430\u043b \u043d\u0438 \u0437\u0432\u0443\u043a\u0430. \u0414\u0435\u0442\u0435\u043a\u0442\u0438\u0432\u043d\u0430\u044f \u0438\u0441\u0442\u043e\u0440\u0438\u044f \u043e \u0442\u043e\u043c, \u043a\u0430\u043a \u043f\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u043f\u0440\u043e\u0441\u043b\u0443\u0448\u043a\u0443 \u043d\u0430 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435: Prometheus, Grafana, Micrometer, \u0430\u043b\u0435\u0440\u0442\u044b, SLO. \u0412\u0441\u0435 \u0443\u043b\u0438\u043a\u0438 \u0432 \u043a\u043e\u043c\u043f\u043b\u0435\u043a\u0442\u0435, \u0434\u0435\u043c\u043e-\u043f\u0440\u043e\u0435\u043a\u0442 \u043f\u0440\u0438\u043b\u0430\u0433\u0430\u0435\u0442\u0441\u044f. \u0421\u043e\u0432\u043f\u0430\u0434\u0435\u043d\u0438\u044f \u0441 \u0432\u0430\u0448\u0438\u043c \u043f\u0440\u043e\u0434\u0430\u043a\u0448\u0435\u043d\u043e\u043c \u043d\u0435 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b.\u041f\u0440\u043e\u043b\u043e\u0433. \u0422\u0435\u043b\u043e\u0413\u043e\u0440\u043e\u0434 \u0441\u043f\u0430\u043b. \u042f &#8212; \u043d\u0435\u0442.\u0412\u043e\u0441\u043a\u0440\u0435\u0441\u0435\u043d\u044c\u0435, \u0432\u043e\u0441\u0435\u043c\u044c \u0432\u0435\u0447\u0435\u0440\u0430. \u0414\u043e\u0436\u0434\u044c \u0441\u0442\u0443\u0447\u0430\u043b \u0432 \u043e\u043a\u043d\u043e, \u043a\u0430\u043a healthcheck \u043f\u043e \u043c\u0451\u0440\u0442\u0432\u043e\u043c\u0443 \u044d\u043d\u0434\u043f\u043e\u0438\u043d\u0442\u0443: \u043c\u0435\u0442\u043e\u0434\u0438\u0447\u043d\u043e \u0438 \u0431\u0435\u0437 \u043d\u0430\u0434\u0435\u0436\u0434\u044b \u043d\u0430 \u043e\u0442\u0432\u0435\u0442. \u041d\u0430 \u0441\u0442\u043e\u043b\u0435 \u043e\u0441\u0442\u044b\u0432\u0430\u043b \u0443\u0436\u0438\u043d. \u0417\u0430\u0437\u0432\u043e\u043d\u0438\u043b \u0442\u0435\u043b\u0435\u0444\u043e\u043d. \u041b\u0451\u0448\u0430, \u0442\u0438\u043c\u043b\u0438\u0434. \u041b\u0451\u0448\u0430 \u043f\u043e \u0432\u043e\u0441\u043a\u0440\u0435\u0441\u0435\u043d\u044c\u044f\u043c \u043d\u0435 \u0437\u0432\u043e\u043d\u0438\u0442. \u041f\u043e \u0432\u043e\u0441\u043a\u0440\u0435\u0441\u0435\u043d\u044c\u044f\u043c \u043e\u043d \u043e\u0442\u0435\u0446, \u043c\u0443\u0436 \u0438 \u0447\u0435\u043b\u043e\u0432\u0435\u043a. \u0415\u0441\u043b\u0438 \u0437\u0432\u043e\u043d\u0438\u0442, \u0437\u043d\u0430\u0447\u0438\u0442, \u0447\u0435\u043b\u043e\u0432\u0435\u043a\u043e\u043c \u0441\u0435\u0433\u043e\u0434\u043d\u044f \u043f\u043e\u0431\u044b\u0442\u044c \u043d\u0435 \u0432\u044b\u0439\u0434\u0435\u0442 \u043d\u0438 \u0435\u043c\u0443, \u043d\u0438 \u043c\u043d\u0435.\u2014 \u0423 \u043d\u0430\u0441 \u0442\u0440\u0443\u043f, \u2014 \u0441\u043a\u0430\u0437\u0430\u043b \u043e\u043d. \u2014 \u041a\u0442\u043e? \u2014 Production. \u041b\u0435\u0436\u0438\u0442. \u041d\u0435 \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442.\u042f \u0432\u044b\u0435\u0445\u0430\u043b \u043d\u0435\u043c\u0435\u0434\u043b\u0435\u043d\u043d\u043e. \u0422\u043e \u0435\u0441\u0442\u044c \u043e\u0442\u043a\u0440\u044b\u043b \u043d\u043e\u0443\u0442\u0431\u0443\u043a, \u043d\u0435 \u0432\u0441\u0442\u0430\u0432\u0430\u044f \u0441 \u0434\u0438\u0432\u0430\u043d\u0430. \u0412 \u043d\u0430\u0448\u0435\u043c \u0434\u0435\u043b\u0435 \u044d\u0442\u043e \u0438 \u0435\u0441\u0442\u044c \u00ab\u0432\u044b\u0435\u0445\u0430\u043b \u043d\u0435\u043c\u0435\u0434\u043b\u0435\u043d\u043d\u043e\u00bb.\u041a\u0430\u0440\u0442\u0438\u043d\u0430 \u043f\u0440\u0435\u0441\u0442\u0443\u043f\u043b\u0435\u043d\u0438\u044f \u0431\u044b\u043b\u0430 \u0447\u0438\u0441\u0442\u043e\u0439. \u0421\u043b\u0438\u0448\u043a\u043e\u043c \u0447\u0438\u0441\u0442\u043e\u0439. JVM \u043b\u0435\u0436\u0430\u043b\u0430 \u043e\u0441\u0442\u044b\u0432\u0448\u0430\u044f, \u0431\u0435\u0437 \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u043e\u0432 \u0436\u0438\u0437\u043d\u0438. \u041d\u0438 \u043f\u0440\u0435\u0434\u0441\u043c\u0435\u0440\u0442\u043d\u043e\u0439, \u043d\u0438 \u043a\u0440\u0438\u043a\u043e\u0432 \u0432 \u043b\u043e\u0433\u0430\u0445, \u043d\u0438 \u043e\u0434\u043d\u043e\u0433\u043e \u0441\u0432\u0438\u0434\u0435\u0442\u0435\u043b\u044f. OutOfMemoryError, \u0433\u043b\u0430\u0441\u0438\u043b\u043e \u0437\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043c\u044b \u0434\u043e\u0431\u044b\u043b\u0438 \u0442\u043e\u043b\u044c\u043a\u043e \u0447\u0435\u0440\u0435\u0437 \u0447\u0435\u0442\u044b\u0440\u0435 \u0447\u0430\u0441\u0430 \u0432\u0441\u043a\u0440\u044b\u0442\u0438\u044f. \u0427\u0435\u0442\u044b\u0440\u0435 \u0447\u0430\u0441\u0430 \u043c\u043e\u0435\u0439 \u0436\u0438\u0437\u043d\u0438. \u0423\u0436\u0438\u043d \u043a \u0442\u043e\u043c\u0443 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u043e\u043a\u043e\u0447\u0435\u043d\u0435\u043b \u0432\u043c\u0435\u0441\u0442\u0435 \u0441 \u043f\u043e\u0442\u0435\u0440\u043f\u0435\u0432\u0448\u0435\u0439.\u041d\u043e \u0432\u043e\u0442 \u0447\u0442\u043e \u043d\u0435 \u0434\u0430\u0432\u0430\u043b\u043e \u043c\u043d\u0435 \u043f\u043e\u043a\u043e\u044f, \u043a\u043e\u0433\u0434\u0430 \u044f \u043e\u0442\u043c\u043e\u0442\u0430\u043b \u043f\u043b\u0451\u043d\u043a\u0443 GC-\u043b\u043e\u0433\u043e\u0432 \u043d\u0430\u0437\u0430\u0434. Heap \u0431\u044b\u043b \u0437\u0430\u0431\u0438\u0442 \u043d\u0430 95% \u0434\u0432\u043e\u0435 \u0441\u0443\u0442\u043e\u043a. \u0414\u0432\u043e\u0435 \u0441\u0443\u0442\u043e\u043a \u0436\u0435\u0440\u0442\u0432\u0430 \u0445\u043e\u0434\u0438\u043b\u0430 \u043f\u043e \u0433\u043e\u0440\u043e\u0434\u0443 \u0441 \u043d\u043e\u0436\u043e\u043c \u0432 \u0441\u043f\u0438\u043d\u0435 \u0438 \u0443\u043b\u044b\u0431\u0430\u043b\u0430\u0441\u044c \u043f\u0440\u043e\u0445\u043e\u0436\u0438\u043c. \u0414\u0432\u043e\u0435 \u0441\u0443\u0442\u043e\u043a \u043b\u044e\u0431\u043e\u0439 \u043c\u043e\u0433 \u0432\u0437\u0433\u043b\u044f\u043d\u0443\u0442\u044c \u043d\u0430 \u043d\u0435\u0451 \u0438 \u0441\u043a\u0430\u0437\u0430\u0442\u044c: \u00ab\u0414\u0430\u043c\u043e\u0447\u043a\u0430, \u0434\u0430 \u0432\u044b \u0436\u0435 \u0435\u043b\u0435 \u0434\u044b\u0448\u0438\u0442\u0435\u00bb. \u041d\u0438\u043a\u0442\u043e \u043d\u0435 \u0432\u0437\u0433\u043b\u044f\u043d\u0443\u043b. \u041f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0431\u044b\u043b\u043e \u043d\u0435\u043a\u043e\u043c\u0443.\u0412 \u043f\u043e\u043d\u0435\u0434\u0435\u043b\u044c\u043d\u0438\u043a \u0443\u0442\u0440\u043e\u043c \u041b\u0451\u0448\u0430 \u0441\u043e\u0431\u0440\u0430\u043b \u0432\u0441\u0435\u0445 \u0432 \u0443\u0447\u0430\u0441\u0442\u043a\u0435 \u0438 \u0441\u043a\u0430\u0437\u0430\u043b \u0442\u043e, \u0447\u0442\u043e \u0434\u043e\u043b\u0436\u043d\u044b \u0431\u044b\u043b\u0438 \u0441\u043a\u0430\u0437\u0430\u0442\u044c \u0434\u0430\u0432\u043d\u044b\u043c-\u0434\u0430\u0432\u043d\u043e:\u2014 \u042f \u0431\u043e\u043b\u044c\u0448\u0435 \u043d\u0435 \u0445\u043e\u0447\u0443 \u0443\u0437\u043d\u0430\u0432\u0430\u0442\u044c \u043e \u0442\u0440\u0443\u043f\u0430\u0445 \u043e\u0442 \u043c\u044d\u0440\u0430. \u042f \u0445\u043e\u0447\u0443 \u0443\u0437\u043d\u0430\u0432\u0430\u0442\u044c \u043e \u043d\u0438\u0445 \u043e\u0442 \u043e\u0441\u0432\u0435\u0434\u043e\u043c\u0438\u0442\u0435\u043b\u0435\u0439. \u0416\u0435\u043b\u0430\u0442\u0435\u043b\u044c\u043d\u043e, \u043f\u043e\u043a\u0430 \u043e\u043d\u0438 \u0435\u0449\u0451 \u0436\u0438\u0432\u044b.\u0422\u0430\u043a \u043e\u0442\u043a\u0440\u044b\u043b\u043e\u0441\u044c \u044d\u0442\u043e \u0434\u0435\u043b\u043e. \u0414\u0435\u043b\u043e \u2116 1142, \u00ab\u041c\u043e\u043b\u0447\u0430\u043b\u0438\u0432\u0430\u044f JVM\u00bb. \u042f \u0432\u0451\u043b \u0435\u0433\u043e \u0448\u0435\u0441\u0442\u044c \u043d\u0435\u0434\u0435\u043b\u044c. \u0414\u0435\u0439\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u043b\u0438\u0446\u0430: \u041b\u0451\u0448\u0430 \u2014 \u043a\u0430\u043f\u0438\u0442\u0430\u043d, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0434\u0430\u0432\u044f\u0442 \u0441\u0432\u0435\u0440\u0445\u0443. \u0414\u0430\u043d\u044f \u2014 \u0441\u0442\u0430\u0436\u0451\u0440 \u0441 \u0433\u043e\u0440\u044f\u0449\u0438\u043c\u0438 \u0433\u043b\u0430\u0437\u0430\u043c\u0438, \u0435\u0449\u0451 \u0432\u0435\u0440\u0438\u0442, \u0447\u0442\u043e \u043f\u0440\u0430\u0432\u0434\u0443 \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u0432 \u043b\u043e\u0433\u0430\u0445. \u0411\u043e\u0440\u0438\u0441 \u0410\u0440\u043a\u0430\u0434\u044c\u0435\u0432\u0438\u0447 \u2014 \u043c\u044d\u0440 \u0433\u043e\u0440\u043e\u0434\u0430, \u0447\u0435\u043b\u043e\u0432\u0435\u043a, \u0434\u0430\u043b\u0451\u043a\u0438\u0439 \u043e\u0442 \u043f\u0435\u0440\u0446\u0435\u043d\u0442\u0438\u043b\u0435\u0439, \u043d\u043e \u0431\u043b\u0438\u0437\u043a\u0438\u0439 \u043a \u0431\u044e\u0434\u0436\u0435\u0442\u0443. \u0418 \u0421\u0435\u0440\u0451\u0433\u0430 \u2014 \u043c\u043e\u0439 \u0441\u0442\u0430\u0440\u044b\u0439 \u043d\u0430\u043f\u0430\u0440\u043d\u0438\u043a \u0438\u0437 \u0441\u043e\u0441\u0435\u0434\u043d\u0435\u0433\u043e \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f. \u0421\u0435\u0440\u0451\u0433\u0430 \u043a\u043e\u0433\u0434\u0430-\u0442\u043e \u0432\u0451\u043b \u0434\u0435\u043b\u043e \u043e \u043a\u0430\u0440\u0434\u0438\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u0438. \u0421 \u0442\u0435\u0445 \u043f\u043e\u0440 \u0443 \u043d\u0435\u0433\u043e \u0441\u0435\u0434\u0438\u043d\u0430 \u0438 \u043f\u0440\u0438\u0432\u044b\u0447\u043a\u0430 \u0432\u0437\u0434\u0440\u0430\u0433\u0438\u0432\u0430\u0442\u044c \u043e\u0442 \u0441\u043b\u043e\u0432 \u00abuser_id\u00bb.\u0418 \u0435\u0449\u0451 \u0432 \u044d\u0442\u043e\u043c \u0434\u0435\u043b\u0435 \u0431\u0443\u0434\u0443\u0442 \u0442\u0440\u043e\u0435, \u043a\u043e\u0433\u043e \u044f \u0437\u0430\u0432\u0435\u0440\u0431\u043e\u0432\u0430\u043b. \u0410\u0440\u0445\u0438\u0432\u0430\u0440\u0438\u0443\u0441 \u043f\u043e \u0438\u043c\u0435\u043d\u0438 \u041f\u0440\u043e\u043c\u0435\u0442\u0435\u0439: \u0444\u043e\u0442\u043e\u0433\u0440\u0430\u0444\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u043f\u0430\u043c\u044f\u0442\u044c, \u043f\u043e\u043c\u043d\u0438\u0442 \u0432\u0441\u0451, \u0447\u0442\u043e \u0432\u0438\u0434\u0435\u043b, \u043d\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u0437\u0430 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u043c\u0435\u0441\u044f\u0446, \u0442\u0430\u043a\u043e\u0439 \u0443 \u043d\u0435\u0433\u043e \u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442. \u041e\u0441\u0432\u0435\u0434\u043e\u043c\u0438\u0442\u0435\u043b\u044c\u043d\u0438\u0446\u0430 \u0413\u0440\u0435\u0439\u0441: \u0440\u0438\u0441\u0443\u0435\u0442 \u043a\u0430\u0440\u0442\u0438\u043d\u0443 \u0433\u043e\u0440\u043e\u0434\u0430 \u043b\u0443\u0447\u0448\u0435 \u043b\u044e\u0431\u043e\u0433\u043e \u0448\u0442\u0430\u0442\u043d\u043e\u0433\u043e \u0445\u0443\u0434\u043e\u0436\u043d\u0438\u043a\u0430. \u0418 \u0434\u0438\u0441\u043f\u0435\u0442\u0447\u0435\u0440 \u043d\u0430 \u043a\u043e\u043c\u043c\u0443\u0442\u0430\u0442\u043e\u0440\u0435: \u0431\u0443\u0434\u0438\u0442 \u043d\u0443\u0436\u043d\u044b\u0445 \u043b\u044e\u0434\u0435\u0439 \u0432 \u043d\u0443\u0436\u043d\u043e\u0435 \u0432\u0440\u0435\u043c\u044f. \u041d\u0435 \u043f\u0443\u0442\u0430\u0442\u044c \u0441 \u043d\u0435\u043d\u0443\u0436\u043d\u044b\u043c\u0438 \u043b\u044e\u0434\u044c\u043c\u0438 \u0432 \u043d\u0435\u043d\u0443\u0436\u043d\u043e\u0435 \u0432\u0440\u0435\u043c\u044f, \u044d\u0442\u043e\u043c\u0443 \u043a\u043e\u043c\u043c\u0443\u0442\u0430\u0442\u043e\u0440 \u0442\u043e\u0436\u0435 \u043e\u0431\u0443\u0447\u0435\u043d, \u043d\u043e \u043e\u0431 \u044d\u0442\u043e\u043c \u043f\u043e\u0437\u0436\u0435.\u041f\u043e\u0447\u0435\u043c\u0443 \u0438\u043c\u0435\u043d\u043d\u043e Prometheus, Grafana \u0438 Micrometer?\u042f \u0441\u043f\u0440\u043e\u0441\u0438\u043b \u0421\u0435\u0440\u0451\u0433\u0443. \u0421\u0435\u0440\u0451\u0433\u0430 \u0437\u0430\u0442\u044f\u043d\u0443\u043b\u0441\u044f \u043a\u043e\u0444\u0435, \u043a\u0430\u043a \u0441\u0438\u0433\u0430\u0440\u0435\u0442\u043e\u0439, \u0438 \u0441\u043a\u0430\u0437\u0430\u043b: \u00ab\u041f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0431\u0435\u0441\u043f\u043b\u0430\u0442\u043d\u043e. \u041f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442. \u0418 \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e Micrometer \u0443\u0436\u0435 \u0441\u0438\u0434\u0438\u0442 \u0432 \u0442\u0432\u043e\u0451\u043c Spring Boot\u00bb. \u041e\u0442 \u0441\u0435\u0431\u044f \u0434\u043e\u0431\u0430\u0432\u043b\u044e: \u044d\u0442\u0443 \u0442\u0440\u043e\u0438\u0446\u0443 \u0441\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u044e\u0442 \u043d\u0430 \u0441\u043e\u0431\u0435\u0441\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u044f\u0445. \u0410 \u0437\u0430\u0440\u043f\u043b\u0430\u0442\u0430 &#8212; \u043b\u0443\u0447\u0448\u0438\u0439 \u0441\u0442\u0438\u043c\u0443\u043b \u043a \u0440\u0430\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u044e, \u0447\u0442\u043e \u0431\u044b \u0442\u0430\u043c \u043d\u0438 \u043f\u0438\u0441\u0430\u043b\u0438 \u0432 \u0434\u0435\u0442\u0435\u043a\u0442\u0438\u0432\u0430\u0445 \u043f\u0440\u043e \u0436\u0430\u0436\u0434\u0443 \u0441\u043f\u0440\u0430\u0432\u0435\u0434\u043b\u0438\u0432\u043e\u0441\u0442\u0438.\u041f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0431\u0435\u0437 \u043c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u043d\u0433\u0430 &#8212; \u044d\u0442\u043e \u0433\u043e\u0440\u043e\u0434 \u0431\u0435\u0437 \u0435\u0434\u0438\u043d\u043e\u0433\u043e \u0444\u043e\u043d\u0430\u0440\u044f. \u0416\u0438\u0442\u044c \u043c\u043e\u0436\u043d\u043e. \u041d\u0435\u0434\u043e\u043b\u0433\u043e.\u041f\u043e\u0435\u0445\u0430\u043b\u0438. \u0427\u0435\u0440\u0435\u0437 \u0434\u0435\u0441\u044f\u0442\u044c \u043c\u0438\u043d\u0443\u0442 \u0443 \u0432\u0430\u0441 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u043e\u0441\u043b\u0443\u0448\u043a\u0430. \u0427\u0435\u0440\u0435\u0437 \u0447\u0430\u0441 &#8212; \u0441\u0435\u0442\u044c \u043e\u0441\u0432\u0435\u0434\u043e\u043c\u0438\u0442\u0435\u043b\u0435\u0439, \u0441 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043c\u043e\u0436\u043d\u043e \u0441\u043f\u0430\u0442\u044c \u043f\u043e \u043d\u043e\u0447\u0430\u043c. \u041f\u043e\u0447\u0442\u0438. \u0421\u043e\u0432\u0441\u0435\u043c \u0441\u043f\u043e\u043a\u043e\u0439\u043d\u043e \u0432 \u044d\u0442\u043e\u043c \u0433\u043e\u0440\u043e\u0434\u0435 \u0441\u043f\u044f\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0442\u0435, \u0443 \u043a\u043e\u0433\u043e \u043d\u0435\u0442 production.\u042d\u043f\u0438\u0437\u043e\u0434 1. \u041f\u0440\u043e\u0441\u043b\u0443\u0448\u043a\u0430: \u043f\u0435\u0440\u0432\u044b\u0435 \u043c\u0435\u0442\u0440\u0438\u043a\u0438 \u0437\u0430 10 \u043c\u0438\u043d\u0443\u0442\u0412 \u043f\u043e\u043d\u0435\u0434\u0435\u043b\u044c\u043d\u0438\u043a \u043f\u043e\u0441\u043b\u0435 \u043e\u0431\u0435\u0434\u0430 \u0441\u0442\u0430\u0436\u0451\u0440 \u0414\u0430\u043d\u044f \u043f\u043e\u0434\u043e\u0448\u0451\u043b \u043a\u043e \u043c\u043d\u0435 \u0441 \u043b\u0438\u0446\u043e\u043c \u0447\u0435\u043b\u043e\u0432\u0435\u043a\u0430, \u0433\u043e\u0442\u043e\u0432\u043e\u0433\u043e \u043a \u0445\u0443\u0434\u0448\u0435\u043c\u0443:\u2014 \u041d\u0430\u043c \u0442\u0435\u043f\u0435\u0440\u044c \u043f\u0438\u0441\u0430\u0442\u044c \u043a\u0430\u043a\u043e\u0433\u043e-\u0442\u043e \u0430\u0433\u0435\u043d\u0442\u0430? \u0421\u043e\u0431\u0438\u0440\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0440\u0443\u043a\u0430\u043c\u0438? \u042d\u0442\u043e \u0436\u0435 \u043d\u0435\u0434\u0435\u043b\u0438.\u041d\u0435\u0442, \u043f\u0430\u0440\u0435\u043d\u044c. \u0418 \u0432 \u044d\u0442\u043e\u043c \u043f\u0435\u0440\u0432\u044b\u0439 \u043f\u043e\u0432\u043e\u0440\u043e\u0442 \u0441\u044e\u0436\u0435\u0442\u0430: \u043f\u0440\u043e\u0441\u043b\u0443\u0448\u043a\u0430 \u0443\u0436\u0435 \u0441\u0442\u043e\u0438\u0442. \u0415\u0451 \u043f\u043e\u0441\u0442\u0430\u0432\u0438\u043b\u0438 \u0434\u043e \u043d\u0430\u0441. \u041e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u0432\u043e\u0442\u043a\u043d\u0443\u0442\u044c \u043d\u0430\u0443\u0448\u043d\u0438\u043a\u0438.\u041c\u0435\u0441\u0442\u043e \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f\u0414\u0435\u043b\u043e \u0440\u0430\u0437\u0432\u0435\u0440\u043d\u0451\u0442\u0441\u044f \u0432\u043e\u043a\u0440\u0443\u0433 TODO-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f. \u041e\u0431\u044a\u0435\u043a\u0442 \u043d\u0430\u043c\u0435\u0440\u0435\u043d\u043d\u043e \u0441\u043a\u0443\u0447\u043d\u044b\u0439: \u0437\u0430\u0434\u0430\u0447\u0438 \u0441\u043e\u0437\u0434\u0430\u044e\u0442\u0441\u044f, \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044e\u0442\u0441\u044f, \u0443\u0434\u0430\u043b\u044f\u044e\u0442\u0441\u044f. \u0421\u043a\u0443\u0447\u043d\u044b\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u044f \u043b\u044e\u0431\u043b\u044e. \u0412\u0441\u044f \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u0430\u044f \u0436\u0438\u0437\u043d\u044c \u0443 \u043d\u0438\u0445, \u043a\u0430\u043a \u0432\u043e\u0434\u0438\u0442\u0441\u044f, \u0442\u0430\u0439\u043d\u0430\u044f.todo-monitoring-demo\/\u251c\u2500\u2500 src\/main\/java\/com\/example\/todo\/\u2502   \u251c\u2500\u2500 controller\/\u2502   \u2502   \u251c\u2500\u2500 TaskController.java          # CRUD \u043f\u043e \u0437\u0430\u0434\u0430\u0447\u0430\u043c\u2502   \u2502   \u2514\u2500\u2500 DemoController.java          # \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440 \u043b\u0430\u0442\u0435\u043d\u0442\u043d\u043e\u0441\u0442\u0438 \u0438 5xx \u0434\u043b\u044f \u0434\u0435\u043c\u043e\u2502   \u251c\u2500\u2500 service\/TaskService.java\u2502   \u251c\u2500\u2500 repository\/TaskRepository.java\u2502   \u251c\u2500\u2500 model\/                           # Task, TaskStatus, TaskPriority\u2502   \u251c\u2500\u2500 event\/                           # TaskCreatedEvent, TaskCompletedEvent, &#8230;\u2502   \u2514\u2500\u2500 config\/\u2502       \u251c\u2500\u2500 SecurityConfig.java\u2502       \u251c\u2500\u2500 MeterRegistryConfig.java\u2502       \u251c\u2500\u2500 RepositoryMetricsAspect.java\u2502       \u251c\u2500\u2500 CustomWebMvcTagsContributor.java\u2502       \u251c\u2500\u2500 MetricsEventListener.java\u2502       \u2514\u2500\u2500 DemoTrafficGenerator.java    # \u0434\u0435\u043c\u043e-\u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0430, \u0447\u0442\u043e\u0431\u044b \u0433\u0440\u0430\u0444\u0438\u043a\u0438 \u043e\u0436\u0438\u043b\u0438\u251c\u2500\u2500 src\/main\/resources\/\u2502   \u2514\u2500\u2500 application.yml\u251c\u2500\u2500 Dockerfile\u251c\u2500\u2500 docker-compose.yml\u251c\u2500\u2500 prometheus\/\u2502   \u251c\u2500\u2500 prometheus.yml\u2502   \u251c\u2500\u2500 alert-rules.yml\u2502   \u251c\u2500\u2500 recording-rules.yml\u2502   \u251c\u2500\u2500 slo-rules.yml\u2502   \u2514\u2500\u2500 alertmanager.yml\u2514\u2500\u2500 grafana\/    \u251c\u2500\u2500 dashboards\/    \u2502   \u251c\u2500\u2500 dashboard.yml    \u2502   \u2514\u2500\u2500 todo-app-dashboard.json    \u2514\u2500\u2500 datasources.yml\u0428\u0430\u0433 1: \u0417\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438\u0414\u0432\u0435 \u0441\u0442\u0440\u043e\u0447\u043a\u0438. \u0412\u0441\u0435\u0433\u043e \u0434\u0432\u0435. \u041d\u0435 \u043f\u044f\u0442\u044c, \u043d\u0435 \u0434\u0435\u0441\u044f\u0442\u044c. \u0414\u0432\u0435. \u0412 \u043c\u0438\u0440\u0435, \u0433\u0434\u0435 \u0434\u043b\u044f \u00abHello World\u00bb \u043d\u0443\u0436\u043d\u043e 200 \u043c\u0435\u0433\u0430\u0431\u0430\u0439\u0442 node_modules, \u044d\u0442\u043e \u043f\u043e\u0447\u0442\u0438 \u043f\u043e\u0434\u043e\u0437\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e.&lt;!&#8212; Spring Boot Actuator &#8212; \u043e\u0441\u043d\u043e\u0432\u0430 \u043c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u043d\u0433\u0430 &#8212;&gt;&lt;dependency&gt;    &lt;groupId&gt;org.springframework.boot&lt;\/groupId&gt;    &lt;artifactId&gt;spring-boot-starter-actuator&lt;\/artifactId&gt;&lt;\/dependency&gt;&lt;!&#8212; Micrometer Prometheus Registry &#8212; \u044d\u043a\u0441\u043f\u043e\u0440\u0442 \u043c\u0435\u0442\u0440\u0438\u043a &#8212;&gt;&lt;dependency&gt;    &lt;groupId&gt;io.micrometer&lt;\/groupId&gt;    &lt;artifactId&gt;micrometer-registry-prometheus&lt;\/artifactId&gt;&lt;\/dependency&gt;Actuator \u0441\u0430\u043c \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u0442 \u0434\u0435\u0441\u044f\u0442\u043a\u0438 \u0436\u0443\u0447\u043a\u043e\u0432: JVM, HTTP-\u0437\u0430\u043f\u0440\u043e\u0441\u044b, connection pools. \u0418 \u0432\u044b\u0432\u043e\u0434\u0438\u0442 \u0432\u0441\u0451 \u043d\u0430 endpoint \/actuator\/prometheus. Spring Boot 3.x \u0442\u044f\u043d\u0435\u0442 \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u0438\u043c\u044b\u0439 Micrometer \u0431\u0435\u0437 \u043b\u0438\u0448\u043d\u0438\u0445 \u0432\u043e\u043f\u0440\u043e\u0441\u043e\u0432, \u0432\u0435\u0440\u0441\u0438\u0438 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u043d\u0435 \u043d\u0443\u0436\u043d\u043e.\u0414\u0430\u043d\u044f \u0441\u043c\u043e\u0442\u0440\u0435\u043b \u043d\u0430 \u044d\u0442\u0438 \u0434\u0432\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u0441 \u043f\u043e\u0434\u043e\u0437\u0440\u0435\u043d\u0438\u0435\u043c. \u041f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u0441\u043c\u043e\u0442\u0440\u0435\u043b. \u041a\u043e\u0433\u0434\u0430 \u0432 \u043d\u0430\u0448\u0435\u043c \u0434\u0435\u043b\u0435 \u0447\u0442\u043e-\u0442\u043e \u0434\u043e\u0441\u0442\u0430\u0451\u0442\u0441\u044f \u043b\u0435\u0433\u043a\u043e, \u0436\u0434\u0438 \u0441\u0447\u0451\u0442\u0430. \u0421\u0447\u0451\u0442 \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u0437\u0436\u0435.\u0428\u0430\u0433 2: \u041a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044f# application.ymlspring:  application:    name: todo-monitoring-demo    datasource:    hikari:      pool-name: TodoHikariPool      maximum-pool-size: 10      minimum-idle: 2      register-mbeans: true  # \u0412\u043a\u043b\u044e\u0447\u0430\u0435\u0442 JMX MBeans (\u043d\u0435 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u0435\u043d \u0434\u043b\u044f Prometheus-\u043c\u0435\u0442\u0440\u0438\u043a)management:  endpoints:    web:      exposure:        # \u041e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u043c \u0422\u041e\u041b\u042c\u041a\u041e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0435. \u041d\u0438\u043a\u0430\u043a\u0438\u0445 env \u0438 loggers &#171;\u043d\u0430 \u0432\u0441\u044f\u043a\u0438\u0439 \u0441\u043b\u0443\u0447\u0430\u0439&#187; &#8212;        # \u0432 env \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u0441\u0435\u043a\u0440\u0435\u0442\u044b. \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 &#8212; \u0432 \u044d\u043f\u0438\u0437\u043e\u0434\u0435 \u043f\u0440\u043e \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u044c.        include: health, info, prometheus, metrics  endpoint:    prometheus:      enabled: true    health:      show-details: when_authorized    metrics:    tags:      application: ${spring.application.name}    distribution:      percentiles-histogram:        http.server.requests: true      percentiles:        http.server.requests: 0.5, 0.75, 0.95, 0.99      # SLO-\u0433\u0440\u0430\u043d\u0438\u0446\u044b \u0441\u043e\u0437\u0434\u0430\u044e\u0442 \u0442\u043e\u0447\u043d\u044b\u0435 \u0431\u0430\u043a\u0435\u0442\u044b le=&#187;&#8230;&#187;. \u0411\u0435\u0437 \u043d\u0438\u0445 \u0437\u0430\u043f\u0440\u043e\u0441\u044b      # \u0432\u0438\u0434\u0430 http_server_requests_seconds_bucket{le=&#187;0.5&#8243;} \u0432\u0435\u0440\u043d\u0443\u0442 \u043f\u0443\u0441\u0442\u043e\u0442\u0443 &#8212;      # \u0430 \u043d\u0430 \u043d\u0438\u0445 \u0434\u0435\u0440\u0436\u0430\u0442\u0441\u044f SLI \u043f\u043e \u043b\u0430\u0442\u0435\u043d\u0442\u043d\u043e\u0441\u0442\u0438 \u0438\u0437 \u044d\u043f\u0438\u0437\u043e\u0434\u0430 \u043f\u0440\u043e SLO.      # \u0417\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0434\u043e\u043b\u0436\u043d\u044b \u0441\u043e\u0432\u043f\u0430\u0434\u0430\u0442\u044c \u0441 \u0442\u0435\u043c\u0438, \u0447\u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u0432 slo-rules.yml.      slo:        http.server.requests: 100ms, 200ms, 500ms, 1s, 2s, 5s\u0417\u0430\u043f\u043e\u043c\u043d\u0438\u0442\u0435 \u0438\u0437 \u044d\u0442\u043e\u0433\u043e \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u0430 \u0447\u0435\u0442\u044b\u0440\u0435 \u0441\u0442\u0440\u043e\u043a\u0438:exposure.include &#8212; \u043a\u0430\u043a\u0438\u0435 \u0434\u0432\u0435\u0440\u0438 \u043e\u0442\u043a\u0440\u044b\u0442\u044c. \u041c\u0438\u043d\u0438\u043c\u0443\u043c: prometheus \u0438 health.percentiles-histogram &#8212; \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u0442 \u0433\u0438\u0441\u0442\u043e\u0433\u0440\u0430\u043c\u043c\u0443 \u0434\u043b\u044f \u043f\u0435\u0440\u0446\u0435\u043d\u0442\u0438\u043b\u0435\u0439.slo &#8212; \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442 \u00ab\u0438\u043c\u0435\u043d\u043d\u044b\u0435\u00bb \u0431\u0430\u043a\u0435\u0442\u044b le=. \u0417\u0430\u0445\u043e\u0442\u0438\u0442\u0435 \u043f\u043e\u0442\u043e\u043c \u0441\u0447\u0438\u0442\u0430\u0442\u044c \u00ab\u0434\u043e\u043b\u044e \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u0431\u044b\u0441\u0442\u0440\u0435\u0435 500 \u043c\u0441\u00bb, \u0430 \u0431\u0435\u0437 \u044d\u0442\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438 \u043d\u0435 \u043f\u043e\u0441\u0447\u0438\u0442\u0430\u0435\u0442\u0441\u044f \u043d\u0438\u0447\u0435\u0433\u043e &#8212; \u043c\u043e\u043b\u0447\u0430, \u0431\u0435\u0437 \u0435\u0434\u0438\u043d\u043e\u0439 \u043e\u0448\u0438\u0431\u043a\u0438 \u0432 \u043b\u043e\u0433\u0430\u0445. \u0412 \u043d\u0430\u0448\u0435\u043c \u0433\u043e\u0440\u043e\u0434\u0435 \u0441\u0430\u043c\u044b\u0435 \u043e\u043f\u0430\u0441\u043d\u044b\u0435 \u043f\u0440\u043e\u0432\u0430\u043b\u044b \u0442\u0435, \u0447\u0442\u043e \u043c\u043e\u043b\u0447\u0430\u0442.metrics.tags &#8212; \u043e\u0431\u0449\u0438\u0435 \u0442\u0435\u0433\u0438. \u041a\u043e\u0433\u0434\u0430 \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432 \u0441\u0442\u0430\u043d\u0435\u0442 \u0434\u0432\u0430\u0434\u0446\u0430\u0442\u044c, \u0432\u044b \u043f\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u0435 \u044d\u0442\u043e\u0439 \u0441\u0442\u0440\u043e\u0447\u043a\u0435 \u043f\u0430\u043c\u044f\u0442\u043d\u0438\u043a.\u0428\u0430\u0433 3: Docker Compose\u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435: \u043d\u0438\u043a\u0430\u043a\u043e\u0433\u043e version: &#8216;3.8&#8217; \u0432 \u0448\u0430\u043f\u043a\u0435. Compose v2 \u043d\u0430 \u043d\u0435\u0451 \u0442\u043e\u043b\u044c\u043a\u043e \u0432\u043e\u0440\u0447\u0438\u0442.services:  app:    build: .    container_name: todo-app    ports:      &#8212; &#171;8080:8080&#187;    environment:      &#8212; SPRING_PROFILES_ACTIVE=docker    # \u041b\u0438\u043c\u0438\u0442 \u043f\u0430\u043c\u044f\u0442\u0438 + -XX:MaxRAMPercentage \u0432 Dockerfile = \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0443\u0435\u043c\u044b\u0439 max heap.    # \u0411\u0435\u0437 \u043b\u0438\u043c\u0438\u0442\u0430 JVM \u0432\u043e\u0437\u044c\u043c\u0451\u0442 25% RAM \u0445\u043e\u0441\u0442\u0430, \u0438 \u0430\u043b\u0435\u0440\u0442\u044b \u043d\u0430 heap \u0431\u0443\u0434\u0443\u0442 \u043c\u0435\u0440\u0438\u0442\u044c\u0441\u044f    # \u043d\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043d\u043e \u043e\u0442 \u0447\u0435\u0433\u043e.    mem_limit: 512m    networks:      &#8212; monitoring    healthcheck:      test: [&#171;CMD&#187;, &#171;wget&#187;, &#171;-q&#187;, &#171;&#8212;spider&#187;, &#171;http:\/\/localhost:8080\/actuator\/health&#187;]      interval: 30s      timeout: 10s      retries: 3      start_period: 40s  prometheus:    image: prom\/prometheus:v2.48.0    container_name: prometheus    ports:      &#8212; &#171;9090:9090&#187;    volumes:      &#8212; .\/prometheus\/prometheus.yml:\/etc\/prometheus\/prometheus.yml:ro      &#8212; .\/prometheus\/alert-rules.yml:\/etc\/prometheus\/alert-rules.yml:ro      &#8212; .\/prometheus\/recording-rules.yml:\/etc\/prometheus\/recording-rules.yml:ro      &#8212; .\/prometheus\/slo-rules.yml:\/etc\/prometheus\/slo-rules.yml:ro      &#8212; prometheus_data:\/prometheus    command:      &#8212; &#8216;&#8212;config.file=\/etc\/prometheus\/prometheus.yml&#8217;      &#8212; &#8216;&#8212;storage.tsdb.path=\/prometheus&#8217;      # 31 \u0434\u0435\u043d\u044c, \u0447\u0442\u043e\u0431\u044b 30-\u0434\u043d\u0435\u0432\u043d\u043e\u0435 \u043e\u043a\u043d\u043e SLO (ratio_rate30d) \u0438\u043c\u0435\u043b\u043e \u0434\u0430\u043d\u043d\u044b\u0435      &#8212; &#8216;&#8212;storage.tsdb.retention.time=31d&#8217;      &#8212; &#8216;&#8212;storage.tsdb.retention.size=10GB&#8217;      &#8212; &#8216;&#8212;web.enable-lifecycle&#8217;    networks:      &#8212; monitoring    healthcheck:      test: [&#171;CMD&#187;, &#171;wget&#187;, &#171;-q&#187;, &#171;&#8212;spider&#187;, &#171;http:\/\/localhost:9090\/-\/healthy&#187;]      interval: 30s      timeout: 10s      retries: 3  grafana:    image: grafana\/grafana:10.2.2    container_name: grafana    ports:      &#8212; &#171;3000:3000&#187;    environment:      &#8212; GF_SECURITY_ADMIN_USER=admin      &#8212; GF_SECURITY_ADMIN_PASSWORD=admin      &#8212; GF_USERS_ALLOW_SIGN_UP=false    volumes:      &#8212; grafana_data:\/var\/lib\/grafana      &#8212; .\/grafana\/dashboards:\/etc\/grafana\/provisioning\/dashboards:ro      &#8212; .\/grafana\/datasources.yml:\/etc\/grafana\/provisioning\/datasources\/datasources.yml:ro    networks:      &#8212; monitoring    depends_on:      &#8212; prometheus    healthcheck:      test: [&#171;CMD-SHELL&#187;, &#171;curl -f http:\/\/localhost:3000\/api\/health || exit 1&#187;]      interval: 30s      timeout: 10s      retries: 3  alertmanager:    image: prom\/alertmanager:v0.26.0    container_name: alertmanager    ports:      &#8212; &#171;9093:9093&#187;    volumes:      &#8212; .\/prometheus\/alertmanager.yml:\/etc\/alertmanager\/alertmanager.yml:ro      &#8212; alertmanager_data:\/alertmanager    command:      &#8212; &#8216;&#8212;config.file=\/etc\/alertmanager\/alertmanager.yml&#8217;      &#8212; &#8216;&#8212;storage.path=\/alertmanager&#8217;    networks:      &#8212; monitoringnetworks:  monitoring:    driver:&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-483258","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/483258","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=483258"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/483258\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=483258"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=483258"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=483258"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}