{"id":387018,"date":"2024-06-29T07:04:12","date_gmt":"2024-06-29T07:04:12","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=387018"},"modified":"-0001-11-30T00:00:00","modified_gmt":"2024-06-29T07:04:12","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=387018","title":{"rendered":"<span>\u0421\u0435\u043a\u0440\u0435\u0442\u044b observability. \u0427\u0430\u0441\u0442\u044c 1: \u043c\u0435\u0442\u0440\u0438\u043a\u0438<\/span>"},"content":{"rendered":"<div><!--[--><img loading=\"lazy\" decoding=\"async\" height=\"1\" src=\"https:\/\/www.facebook.com\/tr?id=971720443354181&amp;ev=PageView&amp;noscript=1\" style=\"display:none;\" width=\"1\"><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-1\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/webt\/gk\/_l\/sn\/gk_lsn9i8qcxjqalkffdabix7r0.jpeg\" alt=\"image\" data-src=\"https:\/\/habrastorage.org\/webt\/gk\/_l\/sn\/gk_lsn9i8qcxjqalkffdabix7r0.jpeg\" data-blurred=\"true\"\/><br \/>  <em>\u0424\u043e\u0442\u043e ETA+, Unsplash.com<\/em><\/p>\n<p>  <\/p>\n<h4 id=\"pervye-shagi-v-storonu-observability--sobiraem-metriki-s-prometheus\">\u041f\u0435\u0440\u0432\u044b\u0435 \u0448\u0430\u0433\u0438 \u0432 \u0441\u0442\u043e\u0440\u043e\u043d\u0443 observability \u2014 \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u043c \u043c\u0435\u0442\u0440\u0438\u043a\u0438 \u0441 Prometheus<\/h4>\n<p>  <\/p>\n<p>\u041f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u044c\u0442\u0435 \u0441\u0435\u0431\u0435 \u0447\u0435\u043b\u043e\u0432\u0435\u043a\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u044c\u0435\u0442\u0441\u044f \u043d\u0430\u0434 \u0440\u0435\u0448\u0435\u043d\u0438\u0435\u043c \u0437\u0430\u0433\u0430\u0434\u043a\u0438, \u0430 \u0432\u043e\u043a\u0440\u0443\u0433 \u0441\u043e\u0431\u0440\u0430\u043b\u043e\u0441\u044c \u0441 \u0434\u0435\u0441\u044f\u0442\u043e\u043a \u0441\u043e\u0432\u0435\u0442\u0447\u0438\u043a\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u043c\u043e\u0433\u0430\u044e\u0442 \u0435\u043c\u0443 \u00ab\u043d\u0430\u0439\u0442\u0438 \u0443\u0431\u0438\u0439\u0446\u0443\u00bb. \u0417\u043d\u0430\u043a\u043e\u043c\u0430\u044f \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044f? \u0412 \u0442\u0430\u043a\u0438\u0445 \u0441\u043b\u0443\u0447\u0430\u044f\u0445 \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442 \u0431\u043e\u043b\u044c\u0448\u0435 \u0432\u043e\u043f\u0440\u043e\u0441\u043e\u0432, \u0447\u0435\u043c \u043e\u0442\u0432\u0435\u0442\u043e\u0432, \u0438 \u0435\u0441\u043b\u0438 \u043e\u0442\u0432\u0435\u0447\u0430\u0442\u044c \u043d\u0430 \u0432\u0441\u0435 \u044d\u0442\u0438 \u0432\u043e\u043f\u0440\u043e\u0441\u044b, \u043d\u0438 \u043d\u0430 \u0447\u0442\u043e \u0434\u0440\u0443\u0433\u043e\u0435 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0443\u0436\u0435 \u043d\u0435 \u043e\u0441\u0442\u0430\u043d\u0435\u0442\u0441\u044f.<\/p>\n<p>  <\/p>\n<p>\u0421\u043b\u043e\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u0442\u043e, \u0447\u0435\u0433\u043e \u043d\u0435 \u0437\u043d\u0430\u0435\u0448\u044c \u0438 \u043d\u0435 \u043f\u043e\u043d\u0438\u043c\u0430\u0435\u0448\u044c. \u0412\u043e\u0442 \u0442\u0443\u0442-\u0442\u043e \u043d\u0430 \u043f\u043e\u043c\u043e\u0449\u044c \u0438 \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442 observability (\u043d\u0430\u0431\u043b\u044e\u0434\u0430\u0435\u043c\u043e\u0441\u0442\u044c). \u041e\u043d\u0430 \u043f\u043e\u043c\u043e\u0433\u0430\u0435\u0442 \u043f\u043e\u043d\u044f\u0442\u044c, \u0447\u0442\u043e \u0441\u043b\u043e\u043c\u0430\u043b\u043e\u0441\u044c \u0438\u043b\u0438 \u043f\u043b\u043e\u0445\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442, \u0438 \u0434\u0430\u0436\u0435 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043d\u0430\u0439\u0442\u0438 \u043f\u0440\u0438\u0447\u0438\u043d\u0443, \u0447\u0442\u043e\u0431\u044b \u0432\u044b \u043c\u043e\u0433\u043b\u0438 \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u043e \u0432\u043d\u043e\u0441\u0438\u0442\u044c \u0443\u043b\u0443\u0447\u0448\u0435\u043d\u0438\u044f.<\/p>\n<p>  <\/p>\n<h2 id=\"chto-takoe-observability\">\u0427\u0442\u043e \u0442\u0430\u043a\u043e\u0435 observability<\/h2>\n<p>  <\/p>\n<p>\u041f\u043e\u0434 observability \u043c\u044b \u043f\u043e\u0434\u0440\u0430\u0437\u0443\u043c\u0435\u0432\u0430\u0435\u043c \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u0442\u043e\u0433\u043e, \u043d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u043e \u043c\u043e\u0436\u043d\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0435\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u043f\u043e \u0435\u0435 \u0432\u044b\u0445\u043e\u0434\u043d\u044b\u043c \u0434\u0430\u043d\u043d\u044b\u043c (\u0442\u0435\u043b\u0435\u043c\u0435\u0442\u0440\u0438\u0438). \u041d\u0438\u0447\u0435\u0433\u043e \u043d\u043e\u0432\u043e\u0433\u043e \u0432 \u044d\u0442\u043e\u043c \u043d\u0435\u0442 \u2014 \u043c\u044b \u043f\u044b\u0442\u0430\u0435\u043c\u0441\u044f \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c\u0441\u044f \u0432 \u0440\u0430\u0431\u043e\u0442\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u043f\u043e \u043b\u043e\u0433\u0430\u043c \u0441 \u043d\u0430\u0447\u0430\u043b\u0430 \u0432\u0440\u0435\u043c\u0435\u043d, \u043d\u043e \u0441\u0435\u0439\u0447\u0430\u0441 \u0432\u0441\u0435 \u043e\u0441\u043b\u043e\u0436\u043d\u044f\u0435\u0442\u0441\u044f \u043e\u0431\u043b\u0430\u043a\u0430\u043c\u0438, \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0430\u043c\u0438, \u043c\u0438\u043a\u0440\u043e\u0441\u0435\u0440\u0432\u0438\u0441\u0430\u043c\u0438, \u043c\u043d\u043e\u0433\u043e\u044f\u0437\u044b\u0447\u043d\u044b\u043c\u0438 \u0441\u0440\u0435\u0434\u0430\u043c\u0438 \u0438 \u0442. \u0434.<\/p>\n<p>  <\/p>\n<h2 id=\"tri-kita-observability\">\u0422\u0440\u0438 \u043a\u0438\u0442\u0430 observability<\/h2>\n<p>  <\/p>\n<p>Observability \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u0430 \u043d\u0430 \u0442\u0440\u0435\u0445 \u0433\u043b\u0430\u0432\u043d\u044b\u0445 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430\u0445. \u042d\u0442\u043e \u0434\u0430\u043d\u043d\u044b\u0435 \u0442\u0435\u043b\u0435\u043c\u0435\u0442\u0440\u0438\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0436\u043d\u043e \u0430\u0433\u0440\u0435\u0433\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438 \u0430\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043d\u044f\u0442\u044c \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0441\u0438\u0441\u0442\u0435\u043c\u044b:<\/p>\n<p>  <\/p>\n<ol>\n<li>\u041c\u0435\u0442\u0440\u0438\u043a\u0438.<\/li>\n<li>\u0422\u0440\u0430\u0441\u0441\u0438\u0440\u043e\u0432\u043a\u0438.<\/li>\n<li>\u041b\u043e\u0433\u0438.<\/li>\n<\/ol>\n<p>  <\/p>\n<p>\u0412 \u044d\u0442\u043e\u0439 \u0441\u0435\u0440\u0438\u0438 \u0441\u0442\u0430\u0442\u0435\u0439 \u043c\u044b \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0432\u0441\u0435 \u0442\u0440\u0438 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430 \u0441 \u043f\u0440\u0438\u043c\u0435\u0440\u0430\u043c\u0438. \u041d\u0430\u0447\u043d\u0435\u043c \u0441 \u043c\u0435\u0442\u0440\u0438\u043a \u0438 \u043e\u043f\u0435\u043d\u0441\u043e\u0440\u0441-\u043f\u0440\u043e\u0435\u043a\u0442\u0430 Prometheus.<\/p>\n<p><a name=\"habracut\"><\/a>  <\/p>\n<h2 id=\"metriki\">\u041c\u0435\u0442\u0440\u0438\u043a\u0438<\/h2>\n<p>  <\/p>\n<p>\u041c\u0435\u0442\u0440\u0438\u043a\u0430 \u2014 \u044d\u0442\u043e \u0447\u0438\u0441\u043b\u043e\u0432\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0437\u0430 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0439 \u043f\u0435\u0440\u0438\u043e\u0434 \u0432\u0440\u0435\u043c\u0435\u043d\u0438, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0441\u0447\u0435\u0442\u0447\u0438\u043a, \u0442\u0430\u0439\u043c\u0435\u0440 \u0438\u043b\u0438 \u0438\u0437\u043c\u0435\u0440\u0438\u0442\u0435\u043b\u044c. \u0418\u0445 \u0441\u0431\u043e\u0440 \u043d\u0435 \u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u043c\u043d\u043e\u0433\u043e \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0447\u0438\u0441\u043b\u043e\u0432\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043c\u043e\u0436\u043d\u043e \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u044f\u0442\u044c, \u0447\u0442\u043e\u0431\u044b \u0441\u044d\u043a\u043e\u043d\u043e\u043c\u0438\u0442\u044c \u043d\u0430 \u0442\u0440\u0430\u0444\u0438\u043a\u0435. \u041e\u0431\u044b\u0447\u043d\u043e \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043c\u0435\u0442\u0440\u0438\u043a \u043c\u044b \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u043c \u0440\u0430\u0431\u043e\u0442\u043e\u0441\u043f\u043e\u0441\u043e\u0431\u043d\u043e\u0441\u0442\u044c \u0441\u0438\u0441\u0442\u0435\u043c\u044b, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043e\u043d\u0438 \u0445\u043e\u0440\u043e\u0448\u043e \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u044e\u0442 \u0441\u0442\u0430\u0442\u0443\u0441 \u0440\u0435\u0441\u0443\u0440\u0441\u0430. \u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u043c\u043e\u0436\u043d\u043e \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043a\u043e\u0434 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0442\u0430\u043a\u0438\u0445 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a, \u043a\u0430\u043a <a href=\"https:\/\/prometheus.io\/docs\/instrumenting\/clientlibs\/\">prometheus_client<\/a> \u0438\u043b\u0438 <a href=\"https:\/\/github.com\/open-telemetry\/opentelemetry-js\/tree\/main\/packages\/opentelemetry-exporter-prometheus\">prometheus_exporter<\/a>, \u0447\u0442\u043e\u0431\u044b \u0441\u043e\u0431\u0438\u0440\u0430\u0442\u044c \u043a\u0430\u0441\u0442\u043e\u043c\u043d\u044b\u0435 \u043c\u0435\u0442\u0440\u0438\u043a\u0438, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432\u0440\u0435\u043c\u044f \u043e\u0442\u043a\u043b\u0438\u043a\u0430, \u0447\u0438\u0441\u043b\u043e \u0430\u043a\u0442\u0438\u0432\u043d\u044b\u0445 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432, \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043e\u0448\u0438\u0431\u043e\u043a \u0438 \u0442. \u0434.<\/p>\n<p>  <\/p>\n<h2 id=\"prometheus\">Prometheus<\/h2>\n<p>  <\/p>\n<p>Prometheus \u2014 \u044d\u0442\u043e \u043e\u043f\u0435\u043d\u0441\u043e\u0440\u0441-\u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u043c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u043d\u0433\u0430 \u0438 \u043e\u043f\u043e\u0432\u0435\u0449\u0435\u043d\u0438\u044f \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u043c\u0435\u0442\u0440\u0438\u043a. \u0418\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e \u043e\u043d \u0431\u044b\u043b \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0430\u043d SoundCloud, \u0430 \u0442\u0435\u043f\u0435\u0440\u044c \u044d\u0442\u043e \u043f\u0440\u043e\u0435\u043a\u0442 Cloud Native Computing Foundation. \u041e\u043d \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u0442 \u043c\u0435\u0442\u0440\u0438\u043a\u0438 \u043e\u0431 \u0438\u043d\u0444\u0440\u0430\u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0435 \u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f\u0445.<br \/>  Prometheus \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0438\u0437 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u043e\u0432:<\/p>\n<p>  <\/p>\n<ul>\n<li><strong>C\u0435\u0440\u0432\u0435\u0440 Prometheus<\/strong> \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u0442 \u043c\u0435\u0442\u0440\u0438\u043a\u0438 \u0438 \u0445\u0440\u0430\u043d\u0438\u0442 \u0434\u0430\u043d\u043d\u044b\u0435 \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0440\u044f\u0434\u043e\u0432.<\/li>\n<li><strong>\u041a\u043b\u0438\u0435\u043d\u0442\u0441\u043a\u0438\u0435 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438<\/strong> \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u044e\u0442 \u043c\u0435\u0442\u0440\u0438\u043a\u0438 \u0434\u043b\u044f \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f.<\/li>\n<li><strong>Push Gateway<\/strong> \u2014 \u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043e\u0447\u043d\u044b\u0439 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043f\u0443\u0448\u0438\u0442\u044c \u043c\u0435\u0442\u0440\u0438\u043a\u0438 \u0438\u0437 \u0434\u0436\u043e\u0431\u043e\u0432, \u0435\u0441\u043b\u0438 \u0441\u043a\u0440\u0435\u0439\u043f\u0438\u043d\u0433 \u043d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u0435\u043d.<\/li>\n<li><strong>Alert Manager<\/strong> \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442 \u0430\u043b\u0435\u0440\u0442\u044b \u043e\u0442 Prometheus. \u041e\u0442\u0432\u0435\u0447\u0430\u0435\u0442 \u0437\u0430 \u0433\u0440\u0443\u043f\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435, \u0434\u0435\u0434\u0443\u043f\u043b\u0438\u043a\u0430\u0446\u0438\u044e \u0438 \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0430\u043b\u0435\u0440\u0442\u043e\u0432 \u043d\u0443\u0436\u043d\u043e\u043c\u0443 \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u0435\u043b\u044e.<\/li>\n<li><strong>\u042d\u043a\u0441\u043f\u043e\u0440\u0442\u0435\u0440\u044b<\/strong> \u0441\u043e\u0431\u0438\u0440\u0430\u044e\u0442 \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0443 \u0438\u0437 \u0434\u0440\u0443\u0433\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u0438 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u0443\u044e\u0442 \u0435\u0435 \u0432 \u043c\u0435\u0442\u0440\u0438\u043a\u0438 Prometheus.<\/li>\n<\/ul>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/ek\/2v\/nb\/ek2vnb7ki3rqvb9lqnf9qoqmrse.png\" alt=\"image\" data-src=\"https:\/\/habrastorage.org\/webt\/ek\/2v\/nb\/ek2vnb7ki3rqvb9lqnf9qoqmrse.png\"\/><br \/>  <em>\u0410\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0430 Prometheus<\/em><\/p>\n<p>  <\/p>\n<h2 id=\"deployment\">\u0414\u0435\u043f\u043b\u043e\u0439\u043c\u0435\u043d\u0442<\/h2>\n<p>  <\/p>\n<p>Prometheus \u043c\u043e\u0436\u043d\u043e \u0440\u0430\u0437\u0432\u0435\u0440\u043d\u0443\u0442\u044c \u043f\u043e-\u0440\u0430\u0437\u043d\u043e\u043c\u0443: \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0432 \u0438\u043d\u0444\u0440\u0430\u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0435 \u0432\u0440\u0443\u0447\u043d\u0443\u044e \u0432 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0430\u0445 \u0438\u043b\u0438 Kubernetes \u0438\u043b\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c helm \u2014 \u0441 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u043e\u043c \u0438\u043b\u0438 \u0431\u0435\u0437. \u0414\u043b\u044f \u043f\u0440\u043e\u0441\u0442\u043e\u0442\u044b \u043c\u044b \u0437\u0430\u0434\u0435\u043f\u043b\u043e\u0438\u043c Prometheus \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e helm-\u0447\u0430\u0440\u0442\u0430 \u0441 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u043e\u043c Prometheus.<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">kubectl create namespace observability helm repo add prometheus-community https:\/\/prometheus- community.github.io\/helm-charts helm repo update helm install prometheus prometheus-community\/kube-prometheus-stack -- namespace observability<\/code><\/pre>\n<p>  <\/p>\n<blockquote><p>\u041d\u0430 \u043c\u043e\u043c\u0435\u043d\u0442 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u044f\u044f \u0432\u0435\u0440\u0441\u0438\u044f Prometheus \u2014 2.26, \u0441 \u0443\u0434\u043e\u0431\u043d\u044b\u043c\u0438 \u043d\u043e\u0432\u044b\u043c\u0438 \u0444\u0438\u0447\u0430\u043c\u0438. \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435: <a href=\"https:\/\/github.com\/prometheus\/prometheus\/releases\/tag\/v2.26.0\">https:\/\/github.com\/prometheus\/prometheus\/releases\/tag\/v2.26.0<\/a> <em>\u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u0435 \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0447\u0438\u043a\u0430: \u043a \u043c\u043e\u043c\u0435\u043d\u0442\u0443 \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u0438 \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0430 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u044f\u044f \u0432\u0435\u0440\u0441\u0438\u044f \u2014 <a href=\"https:\/\/github.com\/prometheus\/prometheus\/releases\/tag\/v2.28.1\">2.28.1<\/a>.<\/em><\/p><\/blockquote>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0434\u0435\u043f\u043b\u043e\u0439\u043c\u0435\u043d\u0442\u0430 \u0432\u044b \u0443\u0432\u0438\u0434\u0438\u0442\u0435 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u043f\u043e\u0434\u044b:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">NAME                                                     READY   STATUS    RESTARTS   AGE alertmanager-prometheus-kube-prometheus-alertmanager-0   2\/2     Running   0          69m prometheus-grafana-5c469b9cbf-kn2zk                      2\/2     Running   0          69m prometheus-kube-prometheus-operator-68d59d8d59-gvkzk     1\/1     Running   0          69m prometheus-kube-state-metrics-685b975bb7-rhstl           1\/1     Running   0          69m prometheus-prometheus-kube-prometheus-prometheus-0       2\/2     Running   0          69m prometheus-prometheus-node-exporter-mn68b                1\/1     Running   0          69m<\/code><\/pre>\n<p>  <\/p>\n<p>\u0414\u043b\u044f \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a Prometheus \u043c\u044b \u043f\u0440\u043e\u0431\u0440\u043e\u0441\u0438\u043c \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u0439 \u043f\u043e\u0440\u0442 \u043d\u0430 \u043f\u043e\u0440\u0442 \u0441\u0435\u0440\u0432\u0438\u0441\u0430 Prometheus.<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">kubectl port-forward service\/prometheus-operated -n observability 9090 Forwarding from 127.0.0.1:9090 -> 9090 Forwarding from [::1]:9090 -> 9090<\/code><\/pre>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/vd\/tr\/a2\/vdtra2g-kzo8sxznqsq6xtvsgdq.png\" alt=\"image\" data-src=\"https:\/\/habrastorage.org\/webt\/vd\/tr\/a2\/vdtra2g-kzo8sxznqsq6xtvsgdq.png\"\/><br \/>  <em>Prometheus \u043d\u0430 localhost:9090<\/em><\/p>\n<p>  <\/p>\n<p>\u041a\u0430\u043a \u0432\u0438\u0434\u0438\u0442\u0435, \u0443 \u043d\u0430\u0441 \u0443\u0436\u0435 \u0435\u0441\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043c\u0435\u0442\u0440\u0438\u043a. \u0412\u0441\u0435 \u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u043f\u043e\u0434\u0443 <strong>kube-state-metrics<\/strong> \u2014 \u0441\u0435\u0440\u0432\u0438\u0441\u0443, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043e\u0431\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f \u043a Kubernetes API \u0438 \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442 \u043c\u0435\u0442\u0440\u0438\u043a\u0438 \u043e \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 Kubernetes.<\/p>\n<p>  <\/p>\n<p>\u0427\u0442\u043e\u0431\u044b \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u0441 \u044d\u0442\u0438\u043c\u0438 \u043c\u0435\u0442\u0440\u0438\u043a\u0430\u043c\u0438 \u0438 \u0430\u0433\u0440\u0435\u0433\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438\u0445, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435 \u044f\u0437\u044b\u043a \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 <a href=\"https:\/\/prometheus.io\/docs\/prometheus\/latest\/querying\/basics\/\">PromQL<\/a> (Prometheus Query Language). \u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u043c\u043e\u0436\u043d\u043e \u0432\u044b\u0432\u0435\u0441\u0442\u0438 \u0432 \u0432\u0438\u0434\u0435 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0438\u043b\u0438 \u0433\u0440\u0430\u0444\u0438\u043a\u0430.<\/p>\n<p>  <\/p>\n<p>\u041c\u0435\u0442\u0440\u0438\u043a\u0438 \u0431\u044b\u0432\u0430\u044e\u0442 \u0447\u0435\u0442\u044b\u0440\u0435\u0445 \u0442\u0438\u043f\u043e\u0432:<\/p>\n<p>  <\/p>\n<ul>\n<li><strong>\u0421\u0447\u0435\u0442\u0447\u0438\u043a<\/strong>: \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043c\u043e\u0436\u043d\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0432\u0430\u0442\u044c \u0438\u043b\u0438 \u0441\u0431\u0440\u043e\u0441\u0438\u0442\u044c \u0434\u043e \u043d\u0443\u043b\u044f.<\/li>\n<li><strong>\u0418\u0437\u043c\u0435\u0440\u0438\u0442\u0435\u043b\u044c<\/strong>: \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043c\u043e\u0436\u043d\u043e \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0432\u0430\u0442\u044c \u0438\u043b\u0438 \u0443\u043c\u0435\u043d\u044c\u0448\u0430\u0442\u044c.<\/li>\n<li><strong>\u0413\u0438\u0441\u0442\u043e\u0433\u0440\u0430\u043c\u043c\u0430<\/strong>: \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0440\u044f\u0434\u043e\u0432 \u2014 \u0441\u043e\u0432\u043e\u043a\u0443\u043f\u043d\u044b\u0435 \u0441\u0447\u0435\u0442\u0447\u0438\u043a\u0438 \u0434\u043b\u044f \u0431\u0430\u043a\u0435\u0442\u043e\u0432, \u0441\u0443\u043c\u043c\u0430 \u043d\u0430\u0431\u043b\u044e\u0434\u0430\u0435\u043c\u044b\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u0438 \u043e\u0431\u0449\u0438\u0439 \u0441\u0447\u0435\u0442\u0447\u0438\u043a \u0441\u043e\u0431\u044b\u0442\u0438\u0439.<\/li>\n<li><strong>\u0421\u0432\u043e\u0434\u043a\u0430<\/strong>: \u043f\u043e\u0445\u043e\u0436\u0430 \u043d\u0430 \u0433\u0438\u0441\u0442\u043e\u0433\u0440\u0430\u043c\u043c\u0443 (\u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u0441\u0443\u043c\u043c\u0443 \u043d\u0430\u0431\u043b\u044e\u0434\u0430\u0435\u043c\u044b\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u0438 \u0441\u0447\u0435\u0442\u0447\u0438\u043a \u0434\u043b\u044f \u0441\u043e\u0431\u044b\u0442\u0438\u0439), \u043d\u043e \u0442\u0430\u043a\u0436\u0435 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0440\u0430\u0441\u0447\u0435\u0442 \u0434\u043b\u044f <strong>\u03c6-\u043a\u0432\u0430\u043d\u0442\u0438\u043b\u0435\u0439<\/strong>.<\/li>\n<\/ul>\n<p>  <\/p>\n<p><em>\u0413\u0438\u0441\u0442\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u0442\u043e\u0436\u0435 \u043c\u043e\u0436\u0435\u0442 \u0434\u0430\u0432\u0430\u0442\u044c \u03c6-\u043a\u0432\u0430\u043d\u0442\u0438\u043b\u0438 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <a href=\"https:\/\/prometheus.io\/docs\/prometheus\/latest\/querying\/functions\/#histogram_quantile\"><code>histogram_quantile<\/code><\/a>, \u043d\u043e \u0440\u0430\u0441\u0447\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f <strong>\u043d\u0430 \u0441\u0442\u043e\u0440\u043e\u043d\u0435 \u0441\u0435\u0440\u0432\u0435\u0440\u0430<\/strong>, \u0430 \u043d\u0435 <strong>\u043a\u043b\u0438\u0435\u043d\u0442\u0430<\/strong>, \u043a\u0430\u043a \u0432 \u0441\u0432\u043e\u0434\u043a\u0435.<\/em><\/p>\n<p>  <\/p>\n<h2 id=\"predostavlenie-metrik\">\u041f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043c\u0435\u0442\u0440\u0438\u043a<\/h2>\n<p>  <\/p>\n<p>\u042d\u0442\u043e \u0431\u044b\u043b\u0430 \u0442\u0435\u043e\u0440\u0438\u044f. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0442\u0435\u043f\u0435\u0440\u044c \u043d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u043a\u0430\u043a \u0441\u043e\u0431\u0438\u0440\u0430\u0442\u044c \u043c\u0435\u0442\u0440\u0438\u043a\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u0438 \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432 \u0447\u0435\u0440\u0435\u0437 Prometheus.<\/p>\n<p>  <\/p>\n<p>\u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u043d\u0443\u0436\u043d\u043e \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u0435\u0442\u0440\u0438\u043a\u0438. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c <a href=\"https:\/\/github.com\/siimon\/prom-client\">\u043a\u043b\u0438\u0435\u043d\u0442<\/a> Prometheus \u0434\u043b\u044f Node.js. \u0423 \u043a\u043b\u0438\u0435\u043d\u0442\u0430 \u0443\u0436\u0435 \u0435\u0441\u0442\u044c \u0434\u0435\u0444\u043e\u043b\u0442\u043d\u044b\u0435 \u043c\u0435\u0442\u0440\u0438\u043a\u0438, \u0442\u0430\u043a \u0447\u0442\u043e \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u0431\u044b\u0441\u0442\u0440\u043e.<\/p>\n<p>  <\/p>\n<p>\u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0440\u0435\u0435\u0441\u0442\u0440 \u0438 \u0432\u0435\u043b\u0438\u043c \u043a\u043b\u0438\u0435\u043d\u0442\u0443 \u0441\u043e\u0431\u0438\u0440\u0430\u0442\u044c \u0434\u0435\u0444\u043e\u043b\u0442\u043d\u044b\u0435 \u043c\u0435\u0442\u0440\u0438\u043a\u0438.<\/p>\n<p>  <\/p>\n<pre><code class=\"go\">const prom = require('prom-client')  const registry = new prom.Registry()  prom.collectDefaultMetrics({     register: registry })  const registerPromMetrics = async (req, res) => {     console.log('Returning Metrics')     try {         res.set('Content-Type', registry.contentType);         res.end(await registry.metrics());     } catch (err) {         res.status(500).end(err);     } }  module.exports = {registerPromMetrics}<\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c \u044d\u0442\u0438 \u043c\u0435\u0442\u0440\u0438\u043a\u0438 \u0447\u0435\u0440\u0435\u0437 endpoint <strong>\/metrics<\/strong>.<\/p>\n<p>  <\/p>\n<pre><code class=\"go\">const express = require('express'); const { registerPromMetrics } = require('.\/telemetry\/metrics')  const app = express();  app.use(express.json()); app.get('\/metrics',registerPromMetrics) app.listen(process.env.SERVER_PORT, () => {     logger.info(`Server Ready and Listening to port ${process.env.SERVER_PORT} `) })<\/code><\/pre>\n<p>  <\/p>\n<p>\u0412\u043e\u0442 \u0438 \u0432\u0441\u0435. \u041c\u0435\u0442\u0440\u0438\u043a\u0438 \u0433\u043e\u0442\u043e\u0432\u044b.<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/bs\/w6\/k_\/bsw6k_gdinh7fp-71ojdxvxn9xy.png\" alt=\"image\" data-src=\"https:\/\/habrastorage.org\/webt\/bs\/w6\/k_\/bsw6k_gdinh7fp-71ojdxvxn9xy.png\"\/><br \/>  <em>endpoint \/metrics \u043d\u0430 localhost:8080<\/em><\/p>\n<p>  <\/p>\n<p>\u0427\u0442\u043e\u0431\u044b \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043a\u0430\u0441\u0442\u043e\u043c\u043d\u044b\u0435 \u043c\u0435\u0442\u0440\u0438\u043a\u0438, \u043d\u0443\u0436\u043d\u043e \u0432\u044b\u0431\u0440\u0430\u0442\u044c \u0442\u0438\u043f \u043c\u0435\u0442\u0440\u0438\u043a, \u0430 \u0437\u0430\u0442\u0435\u043c \u0441\u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438 \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0435\u0433\u043e. \u0414\u043b\u044f \u0432\u0441\u0435\u0445 \u0442\u0438\u043f\u043e\u0432 \u043c\u0435\u0442\u0440\u0438\u043a \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u043c\u0435\u0442\u043a\u0438, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u0435 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0430 \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0444\u0438\u043b\u044c\u0442\u0440\u044b. \u041d\u0430 \u0433\u0438\u0441\u0442\u043e\u0433\u0440\u0430\u043c\u043c\u0430\u0445 \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0431\u0430\u043a\u0435\u0442\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u044f\u044e\u0442 \u0438 \u043f\u043e\u0434\u0441\u0447\u0438\u0442\u044b\u0432\u0430\u044e\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0432 \u0441\u0432\u043e\u0435\u043c \u0438\u043d\u0442\u0435\u0440\u0432\u0430\u043b\u0435.<\/p>\n<p>  <\/p>\n<p>\u041a\u043e\u0433\u0434\u0430 \u0432\u044b \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u0435 \u043c\u0435\u0442\u0440\u0438\u043a\u0438, \u0432\u0430\u043c \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f \u043c\u0435\u0442\u043e\u0434 \u043d\u0430\u0431\u043b\u044e\u0434\u0435\u043d\u0438\u044f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043e\u0447\u043d\u043e\u0439 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438.<\/p>\n<p>  <\/p>\n<pre><code class=\"go\">const request_duration = new prom.Histogram({     name: \"request_duration_ms\",     help: \"Request duration histogram\",     labelNames: [\"method\",\"path\",\"statuscode\"],     buckets: [0.1, 5, 10, 15, 50, 100, 200, 500] })  const active_request = new prom.Gauge({     name: \"active_requests_count\",     help: \"Count active requests\",     labelNames: [\"path\"] })  registry.registerMetric(request_duration) registry.registerMetric(active_request)  const getRequestDuration = (req, res, next) => {     const start = Date.now();     res.on('finish', () => {         const duration = Date.now() - start;         request_duration.labels(req.url, req.method, res.statusCode).observe(duration)     });     next(); };  const countActiveRequest = (req, res, next) => {     active_request.inc()     res.on('finish', () => {         active_request.dec()     })     next(); }  module.exports = {getRequestDuration, countActiveRequest, registerPromMetrics}<\/code><\/pre>\n<p>  <\/p>\n<p>\u0417\u0430\u0442\u0435\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043e\u0447\u043d\u043e\u0439 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u044e\u0442\u0441\u044f express.<\/p>\n<p>  <\/p>\n<pre><code class=\"go\">const { countActiveRequest,getRequestDuration,registerPromMetrics } = require('.\/telemetry\/metrics')  const app = express();  app.use(countActiveRequest) app.use(getRequestDuration)      app.use('\/',getRouter) app.get('\/metrics',registerPromMetrics) app.listen(process.env.SERVER_PORT, () => {     logger.info(`Server Ready and Listening to port ${process.env.SERVER_PORT} `) })<\/code><\/pre>\n<p>  <\/p>\n<h2 id=\"primer-prilozheniya\">\u041f\u0440\u0438\u043c\u0435\u0440 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f<\/h2>\n<p>  <\/p>\n<p>\u0412\u0441\u0435 \u0440\u0435\u0441\u0443\u0440\u0441\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0432 \u044d\u0442\u043e\u0439 \u0441\u0435\u0440\u0438\u0438 \u0441\u0442\u0430\u0442\u0435\u0439, \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b \u0432 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438 \u043d\u0430 GitHub: <a href=\"https:\/\/github.com\/jonathanbc92\/observability-quickstart\/tree\/master\/part1\">https:\/\/github.com\/jonathanbc92\/observability-quickstart\/tree\/master\/part1<\/a><\/p>\n<p>  <\/p>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0434\u043b\u044f \u044d\u0442\u043e\u0439 \u0441\u0435\u0440\u0438\u0438 \u0441\u0442\u0430\u0442\u0435\u0439 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0437\u0432\u0435\u0440\u043d\u0443\u0442 \u043d\u0430 Minikube. \u041e\u043d\u043e \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0438\u0437 \u0442\u0440\u0435\u0445 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u043e\u0432 Node.js:<\/p>\n<p>  <\/p>\n<ol>\n<li><strong>People Service<\/strong> \u2014 \u0441\u0435\u0440\u0432\u0438\u0441 \u0441 \u043f\u0440\u043e\u0441\u0442\u044b\u043c \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u043c \u043d\u0430 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438\u0437 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0432 MySQL.<\/li>\n<li><strong>Format Service<\/strong> \u2014 \u0441\u0435\u0440\u0432\u0438\u0441, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0444\u043e\u0440\u043c\u0430\u0442\u0438\u0440\u0443\u0435\u0442 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0438\u0437 People Service.<\/li>\n<li><strong>Hello Service<\/strong> \u2014 \u0441\u0435\u0440\u0432\u0438\u0441, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0435 \u0441\u0435\u0440\u0432\u0438\u0441\u044b \u0438 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 \u0438\u0442\u043e\u0433\u043e\u0432\u043e\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e.<\/li>\n<\/ol>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/t_\/au\/-s\/t_au-sv4becijalsfk0nfdakk7g.png\" alt=\"image\" data-src=\"https:\/\/habrastorage.org\/webt\/t_\/au\/-s\/t_au-sv4becijalsfk0nfdakk7g.png\"\/><\/p>\n<p>  <\/p>\n<p>\u0423 \u0432\u0441\u0435\u0445 \u043c\u0438\u043a\u0440\u043e\u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432 \u0443\u0436\u0435 \u0435\u0441\u0442\u044c \u0434\u0435\u0444\u043e\u043b\u0442\u043d\u044b\u0435 \u0438 \u043a\u0430\u0441\u0442\u043e\u043c\u043d\u044b\u0435 \u043c\u0435\u0442\u0440\u0438\u043a\u0438 \u0432 \u0444\u0430\u0439\u043b\u0435 <strong>metrics.js<\/strong>.<\/p>\n<p>  <\/p>\n<p>\u0427\u0442\u043e\u0431\u044b \u0437\u0430\u0434\u0435\u043f\u043b\u043e\u0438\u0442\u044c \u0432\u0435\u0441\u044c \u043d\u0430\u0431\u043e\u0440 (\u0432\u043a\u043b\u044e\u0447\u0430\u044f Prometheus), \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u0443 <code>make<\/code>.<\/p>\n<p>  <\/p>\n<p>\u0427\u0442\u043e\u0431\u044b \u043f\u0440\u043e\u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435, \u043f\u0440\u043e\u0431\u0440\u043e\u0441\u044c\u0442\u0435 \u043f\u043e\u0440\u0442 \u043d\u0430 \u043f\u043e\u0440\u0442 hello service 8080, \u0430 \u0437\u0430\u0442\u0435\u043c \u0441\u0434\u0435\u043b\u0430\u0439\u0442\u0435 \u0437\u0430\u043f\u0440\u043e\u0441 \u043d\u0430 localhost:8080\/sayHello\/{name}<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">curl http:\/\/localhost:8081\/sayHello\/iroh Hey! this is iroh, here is my message to you:  It is important to draw wisdom from many different places<\/code><\/pre>\n<p>  <\/p>\n<h2 id=\"monitoring-servisov\">\u041c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u043d\u0433 \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432<\/h2>\n<p>  <\/p>\n<p>\u0412\u0430\u0436\u043d\u043e \u043f\u043e\u043d\u0438\u043c\u0430\u0442\u044c, \u0447\u0442\u043e \u043e\u0442 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u044f \u0438\u043b\u0438 \u043d\u0430\u043b\u0438\u0447\u0438\u044f \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0430 \u043f\u0440\u0438 \u0434\u0435\u043f\u043b\u043e\u0439\u043c\u0435\u043d\u0442\u0435 Prometheus \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044f, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u0430\u044f \u0434\u043b\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f target services (\u0446\u0435\u043b\u0435\u0432\u044b\u0445 \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432).<\/p>\n<p>  <\/p>\n<p>\u0415\u0441\u043b\u0438 Prometheus \u0437\u0430\u0434\u0435\u043f\u043b\u043e\u0435\u043d \u0431\u0435\u0437 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0430, \u043c\u044b \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u043c targets (\u0446\u0435\u043b\u0438) \u0432 \u0444\u0430\u0439\u043b\u0435 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438.<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">scrape_configs:   - job_name:       'node'     # Override the global default and scrape targets from this job every 5 seconds.     scrape_interval: 5s     static_configs:       - targets: ['localhost:8080', 'localhost:8081']         labels:           group: 'production'       - targets: ['localhost:8082']         labels:           group: 'canary'<\/code><\/pre>\n<p>  <\/p>\n<p>\u0415\u0441\u043b\u0438 \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440, \u043d\u0443\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043a\u0430\u0441\u0442\u043e\u043c\u043d\u044b\u0435 \u0440\u0435\u0441\u0443\u0440\u0441\u044b \u2014 ServiceMonitor. ServiceMonitor \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442, \u043a\u0430\u043a \u043c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u0442\u044c \u0441\u0435\u0440\u0432\u0438\u0441\u044b Kubernetes, \u0438 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0441\u043e\u0437\u0434\u0430\u0435\u0442 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e \u0441\u043a\u0440\u0435\u0439\u043f\u0430 <em>(\u043f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u0435 \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0447\u0438\u043a\u0430: \u041a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0441\u0431\u043e\u0440\u0430 \u043c\u0435\u0442\u0440\u0438\u043a)<\/em>.<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/3v\/hf\/st\/3vhfstdcco9yy7kory9t8nfl3u0.png\" alt=\"image\" data-src=\"https:\/\/habrastorage.org\/webt\/3v\/hf\/st\/3vhfstdcco9yy7kory9t8nfl3u0.png\"\/><br \/>  <em>\u0421\u0445\u0435\u043c\u0430 ServiceMonitor<\/em><\/p>\n<p>  <\/p>\n<p>\u041a\u0430\u0441\u0442\u043e\u043c\u043d\u044b\u0439 \u0440\u0435\u0441\u0443\u0440\u0441 ServiceMonitor \u0441\u043e\u043f\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u0435\u0440\u0432\u0438\u0441\u044b \u0441 \u043c\u0435\u0442\u043a\u0430\u043c\u0438, \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u043c\u0438 \u0432 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0435 matchLabels \u0432 \u043d\u0435\u0439\u043c\u0441\u043f\u0435\u0439\u0441\u0435, \u0437\u0430\u0434\u0430\u043d\u043d\u043e\u043c \u0432 namespaceSelector. \u0421\u0435\u0440\u0432\u0438\u0441 \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0442\u044c \u043c\u043d\u043e\u0433\u043e \u043f\u043e\u0440\u0442\u043e\u0432, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043d\u0443\u0436\u043d\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u043f\u043e\u0440\u0442 \u0438 \u043f\u0443\u0442\u044c, \u0438\u0437 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0431\u0443\u0434\u0443\u0442 \u0441\u043e\u0431\u0438\u0440\u0430\u0442\u044c\u0441\u044f \u043c\u0435\u0442\u0440\u0438\u043a\u0438.<\/p>\n<p>  <\/p>\n<pre><code class=\"go\">apiVersion: monitoring.coreos.com\/v1 kind: ServiceMonitor metadata:   name: all-service-sm   namespace: observability   labels:     release: prometheus   spec:   selector:     matchLabels:       monitor: prometheus   namespaceSelector:     matchNames:     - applications   endpoints:   - port: http     path: \/metrics<\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u0440\u043e\u0432\u0435\u0440\u044c\u0442\u0435 \u043c\u0435\u0442\u043a\u0438, \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u043d\u044b\u0435 \u0432 ServiceMonitor, \u2014 Prometheus \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0431\u0438\u0440\u0430\u0442\u044c ServiceMonitor, \u0443 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043d\u0435\u0442 \u043d\u0443\u0436\u043d\u044b\u0445 \u043c\u0435\u0442\u043e\u043a. \u0427\u0442\u043e \u044d\u0442\u043e \u0437\u0430 \u043c\u0435\u0442\u043a\u0438? \u0412 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u043a\u0430\u0441\u0442\u043e\u043c\u043d\u043e\u0433\u043e \u0440\u0435\u0441\u0443\u0440\u0441\u0430 Prometheus \u0432\u0438\u0434\u0438\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">kubectl get prometheuses prometheus-kube-prometheus-prometheus -n observability -o yaml alerting:     alertmanagers:     - apiVersion: v2       name: prometheus-kube-prometheus-alertmanager       namespace: observability       pathPrefix: \/       port: web   enableAdminAPI: false   externalUrl: http:\/\/prometheus-kube-prometheus-prometheus.observability:9090   image: quay.io\/prometheus\/prometheus:v2.26.0   listenLocal: false   logFormat: logfmt   logLevel: info   paused: false   podMonitorNamespaceSelector: {}   podMonitorSelector:     matchLabels:       release: prometheus   portName: web   probeNamespaceSelector: {}   probeSelector:     matchLabels:       release: prometheus   replicas: 1   retention: 10d   routePrefix: \/   ruleNamespaceSelector: {}   ruleSelector:     matchLabels:       app: kube-prometheus-stack       release: prometheus   securityContext:     fsGroup: 2000     runAsGroup: 2000     runAsNonRoot: true     runAsUser: 1000   serviceAccountName: prometheus-kube-prometheus-prometheus   serviceMonitorNamespaceSelector: {}   serviceMonitorSelector:     matchLabels:       release: prometheus   shards: 1   version: v2.26.0<\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b serviceMonitorSelector \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0442, \u043a\u0430\u043a\u0438\u0435 \u043c\u0435\u0442\u043a\u0438 \u0434\u043e\u043b\u0436\u043d\u044b \u0431\u044b\u0442\u044c \u0443 ServiceMonitor, \u0447\u0442\u043e\u0431\u044b Prometheus \u043c\u043e\u0433 \u0435\u0433\u043e \u0432\u044b\u0431\u0440\u0430\u0442\u044c.<\/p>\n<p>  <\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0443\u0436\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c ServiceMonitor:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">kubectl apply -f k8s\/config\/prometheus\/servicemonitoring.yml<\/code><\/pre>\n<p>  <\/p>\n<p>\u0415\u0441\u043b\u0438 \u0432\u0441\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c, \u043f\u0435\u0440\u0435\u0439\u0434\u0435\u043c \u0432 \u0440\u0430\u0437\u0434\u0435\u043b Targets (\u0426\u0435\u043b\u0435\u0432\u044b\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u044b) \u0432 \u043c\u0435\u043d\u044e Status (\u0421\u0442\u0430\u0442\u0443\u0441) \u0432 Prometheus. \u041c\u044b \u0443\u0432\u0438\u0434\u0438\u043c \u0432\u0441\u0435 \u043f\u043e\u0434\u044b, \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0435 \u0441 \u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u0435\u043c\u044b\u043c\u0438 \u0441\u0435\u0440\u0432\u0438\u0441\u0430\u043c\u0438.<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/ym\/ix\/in\/ymixinh0j7mmcfezpyfwtktemrq.png\" alt=\"image\" data-src=\"https:\/\/habrastorage.org\/webt\/ym\/ix\/in\/ymixinh0j7mmcfezpyfwtktemrq.png\"\/><br \/>  <em>\u042d\u043d\u0434\u043f\u043e\u0438\u043d\u0442\u044b, \u0441 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 Prometheus \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u0442 \u043c\u0435\u0442\u0440\u0438\u043a\u0438<\/em><\/p>\n<p>  <\/p>\n<p>\u041a\u043e\u0433\u0434\u0430 \u043d\u043e\u0432\u044b\u0435 \u043c\u0435\u0442\u0440\u0438\u043a\u0438 \u0431\u0443\u0434\u0443\u0442 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b, \u0432\u044b \u0441\u043c\u043e\u0436\u0435\u0442\u0435 \u0437\u0430\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u0442\u044c \u0438\u0445 \u0432 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0435 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0439 (expression browser).<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/f0\/-m\/jw\/f0-mjwoqvy75h29zzrbeqhdzybu.png\" alt=\"image\" data-src=\"https:\/\/habrastorage.org\/webt\/f0\/-m\/jw\/f0-mjwoqvy75h29zzrbeqhdzybu.png\"\/><br \/>  <em>\u0420\u0430\u0437\u043c\u0435\u0440 \u043a\u0443\u0447\u0438 Node.js \u0432 Prometheus<\/em><\/p>\n<p>  <\/p>\n<h2 id=\"eksportery\">\u042d\u043a\u0441\u043f\u043e\u0440\u0442\u0435\u0440\u044b<\/h2>\n<p>  <\/p>\n<p>\u041e \u0441\u0435\u0440\u0432\u0438\u0441\u0430\u0445 Node.js \u043c\u044b \u0443\u0436\u0435 \u043f\u043e\u0433\u043e\u0432\u043e\u0440\u0438\u043b\u0438. \u041a\u0430\u043a \u043d\u0430\u0441\u0447\u0435\u0442 MySQL? \u041c\u0435\u0442\u0440\u0438\u043a\u0438 \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445 \u043d\u0430\u043c \u0442\u043e\u0436\u0435 \u043d\u0443\u0436\u043d\u044b. \u0427\u0442\u043e\u0431\u044b \u044d\u043a\u0441\u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438\u043c\u0435\u044e\u0449\u0438\u0435\u0441\u044f \u043c\u0435\u0442\u0440\u0438\u043a\u0438 \u0438\u0437 \u0441\u0442\u043e\u0440\u043e\u043d\u043d\u0438\u0445 \u0441\u0438\u0441\u0442\u0435\u043c \u0432 \u0432\u0438\u0434\u0435 \u043c\u0435\u0442\u0440\u0438\u043a Prometheus, \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u044d\u043a\u0441\u043f\u043e\u0440\u0442\u0435\u0440\u044b.<\/p>\n<p>  <\/p>\n<p>\u0412\u044b\u0431\u043e\u0440 \u044d\u043a\u0441\u043f\u043e\u0440\u0442\u0435\u0440\u043e\u0432 \u0431\u043e\u0433\u0430\u0442\u044b\u0439. \u0412\u043e\u0442 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0438\u0437 \u043d\u0438\u0445: <a href=\"https:\/\/prometheus.io\/docs\/instrumenting\/exporters\/\">https:\/\/prometheus.io\/docs\/instrumenting\/exporters\/<\/a><\/p>\n<p>  <\/p>\n<p>\u041c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c <a href=\"https:\/\/github.com\/prometheus\/mysqld_exporter\">\u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0439<\/a> \u043e\u0431\u0440\u0430\u0437 \u044d\u043a\u0441\u043f\u043e\u0440\u0442\u0435\u0440\u0430 MySQL \u0438 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u043c \u0435\u0433\u043e \u0441 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u043e\u043c MySQL. \u0414\u043b\u044f \u043e\u0431\u0440\u0430\u0437\u0430 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f \u0441\u0440\u0435\u0434\u044b <code>DATA_SOURCE_NAME<\/code>, \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043e \u0438\u0437 \u0441\u0435\u043a\u0440\u0435\u0442\u0430. \u041f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u0432\u0441\u0435 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u044b \u0432 \u043f\u043e\u0434\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442 \u043e\u0434\u043d\u0443 \u0441\u0435\u0442\u044c, \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c localhost, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c\u0441\u044f \u043a MySQL.<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">kubectl create secret generic mysql-credentials --from-literal=username=root --from-literal=password=admin --from-literal=datasource=\"exporter:exportpass@(localhost:3306)\/tutorial\" -n applications<\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432 \u0432 Kubernetes \u043d\u0430 \u0432\u043a\u043b\u0430\u0434\u043a\u0435 Prometheus Targets \u043c\u044b \u0443\u0432\u0438\u0434\u0438\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435:<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/nv\/ah\/xt\/nvahxtoytunlihksmmz5xuow2po.png\" alt=\"image\" data-src=\"https:\/\/habrastorage.org\/webt\/nv\/ah\/xt\/nvahxtoytunlihksmmz5xuow2po.png\"\/><\/p>\n<p>  <\/p>\n<p>\u0412 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0435 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0439 Prometheus \u043c\u044b \u0443\u0432\u0438\u0434\u0438\u043c, \u0447\u0442\u043e \u043c\u0435\u0442\u0440\u0438\u043a\u0438 MySQL \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b.<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/c6\/ki\/kx\/c6kikxexm_uqr70oivgiady_cqm.png\" alt=\"image\" data-src=\"https:\/\/habrastorage.org\/webt\/c6\/ki\/kx\/c6kikxexm_uqr70oivgiady_cqm.png\"\/><br \/>  <em>\u041c\u0435\u0442\u0440\u0438\u043a\u0438 MySQL \u0432 Prometheus<\/em><\/p>\n<p>  <\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u044e <code>rate<\/code>, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0441\u0440\u0435\u0434\u043d\u0438\u0439 \u0440\u043e\u0441\u0442 \u0434\u043b\u044f \u043a\u043e\u043c\u0430\u043d\u0434 select \u0437\u0430 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0439 \u043f\u0435\u0440\u0438\u043e\u0434. \u042d\u0442\u043e \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u0438 \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u043a\u043e\u043c\u0430\u043d\u0434 select, \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u043d\u044b\u0445 \u044d\u043a\u0441\u043f\u043e\u0440\u0442\u0435\u0440\u043e\u043c \u0434\u043b\u044f \u0441\u0431\u043e\u0440\u0430 \u043c\u0435\u0442\u0440\u0438\u043a.<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/sq\/lv\/4v\/sqlv4vmz4cgugkvwl55lxj8_tly.png\" alt=\"image\" data-src=\"https:\/\/habrastorage.org\/webt\/sq\/lv\/4v\/sqlv4vmz4cgugkvwl55lxj8_tly.png\"\/><\/p>\n<p>  <\/p>\n<p>\u0415\u0441\u043b\u0438 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0442\u043e \u0436\u0435 \u0441\u0430\u043c\u043e\u0435 \u0441 \u043a\u043e\u043c\u0430\u043d\u0434\u0430\u043c\u0438 delete, \u043c\u044b \u0443\u0432\u0438\u0434\u0438\u043c 0, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043a\u043e\u043c\u0430\u043d\u0434\u044b delete \u043d\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u043b\u0438\u0441\u044c.<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/qg\/3y\/-f\/qg3y-fglj8wb8pildbsftxxor6k.png\" alt=\"image\" data-src=\"https:\/\/habrastorage.org\/webt\/qg\/3y\/-f\/qg3y-fglj8wb8pildbsftxxor6k.png\"\/><\/p>\n<p>  <\/p>\n<p>\u0421 \u043f\u043e\u043c\u043e\u0449\u044c\u044e Apache Benchmark \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0432\u0435\u0441\u0442\u0438 \u043d\u0430\u0433\u0440\u0443\u0437\u043e\u0447\u043d\u043e\u0435 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435, \u0447\u0442\u043e\u0431\u044b \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043f\u0438\u043a.<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/gs\/ir\/3y\/gsir3yu_g9knufp2qj64z65u_uy.png\" alt=\"image\" data-src=\"https:\/\/habrastorage.org\/webt\/gs\/ir\/3y\/gsir3yu_g9knufp2qj64z65u_uy.png\"\/><br \/>  <em>20\u043a \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u0441 AB<\/em><\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/se\/mt\/_l\/semt_leze_xkbxeu17czjechigo.png\" alt=\"image\" data-src=\"https:\/\/habrastorage.org\/webt\/se\/mt\/_l\/semt_leze_xkbxeu17czjechigo.png\"\/><br \/>  <em>\u041f\u0438\u043a \u0434\u043b\u044f \u043a\u043e\u043c\u0430\u043d\u0434 select \u0432 Prometheus<\/em><\/p>\n<p>  <\/p>\n<h2 id=\"zaklyuchenie\">\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h2>\n<p>  <\/p>\n<p>\u041a\u0430\u043a \u0432\u0438\u0434\u0438\u0442\u0435, \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c Prometheus \u0441 helm-\u0447\u0430\u0440\u0442\u043e\u043c \u043e\u0447\u0435\u043d\u044c \u043f\u0440\u043e\u0441\u0442\u043e \u2014 \u0432\u0430\u043c \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f \u043f\u0430\u0440\u0430 \u043c\u0438\u043d\u0443\u0442 \u0438 Minikube. \u041a\u043e\u043d\u0435\u0447\u043d\u043e, \u0432 \u043f\u0435\u0440\u0432\u044b\u0439 \u0440\u0430\u0437 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043d\u0430 \u043c\u0435\u0442\u0440\u0438\u043a\u0438 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e, \u043d\u043e \u0441\u0430\u043c\u0438 \u043f\u043e \u0441\u0435\u0431\u0435 \u043e\u043d\u0438 \u043c\u0430\u043b\u043e \u0447\u0442\u043e \u0434\u0430\u044e\u0442. \u0412 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0440\u0430\u0437 \u043c\u044b \u043f\u043e\u0433\u043e\u0432\u043e\u0440\u0438\u043c \u043e\u0431 \u0430\u043b\u0435\u0440\u0442\u0430\u0445.<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \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\/569860\/\"> https:\/\/habr.com\/ru\/articles\/569860\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><!--[--><img loading=\"lazy\" decoding=\"async\" height=\"1\" src=\"https:\/\/www.facebook.com\/tr?id=971720443354181&amp;ev=PageView&amp;noscript=1\" style=\"display:none;\" width=\"1\"><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-1\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/webt\/gk\/_l\/sn\/gk_lsn9i8qcxjqalkffdabix7r0.jpeg\" alt=\"image\" data-src=\"https:\/\/habrastorage.org\/webt\/gk\/_l\/sn\/gk_lsn9i8qcxjqalkffdabix7r0.jpeg\" data-blurred=\"true\"\/><br \/>  <em>\u0424\u043e\u0442\u043e ETA+, Unsplash.com<\/em><\/p>\n<p>  <\/p>\n<h4 id=\"pervye-shagi-v-storonu-observability--sobiraem-metriki-s-prometheus\">\u041f\u0435\u0440\u0432\u044b\u0435 \u0448\u0430\u0433\u0438 \u0432 \u0441\u0442\u043e\u0440\u043e\u043d\u0443 observability \u2014 \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u043c \u043c\u0435\u0442\u0440\u0438\u043a\u0438 \u0441 Prometheus<\/h4>\n<p>  <\/p>\n<p>\u041f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u044c\u0442\u0435 \u0441\u0435\u0431\u0435 \u0447\u0435\u043b\u043e\u0432\u0435\u043a\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u044c\u0435\u0442\u0441\u044f \u043d\u0430\u0434 \u0440\u0435\u0448\u0435\u043d\u0438\u0435\u043c \u0437\u0430\u0433\u0430\u0434\u043a\u0438, \u0430 \u0432\u043e\u043a\u0440\u0443\u0433 \u0441\u043e\u0431\u0440\u0430\u043b\u043e\u0441\u044c \u0441 \u0434\u0435\u0441\u044f\u0442\u043e\u043a \u0441\u043e\u0432\u0435\u0442\u0447\u0438\u043a\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u043c\u043e\u0433\u0430\u044e\u0442 \u0435\u043c\u0443 \u00ab\u043d\u0430\u0439\u0442\u0438 \u0443\u0431\u0438\u0439\u0446\u0443\u00bb. \u0417\u043d\u0430\u043a\u043e\u043c\u0430\u044f \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044f? \u0412 \u0442\u0430\u043a\u0438\u0445 \u0441\u043b\u0443\u0447\u0430\u044f\u0445 \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442 \u0431\u043e\u043b\u044c\u0448\u0435 \u0432\u043e\u043f\u0440\u043e\u0441\u043e\u0432, \u0447\u0435\u043c \u043e\u0442\u0432\u0435\u0442\u043e\u0432, \u0438 \u0435\u0441\u043b\u0438 \u043e\u0442\u0432\u0435\u0447\u0430\u0442\u044c \u043d\u0430 \u0432\u0441\u0435 \u044d\u0442\u0438 \u0432\u043e\u043f\u0440\u043e\u0441\u044b, \u043d\u0438 \u043d\u0430 \u0447\u0442\u043e \u0434\u0440\u0443\u0433\u043e\u0435 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0443\u0436\u0435 \u043d\u0435 \u043e\u0441\u0442\u0430\u043d\u0435\u0442\u0441\u044f.<\/p>\n<p>  <\/p>\n<p>\u0421\u043b\u043e\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u0442\u043e, \u0447\u0435\u0433\u043e \u043d\u0435 \u0437\u043d\u0430\u0435\u0448\u044c \u0438 \u043d\u0435 \u043f\u043e\u043d\u0438\u043c\u0430\u0435\u0448\u044c. \u0412\u043e\u0442 \u0442\u0443\u0442-\u0442\u043e \u043d\u0430 \u043f\u043e\u043c\u043e\u0449\u044c \u0438 \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442 observability (\u043d\u0430\u0431\u043b\u044e\u0434\u0430\u0435\u043c\u043e\u0441\u0442\u044c). \u041e\u043d\u0430 \u043f\u043e\u043c\u043e\u0433\u0430\u0435\u0442 \u043f\u043e\u043d\u044f\u0442\u044c, \u0447\u0442\u043e \u0441\u043b\u043e\u043c\u0430\u043b\u043e\u0441\u044c \u0438\u043b\u0438 \u043f\u043b\u043e\u0445\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442, \u0438 \u0434\u0430\u0436\u0435 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043d\u0430\u0439\u0442\u0438 \u043f\u0440\u0438\u0447\u0438\u043d\u0443, \u0447\u0442\u043e\u0431\u044b \u0432\u044b \u043c\u043e\u0433\u043b\u0438 \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u043e \u0432\u043d\u043e\u0441\u0438\u0442\u044c \u0443\u043b\u0443\u0447\u0448\u0435\u043d\u0438\u044f.<\/p>\n<p>  <\/p>\n<h2 id=\"chto-takoe-observability\">\u0427\u0442\u043e \u0442\u0430\u043a\u043e\u0435 observability<\/h2>\n<p>  <\/p>\n<p>\u041f\u043e\u0434 observability \u043c\u044b \u043f\u043e\u0434\u0440\u0430\u0437\u0443\u043c\u0435\u0432\u0430\u0435\u043c \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u0442\u043e\u0433\u043e, \u043d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u043e \u043c\u043e\u0436\u043d\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0435\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u043f\u043e \u0435\u0435 \u0432\u044b\u0445\u043e\u0434\u043d\u044b\u043c \u0434\u0430\u043d\u043d\u044b\u043c (\u0442\u0435\u043b\u0435\u043c\u0435\u0442\u0440\u0438\u0438). \u041d\u0438\u0447\u0435\u0433\u043e \u043d\u043e\u0432\u043e\u0433\u043e \u0432 \u044d\u0442\u043e\u043c \u043d\u0435\u0442 \u2014 \u043c\u044b \u043f\u044b\u0442\u0430\u0435\u043c\u0441\u044f \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c\u0441\u044f \u0432 \u0440\u0430\u0431\u043e\u0442\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u043f\u043e \u043b\u043e\u0433\u0430\u043c \u0441 \u043d\u0430\u0447\u0430\u043b\u0430 \u0432\u0440\u0435\u043c\u0435\u043d, \u043d\u043e \u0441\u0435\u0439\u0447\u0430\u0441 \u0432\u0441\u0435 \u043e\u0441\u043b\u043e\u0436\u043d\u044f\u0435\u0442\u0441\u044f \u043e\u0431\u043b\u0430\u043a\u0430\u043c\u0438, \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0430\u043c\u0438, \u043c\u0438\u043a\u0440\u043e\u0441\u0435\u0440\u0432\u0438\u0441\u0430\u043c\u0438, \u043c\u043d\u043e\u0433\u043e\u044f\u0437\u044b\u0447\u043d\u044b\u043c\u0438 \u0441\u0440\u0435\u0434\u0430\u043c\u0438 \u0438 \u0442. \u0434.<\/p>\n<p>  <\/p>\n<h2 id=\"tri-kita-observability\">\u0422\u0440\u0438 \u043a\u0438\u0442\u0430 observability<\/h2>\n<p>  <\/p>\n<p>Observability \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u0430 \u043d\u0430 \u0442\u0440\u0435\u0445 \u0433\u043b\u0430\u0432\u043d\u044b\u0445 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430\u0445. \u042d\u0442\u043e \u0434\u0430\u043d\u043d\u044b\u0435 \u0442\u0435\u043b\u0435\u043c\u0435\u0442\u0440\u0438\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0436\u043d\u043e \u0430\u0433\u0440\u0435\u0433\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438 \u0430\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043d\u044f\u0442\u044c \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0441\u0438\u0441\u0442\u0435\u043c\u044b:<\/p>\n<p>  <\/p>\n<ol>\n<li>\u041c\u0435\u0442\u0440\u0438\u043a\u0438.<\/li>\n<li>\u0422\u0440\u0430\u0441\u0441\u0438\u0440\u043e\u0432\u043a\u0438.<\/li>\n<li>\u041b\u043e\u0433\u0438.<\/li>\n<\/ol>\n<p>  <\/p>\n<p>\u0412 \u044d\u0442\u043e\u0439 \u0441\u0435\u0440\u0438\u0438 \u0441\u0442\u0430\u0442\u0435\u0439 \u043c\u044b \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0432\u0441\u0435 \u0442\u0440\u0438 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430 \u0441 \u043f\u0440\u0438\u043c\u0435\u0440\u0430\u043c\u0438. \u041d\u0430\u0447\u043d\u0435\u043c \u0441 \u043c\u0435\u0442\u0440\u0438\u043a \u0438 \u043e\u043f\u0435\u043d\u0441\u043e\u0440\u0441-\u043f\u0440\u043e\u0435\u043a\u0442\u0430 Prometheus.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-387018","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/387018","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=387018"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/387018\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=387018"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=387018"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=387018"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}