{"id":323991,"date":"2021-05-30T09:00:15","date_gmt":"2021-05-30T09:00:15","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=323991"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=323991","title":{"rendered":"\u0412\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0430\u043d\u0430\u043b\u0438\u0442\u0438\u043a\u0438 APIM Gravitee \u0432 Grafana"},"content":{"rendered":"\n<div class=\"post__text post__text_v2\" id=\"post-content-body\">\n<p>\u0411\u0435\u0441\u0441\u043f\u043e\u0440\u043d\u043e, \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 Gravitee \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043d\u0430\u0433\u043b\u044f\u0434\u043d\u044b\u0435 \u0438 \u0443\u0434\u043e\u0431\u043d\u044b\u0435 \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0430 \u0432\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0440\u0430\u0431\u043e\u0442\u044b \u0448\u043b\u044e\u0437\u043e\u0432 Gravitee. \u041d\u043e \u0432 \u043b\u044e\u0431\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435, \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442 \u043f\u043e\u0442\u0440\u0435\u0431\u043d\u043e\u0441\u0442\u044c \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u044d\u0442\u0438\u043c \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430\u043c \u0441\u043b\u0443\u0436\u0431\u0435 \u043c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u043d\u0433\u0430, \u0432\u043b\u0430\u0434\u0435\u043b\u044c\u0446\u0430\u043c \u0438\u043b\u0438 \u043f\u043e\u0442\u0440\u0435\u0431\u0438\u0442\u0435\u043b\u044f\u043c API \u0438 \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u043e\u043d\u0438 \u043c\u043e\u0433\u0443\u0442 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432\u043d\u0435 \u0437\u0430\u043a\u0440\u044b\u0442\u043e\u0433\u043e \u043a\u043e\u043d\u0442\u0443\u0440\u0430, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d \u043c\u0435\u043d\u0435\u0434\u0436\u0435\u0440 API. \u0414\u0430 \u0438 \u0438\u043c\u0435\u0442\u044c \u0432\u0441\u044e \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u0443\u044e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043f\u043e \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u043c API \u043d\u0430 \u043e\u0434\u043d\u043e\u043c \u044d\u043a\u0440\u0430\u043d\u0435 \u0432\u0441\u0435\u0433\u0434\u0430 \u0443\u0434\u043e\u0431\u043d\u0435\u0435.<br \/>\u0412\u0438\u0434\u0435\u0442\u044c \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u044f\u0449\u0435\u0435 \u043d\u0430 \u0448\u043b\u044e\u0437\u0430\u0445, \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u043d\u0435 \u0432\u0434\u0430\u0432\u0430\u044f\u0441\u044c \u0432 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 Gravitee, \u0430 \u0430\u0434\u043c\u0438\u043d\u0438\u0441\u0442\u0440\u0430\u0442\u043e\u0440\u0430\u043c &#8212; \u043d\u0435 \u0442\u0440\u0430\u0442\u0438\u0442\u044c \u0432\u0440\u0435\u043c\u044f \u043d\u0430 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 \u0438 \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0440\u043e\u043b\u0435\u0439 \u0438 \u043f\u0440\u0438\u0432\u0438\u043b\u0435\u0433\u0438\u0439 \u0432\u043d\u0443\u0442\u0440\u0438 Gravitee.<br \/>\u041d\u0430 \u0425\u0430\u0431\u0440\u0435 \u0443\u0436\u0435 \u0431\u044b\u043b\u0430 \u043f\u0430\u0440\u0430 \u0441\u0442\u0430\u0442\u0435\u0439 \u043f\u043e\u0441\u0432\u044f\u0449\u0435\u043d\u043d\u044b\u0445 APIM Gravitee, <a href=\"https:\/\/habr.com\/ru\/company\/X5RetailGroup\/blog\/543324\/\" rel=\"noopener noreferrer nofollow\">\u0442\u0443\u0442<\/a> \u0438 <a href=\"https:\/\/habr.com\/ru\/company\/X5RetailGroup\/blog\/559686\/\" rel=\"noopener noreferrer nofollow\">\u0442\u0443\u0442<\/a>. \u041f\u043e \u044d\u0442\u043e\u043c\u0443, \u0432 \u0441\u0432\u043e\u0435\u0439 \u0437\u0430\u043c\u0435\u0442\u043a\u0435, \u0431\u0443\u0434\u0443 \u043f\u043e\u0434\u0440\u0430\u0437\u0443\u043c\u0435\u0432\u0430\u0442\u044c, \u0447\u0442\u043e \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u044c \u0443\u0436\u0435 \u0437\u043d\u0430\u043a\u043e\u043c \u0441 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u043c \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438\/\u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 APIM Gravitee \u0438 Grafana, \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u044e \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0438\u0445 \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u0438.<\/p>\n<h3>\u041f\u043e\u0447\u0435\u043c\u0443 \u043d\u0435\u043b\u044c\u0437\u044f \u043f\u043e\u0439\u0442\u0438 \u043f\u0440\u043e\u0441\u0442\u044b\u043c \u043f\u0443\u0442\u0451\u043c?<\/h3>\n<p>\u041f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e, \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0435\u043c \u0434\u043b\u044f \u0430\u043d\u0430\u043b\u0438\u0442\u0438\u043a\u0438 Gravitee \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f ElasticSearch. \u0418\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u043d\u0430\u043a\u0430\u043f\u043b\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0432 \u0447\u0435\u0442\u044b\u0440\u0451\u0445 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0438\u043d\u0434\u0435\u043a\u0441\u0430\u0445, \u0441 \u043f\u043e\u0441\u0443\u0442\u043e\u0447\u043d\u043e\u0439 \u0440\u0430\u0437\u0431\u0438\u0432\u043a\u043e\u0439:<\/p>\n<ul>\n<li>\n<p><strong>gravitee-request-YYYY.MM.DD<\/strong> &#8212; \u0437\u0434\u0435\u0441\u044c \u0445\u0440\u0430\u043d\u0438\u0442\u0441\u044f \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u043f\u043e \u043a\u0430\u0436\u0434\u043e\u043c\u0443 \u0437\u0430\u043f\u0440\u043e\u0441\u0443 (\u0430\u043d\u0430\u043b\u043e\u0433 access.log \u0432 nginx). \u042d\u0442\u043e \u043d\u0430\u0448\u0430 \u043e\u0441\u043d\u043e\u0432\u043d\u0430\u044f \u0446\u0435\u043b\u044c;<\/p>\n<\/li>\n<\/ul>\n<ul>\n<li>\n<p><strong>gravitee-log-YYYY.MM.DD<\/strong> &#8212; \u0437\u0434\u0435\u0441\u044c \u0443\u0436\u0435 \u0445\u0440\u0430\u043d\u0438\u0442\u0441\u044f \u0431\u043e\u043b\u0435\u0435 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0430\u044f \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u043e \u0437\u0430\u043f\u0440\u043e\u0441\u0435 (\u043f\u0440\u0438 \u0443\u0441\u043b\u043e\u0432\u0438\u0438, \u0447\u0442\u043e \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u0430 \u043e\u0442\u043b\u0430\u0434\u043a\u0430, \u0441\u043c. \u0440\u0438\u0441\u0443\u043d\u043e\u043a \u043d\u0438\u0436\u0435). \u0410 \u0438\u043c\u0435\u043d\u043d\u043e \u043f\u043e\u043b\u043d\u044b\u0435 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u0438 \u043e\u0442\u0432\u0435\u0442\u043e\u0432, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043f\u043e\u043b\u0435\u0437\u043d\u0430\u044f \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0430. \u0412 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043a, \u043b\u043e\u0433\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043c\u043e\u0436\u0435\u0442 \u043a\u0430\u043a \u043e\u0431\u043c\u0435\u043d \u043c\u0435\u0436\u0434\u0443 \u043f\u043e\u0442\u0440\u0435\u0431\u0438\u0442\u0435\u043b\u0435\u043c \u0438 \u0448\u043b\u044e\u0437\u043e\u043c, \u0442\u0430\u043a \u0438\/\u0438\u043b\u0438 \u0448\u043b\u044e\u0437\u043e\u043c \u0438 \u043f\u043e\u0441\u0442\u0430\u0432\u0449\u0438\u043a\u043e\u043c API;<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/6cd\/3ed\/fcb\/6cd3edfcb843b8bcb64275d42610fae9.png\" alt=\"\u042d\u043a\u0440\u0430\u043d \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f\/\u043e\u0442\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u043d\u043e\u0433\u043e \u043b\u043e\u0433\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f\" title=\"\u042d\u043a\u0440\u0430\u043d \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f\/\u043e\u0442\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u043d\u043e\u0433\u043e \u043b\u043e\u0433\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f\" width=\"973\" height=\"250\"><figcaption>\u042d\u043a\u0440\u0430\u043d \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f\/\u043e\u0442\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u043d\u043e\u0433\u043e \u043b\u043e\u0433\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f<\/figcaption><\/figure>\n<\/li>\n<\/ul>\n<ul>\n<li>\n<p><strong>gravitee-monitor-YYYY.MM.DD<\/strong> &#8212; \u044d\u0442\u043e\u0442 \u043d\u0430\u0441 \u043d\u0435 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0443\u0435\u0442;<\/p>\n<\/li>\n<li>\n<p><strong>gravitee-health-YYYY.MM.DD<\/strong> &#8212; \u044d\u0442\u043e\u0442 \u043d\u0430\u0441 \u043d\u0435 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0443\u0435\u0442.<\/p>\n<\/li>\n<\/ul>\n<p>\u0418 \u043a\u0430\u0437\u0430\u043b\u043e\u0441\u044c \u0431\u044b, \u0447\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043f\u0440\u043e\u0449\u0435: \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0439 ElasticSearch \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 Grafana \u0438 \u0432\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0439, \u043d\u043e \u043d\u0435 \u0432\u0441\u0451 \u0442\u0430\u043a \u043f\u0440\u043e\u0441\u0442\u043e. <br \/>\u0412\u043e \u043f\u0435\u0440\u0432\u044b\u0445, \u0432 \u0438\u043d\u0434\u0435\u043a\u0441\u0435 \u0445\u0440\u0430\u043d\u044f\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u044b \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432, \u0442.\u0435. \u0447\u0435\u043b\u043e\u0432\u0435\u043a\u043e-\u0447\u0438\u0442\u0430\u0435\u043c\u044b\u0445 \u0438\u043c\u0451\u043d \u043f\u043e\u0441\u0442\u0430\u0432\u0449\u0438\u043a\u043e\u0432 \u0438 \u043f\u043e\u0442\u0440\u0435\u0431\u0438\u0442\u0435\u043b\u0435\u0439, \u0432\u044b \u0442\u0430\u043c \u043d\u0435 \u0443\u0432\u0438\u0434\u0438\u0442\u0435. \u0412\u043e \u0432\u0442\u043e\u0440\u044b\u0445, \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043f\u043e\u043b\u043d\u0443\u044e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u0441\u043e\u0435\u0434\u0438\u043d\u0438\u0432 \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 \u0434\u0432\u0443\u0445 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u043e\u0432 \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0432 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0435 Grafana, \u043a\u0440\u0430\u0439\u043d\u0435 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430\u0442\u0438\u0447\u043d\u043e. Gravitee \u0445\u0440\u0430\u043d\u0438\u0442 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430\u0445 \u0438 \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0443 \u0441\u0432\u043e\u0435\u0439 \u0440\u0430\u0431\u043e\u0442\u044b \u0432 \u0440\u0430\u0437\u043d\u044b\u0445 \u043c\u0435\u0441\u0442\u0430\u0445. \u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438, \u0432 MongoDB \u0438\u043b\u0438 PostgreSQL, \u043f\u043e \u0441\u0443\u0442\u0438 \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f. \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u0432 \u043e\u0434\u043d\u043e\u043c \u043c\u0435\u0441\u0442\u0435 \u0443 \u043d\u0430\u0441 (\u0432 \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u0445 Grafana) &#8212; \u0442\u0430\u0431\u043b\u0438\u0446\u0430, \u0432 \u0434\u0440\u0443\u0433\u043e\u043c &#8212; \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u0440\u044f\u0434. <\/p>\n<h3>B \u043a\u0430\u043a \u0436\u0435 \u0431\u044b\u0442\u044c?<\/h3>\n<p>\u0411\u043e\u043b\u044c\u0448\u0438\u043c \u043f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u043e\u043c \u0421\u0423\u0411\u0414 PostgreSQL \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0431\u043e\u0433\u0430\u0442\u044b\u0439 \u043d\u0430\u0431\u043e\u0440 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0439 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0432\u043d\u0435\u0448\u043d\u0438\u043c\u0438 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0430\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u0445, \u0432 \u0442\u043e\u043c \u0447\u0438\u0441\u043b\u0435 \u0438 \u0441 ElasticSearch (<a href=\"https:\/\/github.com\/matthewfranglen\/postgres-elasticsearch-fdw\" rel=\"noopener noreferrer nofollow\">\u0442\u0443\u0442<\/a>). \u0411\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u044d\u0442\u043e\u043c\u0443 \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u044f \u0441\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u043a \u0442\u043e\u043c\u0443, \u0447\u0442\u043e Grafana \u043e\u0431\u0449\u0430\u0435\u0442\u0441\u044f \u0441 \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u043c \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u043e\u043c \u0434\u0430\u043d\u043d\u044b\u0445 &#8212; \u0421\u0423\u0411\u0414 PostgreSQL, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0432 \u0441\u0432\u043e\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 ElasticSearch \u0438 \u043e\u0431\u043e\u0433\u0430\u0449\u0430\u0435\u0442 \u0438\u0445 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0435\u0439 \u0438 \u0434\u0435\u043b\u0430\u0435\u0442 \u0447\u0438\u0442\u0430\u0435\u043c\u043e\u0439 \u0434\u043b\u044f \u0430\u0434\u043c\u0438\u043d\u0438\u0441\u0442\u0440\u0430\u0442\u043e\u0440\u0430 \u0438\u043b\u0438 \u043b\u044e\u0431\u043e\u0433\u043e \u0434\u0440\u0443\u0433\u043e\u0433\u043e \u0431\u0435\u043d\u0435\u0444\u0438\u0446\u0438\u0430\u0440\u0430.<br \/>\u0421\u0445\u0435\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u044d\u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c (\u0440\u0438\u0441\u0443\u043d\u043e\u043a \u043d\u0438\u0436\u0435).<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/cfc\/b52\/e9c\/cfcb52e9cea6499b76591b3ddb78ec83.png\" alt=\"\u0421\u0445\u0435\u043c\u0430 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u043c\u043e\u0434\u0443\u043b\u0435\u0439 Gravitee\" title=\"\u0421\u0445\u0435\u043c\u0430 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u043c\u043e\u0434\u0443\u043b\u0435\u0439 Gravitee\" width=\"762\" height=\"602\"><figcaption>\u0421\u0445\u0435\u043c\u0430 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u043c\u043e\u0434\u0443\u043b\u0435\u0439 Gravitee<\/figcaption><\/figure>\n<h3>\u041d\u0443 \u0447\u0442\u043e \u0436\u0435, \u0437\u0430 \u0434\u0435\u043b\u043e!<\/h3>\n<p>\u0412\u0441\u0435 \u043d\u0438\u0436\u0435 \u043e\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0430\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u044b \u0434\u043b\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438: CentOS 7, APIM Gravitee 3.6, \u0421\u0423\u0411\u0414 PostgreSQL 11, ElasticSearch 7.+<\/p>\n<p>\u041d\u0430\u0447\u043d\u0451\u043c \u0441 \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u0438 PostgreSQL \u0438 ElasticSearch. \u0421\u0430\u043c \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u0438 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043f\u0440\u043e\u0441\u0442 \u0438 \u0434\u0435\u043b\u0438\u0442\u0441\u044f \u043d\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0448\u0430\u0433\u0438:<\/p>\n<ol>\n<li>\n<p>\u0423\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0435 multicorn11 \u0438 \u0435\u0441\u043b\u0438 \u043d\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d pip, \u0442\u043e \u0441\u0442\u0430\u0432\u0438\u043c \u0438 \u0435\u0433\u043e:<\/p>\n<pre><code class=\"bash\">yum install multicorn11 python3-pip<\/code><\/pre>\n<\/li>\n<li>\n<p>\u0414\u0430\u043b\u0435\u0435 \u0438\u0437 pip-\u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u044f, \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 python3 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 ElasticSearch:<\/p>\n<pre><code class=\"bash\">pip3 install pg_es_fdw<\/code><\/pre>\n<\/li>\n<li>\n<p>\u0414\u0430\u043b\u0435\u0435, \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u043a \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0435  PostgreSQL. \u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u043c\u0441\u044f \u0446\u0435\u043b\u0435\u0432\u043e\u0439 \u0411\u0414 \u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0435 multicorn \u0438 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u0443\u044e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443:<\/p>\n<pre><code class=\"pgsql\">GRANT USAGE on FOREIGN DATA WRAPPER multicorn TO gatewaytest; GRANT USAGE ON FOREIGN SERVER multicorn_es TO gatewaytest;<\/code><\/pre>\n<pre><code class=\"pgsql\"> CREATE EXTENSION multicorn;  CREATE SERVER multicorn_es FOREIGN DATA WRAPPER multicorn   OPTIONS (wrapper 'pg_es_fdw.ElasticsearchFDW');<\/code><\/pre>\n<\/li>\n<li>\n<p>\u0412\u044b\u0434\u0430\u0451\u043c \u043f\u0440\u0430\u0432\u0430, \u043d\u0435\u043f\u0440\u0438\u0432\u0438\u043b\u0435\u0433\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u043c\u0443 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e. \u0412 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u044d\u0442\u043e logreader:<\/p>\n<pre><code class=\"pgsql\">GRANT USAGE on FOREIGN DATA WRAPPER multicorn TO logreader; GRANT USAGE ON FOREIGN SERVER multicorn_es TO logreader;<\/code><\/pre>\n<\/li>\n<li>\n<p>\u0414\u043b\u044f \u0443\u0434\u043e\u0431\u0441\u0442\u0432\u0430, \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u0443\u044e \u0441\u0445\u0435\u043c\u0443 logging, \u0432\u043b\u0430\u0434\u0435\u043b\u044c\u0446\u0435\u043c \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0431\u0443\u0434\u0435\u0442 \u043d\u0430\u0448 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c  logreader:<\/p>\n<pre><code class=\"pgsql\">CREATE SCHEMA logging AUTHORIZATION logreader;<\/code><\/pre>\n<\/li>\n<li>\n<p>\u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u0441\u043a\u0443\u044e \u0442\u0430\u0431\u043b\u0438\u0446\u0443, \u043a \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0442\u044c \u043d\u043e\u0432\u044b\u0435 \u0438\u043d\u0434\u0435\u043a\u0441\u044b \u0438 \u0443\u0434\u0430\u043b\u044f\u0442\u044c \u043d\u0435 \u0430\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0435:<\/p>\n<pre><code class=\"pgsql\">CREATE TABLE logging.requests (   id varchar(36),   \"@timestamp\" timestamp with time zone,   api varchar(36),   \"api-response-time\" int,   application varchar(36),   custom json,   endpoint text,   gateway varchar(36),   \"local-address\" varchar(16),   method int,   path text,   plan varchar(36),   \"proxy-latency\" int,   \"remote-address\" varchar(16),   \"request-content-length\" int,   \"response-content-length\" int,   \"response-time\" int,   sort text,   status int,   subscription varchar(36),   uri text,   query TEXT,   score NUMERIC) PARTITION BY RANGE(\"@timestamp\");<\/code><\/pre>\n<p>\u041a\u043e\u043d\u0435\u0447\u043d\u043e \u0436\u0435, \u0438\u043d\u0434\u0435\u043a\u0441\u044b \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442 \u0431\u043e\u043b\u044c\u0448\u0435 \u043f\u043e\u043b\u0435\u0439, \u043d\u043e \u0434\u043b\u044f \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0442\u0435\u043a\u0443\u0449\u0435\u0439 \u0437\u0430\u0434\u0430\u0447\u0438, \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u043d\u044b\u0445 \u0432\u044b\u0448\u0435 &#8212; \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e.            <\/p>\n<\/li>\n<li>\n<p>\u0414\u043b\u044f \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u0438 \u043e\u0442\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u0438\u043d\u0434\u0435\u043a\u0441\u043e\u0432, \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0439 shell-\u0441\u043a\u0440\u0438\u043f\u0442 \u0438 \u0431\u0443\u0434\u0435\u043c \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c \u0435\u0433\u043e \u0440\u0430\u0437 \u0432 \u0441\u0443\u0442\u043a\u0438 \u0447\u0435\u0440\u0435\u0437 cron:<\/p>\n<pre><code class=\"bash\">#!\/bin\/sh  NEWPART=${1:-$(date +'%Y.%m.%d')} OLDPART=$(date --date='14 days ago' +'%Y.%m.%d')  curl http:\/\/gateway.corp\/test  psql gateway -U logreader -c \"CREATE FOREIGN TABLE logging.\\\"requests_${NEWPART}\\\" PARTITION OF logging.requests    FOR VALUES FROM ('${NEWPART} 00:00:00') TO ('${NEWPART} 23:59:59') SERVER multicorn_es OPTIONS ( \thost 'els-host',   port '9200',   index 'gravitee-request-${NEWPART}',   rowid_column 'id',   query_column 'query',   query_dsl 'false',     score_column 'score',   sort_column 'sort',   refresh 'false',   complete_returning 'false',   timeout '20',   username 'elastic-ro',   password 'Sup3rS3cr3tP@ssw0rd');\"      psql gateway -U gatewaydev -c \"drop foreign table logging.\\\"requests_${OLDPART}\\\"\"<\/code><\/pre>\n<p>\u041d\u0435\u043c\u043d\u043e\u0433\u043e \u043f\u043e\u044f\u0441\u043d\u0435\u043d\u0438\u0439:<\/p>\n<ul>\n<li>\n<p><strong>NEWPART<\/strong> &#8212; \u0442\u0435\u043a\u0443\u0449\u0430\u044f \u0434\u0430\u0442\u0430, \u0434\u043b\u044f \u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0438\u043c\u0435\u043d\u0438 \u043f\u0430\u0440\u0442\u0438\u0446\u0438\u0438 , \u043f\u0440\u0438 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0438 \u043d\u043e\u0432\u043e\u0433\u043e \u0438\u043d\u0434\u0435\u043a\u0441\u0430 \u0438\u0437 ElasticSearch;<\/p>\n<\/li>\n<li>\n<p><strong>OLDPART<\/strong> &#8212; \u0434\u0430\u0442\u0430 \u0438\u0441\u0442\u0435\u043a\u0448\u0435\u0433\u043e, \u043d\u0435\u0430\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u043e \u0438\u043d\u0434\u0435\u043a\u0441\u0430, \u0437\u0434\u0435\u0441\u044c \u044d\u0442\u043e 14 \u0434\u043d\u0435\u0439 (\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442\u0441\u044f \u0438\u0441\u0445\u043e\u0434\u044f \u0438\u0437 \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043a ES Curator). \u0423\u0434\u0430\u043b\u044f\u0442\u044c \u043f\u0430\u0440\u0442\u0438\u0446\u0438\u0438, \u0441\u0441\u044b\u043b\u0430\u044e\u0449\u0438\u0435\u0441\u044f \u043d\u0430 \u043d\u0435\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 &#8212; \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e. \u0412 \u043f\u0440\u043e\u0442\u0438\u0432\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u044b, \u043a \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u0435, \u0431\u0443\u0434\u0443\u0442 \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u0442\u044c\u0441\u044f \u0441 \u043e\u0448\u0438\u0431\u043a\u0430\u043c\u0438;<\/p>\n<\/li>\n<li>\n<p>\u0412\u044b\u0437\u043e\u0432 <strong>&#8216;curl http:\/\/gateway.corp\/test&#8217;<\/strong>, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u0431\u044b \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u043b\u0441\u044f \u0438\u043d\u0434\u0435\u043a\u0441 \u0442\u0435\u043a\u0443\u0449\u0435\u0433\u043e \u0434\u043d\u044f, \u0442\u0430\u043a \u043a\u0430\u043a \u043e\u043d \u0441\u043e\u0437\u0434\u0430\u0451\u0442\u0441\u044f \u0432 \u043c\u043e\u043c\u0435\u043d\u0442 \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u044f \u043a \u043b\u044e\u0431\u043e\u043c\u0443 \u043f\u043e\u0441\u0442\u0430\u0432\u0449\u0438\u043a\u0443 API. \u0415\u0441\u043b\u0438 \u0435\u0433\u043e \u043d\u0435 \u0441\u043e\u0437\u0434\u0430\u0442\u044c, \u0442\u043e \u044d\u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442\u044c \u043a \u043e\u0448\u0438\u0431\u043a\u0435, \u043e\u043f\u0438\u0441\u0430\u043d\u043d\u043e\u0439 \u0432\u044b\u0448\u0435. \u0422\u0430\u043a\u0430\u044f \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0431\u043e\u043b\u044c\u0448\u0435 \u0430\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u0430 \u0434\u043b\u044f \u0442\u0435\u0441\u0442\u043e\u0432\u044b\u0445 \u0441\u0442\u0435\u043d\u0434\u043e\u0432 \u0438 \u0441\u0442\u0435\u043d\u0434\u043e\u0432 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438;<\/p>\n<\/li>\n<li>\n<p>\u0417\u0430\u0442\u0435\u043c, \u0441\u043e\u0437\u0434\u0430\u0451\u043c \u043f\u0430\u0440\u0442\u0438\u0446\u0438\u044e \u043d\u0430 \u0438\u043d\u0434\u0435\u043a\u0441 \u0442\u0435\u043a\u0443\u0449\u0435\u0433\u043e \u0434\u043d\u044f;<\/p>\n<\/li>\n<li>\n<p>\u0418 \u043d\u0430 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u043c \u0448\u0430\u0433\u0435 &#8212; \u0443\u0434\u0430\u043b\u044f\u0435\u043c \u043d\u0435\u0430\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0439 \u0438\u043d\u0434\u0435\u043a\u0441.<\/p>\n<\/li>\n<li>\n<p>\u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u0447\u0442\u043e \u0432\u0441\u0451 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442<\/p>\n<pre><code class=\"pgsql\">TABLE logging.requests LIMIT 1;<\/code><\/pre>\n<p>\u0415\u0441\u043b\u0438 \u0432\u0441\u0451 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e, \u0442\u043e \u0434\u043e\u043b\u0436\u043d\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043f\u043e\u0445\u043e\u0436\u0438\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442<\/p>\n<\/li>\n<\/ul>\n<pre><code>-[ RECORD 1 ]-----------+------------------------------------- id                      | 55efea8a-9c91-4a61-afea-8a9c917a6133 @timestamp              | 2021-05-16 00:00:02.025+03 api                     | 9db39338-1019-453c-b393-381019f53c72 api-response-time       | 0 application             | 1 custom                  | {} endpoint                |  gateway                 | 7804bc6c-2b72-497f-84bc-6c2b72897fa9 local-address           | 10.15.79.29 method                  | 3 path                    |  plan                    |  proxy-latency           | 2 remote-address          | 10.15.79.27 request-content-length  | 0 response-content-length | 49 response-time           | 2 sort                    |  status                  | 401 subscription            |  uri                     | \/test query                   |  score                   | 1.0 <\/code><\/pre>\n<\/li>\n<\/ol>\n<h3>\u0420\u0438\u0441\u0443\u0435\u043c \u0433\u0440\u0430\u0444\u0438\u043a\u0438<\/h3>\n<p>\u0418 \u0432\u043e\u0442 \u043c\u044b \u043f\u043e\u0434\u043e\u0448\u043b\u0438 \u043a \u0442\u043e\u043c\u0443, \u0440\u0430\u0434\u0438 \u0447\u0435\u0433\u043e \u0432\u0441\u0451 \u0438 \u0434\u0435\u043b\u0430\u043b\u043e\u0441\u044c &#8212; \u0432\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u043c \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0443 Gravitee. \u0411\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u0442\u043e\u043c\u0443, \u0447\u0442\u043e \u0434\u043b\u044f \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u0430\u043d\u0430\u043b\u0438\u0442\u0438\u043a\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0435\u0434\u0438\u043d\u0430\u044f \u0442\u043e\u0447\u043a\u0430 \u0432\u0445\u043e\u0434\u0430, \u0430 \u0438\u043c\u0435\u043d\u043d\u043e \u0421\u0423\u0411\u0414 PostgreSQL, \u044d\u0442\u043e \u0434\u0430\u0451\u0442 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432\u044b\u0432\u043e\u0434\u0438\u0442\u044c \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0443\u044e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e: \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u043e\u0441\u0442\u0430\u0432\u0449\u0438\u043a\u043e\u0432, \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u043e\u0442\u0440\u0435\u0431\u0438\u0442\u0435\u043b\u0435\u0439 \u0438 \u0438\u0445 \u0441\u0442\u0430\u0442\u0443\u0441\u044b; \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0438 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043f\u043e\u0434\u043f\u0438\u0441\u043e\u043a; \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 \u0434\u043b\u044f \u043f\u043e\u0441\u0442\u0430\u0432\u0449\u0438\u043a\u0430 \u0438 \u043c\u043d\u043e\u0433\u043e\u0435 \u0434\u0440\u0443\u0433\u043e\u0435, \u043d\u0430\u0440\u044f\u0434\u0443 \u0441 \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u043c\u0438.<br \/>\u0412 \u0442\u043e\u043c \u0447\u0438\u0441\u043b\u0435 \u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u0431\u044b \u043e\u0442\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e \u0443 \u043f\u043e\u0441\u0442\u0430\u0432\u0449\u0438\u043a\u043e\u0432 \u0438 \u043f\u043e\u0442\u0440\u0435\u0431\u0438\u0442\u0435\u043b\u0435\u0439 \u0438\u043c\u0435\u0435\u0442\u0441\u044f \u0440\u0430\u0437\u0434\u0435\u043b Metadata, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u043a\u0430\u0441\u0442\u043e\u043c\u043d\u044b\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u0438 \u0442\u0430\u043a \u0436\u0435 \u0432\u044b\u0432\u043e\u0434\u0438\u0442\u044c \u0432 \u0434\u0430\u0448\u0431\u043e\u0440\u0434\u044b Grafana.<\/p>\n<p>\u0412\u043e\u0442 \u0442\u0443\u0442:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/184\/7e7\/735\/1847e7735373888b8c1bbbcf771d8678.png\" alt=\"\u0420\u0430\u0437\u0434\u0435\u043b Metadata \u0432 Gravitee\" title=\"\u0420\u0430\u0437\u0434\u0435\u043b Metadata \u0432 Gravitee\" width=\"1083\" height=\"297\"><figcaption>\u0420\u0430\u0437\u0434\u0435\u043b Metadata \u0432 Gravitee<\/figcaption><\/figure>\n<p>\u0410 \u0432\u043e\u0442 \u0442\u0430\u043a \u044d\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u043e\u0442\u043e\u0431\u0440\u0430\u0437\u0438\u0442\u044c \u0432 Grafana:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/e59\/dda\/21c\/e59dda21c28c7dfb6ee1b7377fc1de55.png\" alt=\"\u0412\u0430\u0440\u0438\u0430\u043d\u0442 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f Metadata \u0432 Grafana\" title=\"\u0412\u0430\u0440\u0438\u0430\u043d\u0442 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f Metadata \u0432 Grafana\" width=\"687\" height=\"226\"><figcaption>\u0412\u0430\u0440\u0438\u0430\u043d\u0442 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f Metadata \u0432 Grafana<\/figcaption><\/figure>\n<pre><code class=\"pgsql\">SELECT   name \"\u041d\u0430\u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u0435\",   value \"\u0417\u043d\u0430\u0447\u0435\u043d\u0438\u0435\" FROM   metadata WHERE   reference_id='${apis}'<\/code><\/pre>\n<h4>\u041f\u0440\u0438\u043c\u0435\u0440 \u043a\u043e\u043c\u043f\u043b\u0435\u043a\u0441\u043d\u043e\u0433\u043e \u044d\u043a\u0440\u0430\u043d\u0430<\/h4>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/381\/05b\/10a\/38105b10a8537108df3c4e238a379852.png\" alt=\"\u0412\u0430\u0440\u0438\u0430\u043d\u0442 \u043a\u043e\u043c\u043f\u043b\u0435\u043a\u0441\u043d\u043e\u0433\u043e \u044d\u043a\u0440\u0430\u043d\u0430\" title=\"\u0412\u0430\u0440\u0438\u0430\u043d\u0442 \u043a\u043e\u043c\u043f\u043b\u0435\u043a\u0441\u043d\u043e\u0433\u043e \u044d\u043a\u0440\u0430\u043d\u0430\" width=\"1451\" height=\"793\"><figcaption>\u0412\u0430\u0440\u0438\u0430\u043d\u0442 \u043a\u043e\u043c\u043f\u043b\u0435\u043a\u0441\u043d\u043e\u0433\u043e \u044d\u043a\u0440\u0430\u043d\u0430<\/figcaption><\/figure>\n<p><strong>APIs<\/strong> (\u0441\u0442\u0430\u0442\u0438\u043a\u0430) &#8212; \u043e\u0431\u0449\u0435\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u043e\u0441\u0442\u0430\u0432\u0449\u0438\u043a\u043e\u0432 \u0438 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0430\u043a\u0442\u0438\u0432\u043d\u044b\u0445.<\/p>\n<pre><code class=\"pgsql\">SELECT COUNT(*) AS \"\u0412\u0441\u0435\u0433\u043e\" FROM apis; SELECT COUNT(*) AS \"\u0410\u043a\u0442\u0438\u0432\u043d\u044b\u0445\" FROM apis WHERE lifecycle_state='STARTED';<\/code><\/pre>\n<p>\u0414\u043b\u044f Applications, \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u0441\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u043f\u043e \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e, \u0442\u043e\u043b\u044c\u043a\u043e \u0438\u0437 \u0442\u0430\u0431\u043b\u0438\u0446\u044b <strong>applications<\/strong><\/p>\n<p><strong>API Hits<\/strong> &#8212; \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0432\u044b\u0437\u043e\u0432\u043e\u0432 \u043f\u043e \u043a\u0430\u0436\u0434\u043e\u043c\u0443 \u043f\u043e\u0441\u0442\u0430\u0432\u0449\u0438\u043a\u0443. \u0422\u0443\u0442 \u0443\u0436\u0435 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043f\u043e \u0441\u043b\u043e\u0436\u043d\u0435\u0435<\/p>\n<pre><code class=\"pgsql\">SELECT   date_trunc('minute',\"@timestamp\") AS time,   apis.name,ee \u0441 Grafana   \ufffc   COUNT(*) FROM   logging.requests al JOIN   apis ON al.api = apis.id WHERE   query='@timestamp:[$__from TO $__to]' GROUP BY 1,2<\/code><\/pre>\n<p><strong>Average response time by API<\/strong> &#8212; \u0441\u0440\u0435\u0434\u043d\u0435\u0435 \u0432\u0440\u0435\u043c\u044f \u043e\u0442\u0432\u0435\u0442\u0430, \u043f\u043e \u043a\u0430\u0436\u0434\u043e\u043c\u0443 \u043f\u043e\u0441\u0442\u0430\u0432\u0449\u0438\u043a\u0443 \u0441\u0447\u0438\u0442\u0430\u0435\u0442\u0441\u044f \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u044b\u043c \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u043c.<\/p>\n<pre><code class=\"pgsql\">SELECT   date_trunc('minute',\"@timestamp\") AS time,   apis.name,   AVG(al.\"api-response-time\") FROM   logging.requests al JOIN   apis ON al.api = apis.id WHERE   query='@timestamp:[$__from TO $__to]' GROUP BY 1,2<\/code><\/pre>\n<p>\u0415\u0449\u0435 \u043e\u0434\u0438\u043d \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0439 \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c <strong>Hits, by gateways<\/strong>, \u044d\u0442\u043e \u0440\u0430\u0432\u043d\u043e\u043c\u0435\u0440\u043d\u043e\u0441\u0442\u044c \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u043f\u043e \u0448\u043b\u044e\u0437\u0430\u043c. \u0421\u0447\u0438\u0442\u0430\u0435\u0442\u0441\u044f \u0442\u0430\u043a:<\/p>\n<pre><code class=\"pgsql\">SELECT   date_trunc('minute',\"@timestamp\") as time,   al.\"local-address\",   COUNT(*) FROM   logging.requests al WHERE   query='@timestamp:[$__from TO $__to]' GROUP BY 1,2<\/code><\/pre>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/5ee\/fda\/a6a\/5eefdaa6ad0e86cb4480fbae66fca153.png\" alt=\"\u0413\u0440\u0430\u0444\u0438\u043a \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u043f\u043e \u0448\u043b\u044e\u0437\u0430\u043c\" title=\"\u0413\u0440\u0430\u0444\u0438\u043a \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u043f\u043e \u0448\u043b\u044e\u0437\u0430\u043c\" width=\"915\" height=\"266\"><figcaption>\u0413\u0440\u0430\u0444\u0438\u043a \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u043f\u043e \u0448\u043b\u044e\u0437\u0430\u043c<\/figcaption><\/figure>\n<h3>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h3>\n<p>\u041f\u0440\u0438\u0432\u0435\u0434\u0451\u043d\u043d\u043e\u0435 \u0432\u044b\u0448\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435, \u043f\u043e \u043c\u043e\u0435\u043c\u0443 \u0441\u0443\u0431\u044a\u0435\u043a\u0442\u0438\u0432\u043d\u043e\u043c\u0443 \u043c\u043d\u0435\u043d\u0438\u044e, \u043d\u0438\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043d\u0435 \u0443\u0441\u0442\u0443\u043f\u0430\u0435\u0442 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u043c \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0430\u043c \u0432\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 APIM Gravitee, \u0430 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u043e \u043b\u0438\u0448\u044c \u0444\u0430\u043d\u0442\u0430\u0437\u0438\u0435\u0439 \u0438 \u043f\u043e\u0442\u0440\u0435\u0431\u043d\u043e\u0441\u0442\u044f\u043c\u0438.<br \/>\u0423\u0447\u0438\u0442\u044b\u0432\u0430\u044f \u0442\u043e, \u0447\u0442\u043e Grafana, \u043e\u0431\u044b\u0447\u043d\u043e \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0446\u0435\u043d\u0442\u0440\u0430\u043b\u044c\u043d\u044b\u043c \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u043c \u0438\u043d\u0444\u0440\u0430\u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u043c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u043d\u0433\u0430, \u0442\u043e \u043f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u0430 \u0442\u0430\u043a\u043e\u0433\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u043e\u0447\u0435\u0432\u0438\u0434\u043d\u044b: \u0431\u043e\u043b\u0435\u0435 \u0448\u0438\u0440\u043e\u043a\u0438\u0439 \u043e\u0445\u0432\u0430\u0442, \u0431\u043e\u043b\u0435\u0435 \u0432\u044b\u0441\u043e\u043a\u0430\u044f \u043f\u043b\u043e\u0442\u043d\u043e\u0441\u0442\u044c \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u0438 \u043f\u0440\u043e\u0441\u0442\u0430\u044f \u043a\u0430\u0441\u0442\u043e\u043c\u0438\u0437\u0430\u0446\u0438\u044f \u0432\u0438\u0437\u0443\u0430\u043b\u044c\u043d\u044b\u0445 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0439.<\/p>\n<h3>P.S.<\/h3>\n<p>\u0412 \u0431\u043b\u0438\u0436\u0430\u0439\u0448\u0435\u0435 \u0432\u0440\u0435\u043c\u044f, \u043f\u043b\u0430\u043d\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0435\u0449\u0451 \u0441\u0442\u0430\u0442\u044c\u044f \u043f\u043e \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u0438 Gravitee \u0441 ActiveDirectory. \u041f\u0440\u043e\u0446\u0435\u0441\u0441 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043f\u0440\u043e\u0441\u0442, \u043d\u043e \u043a\u0430\u043a \u0432\u0441\u0435\u0433\u0434\u0430, \u0435\u0441\u0442\u044c \u043d\u044e\u0430\u043d\u0441\u044b.<\/p>\n<p>\u041a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u0438\u0432\u043d\u0430\u044f \u043a\u0440\u0438\u0442\u0438\u043a\u0430, \u043f\u043e\u0436\u0435\u043b\u0430\u043d\u0438\u044f \u0438 \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043f\u0440\u0438\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0442\u0441\u044f! <\/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\/post\/559962\/\"> https:\/\/habr.com\/ru\/post\/559962\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text_v2\" id=\"post-content-body\">\n<p>\u0411\u0435\u0441\u0441\u043f\u043e\u0440\u043d\u043e, \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 Gravitee \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043d\u0430\u0433\u043b\u044f\u0434\u043d\u044b\u0435 \u0438 \u0443\u0434\u043e\u0431\u043d\u044b\u0435 \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0430 \u0432\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0440\u0430\u0431\u043e\u0442\u044b \u0448\u043b\u044e\u0437\u043e\u0432 Gravitee. \u041d\u043e \u0432 \u043b\u044e\u0431\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435, \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442 \u043f\u043e\u0442\u0440\u0435\u0431\u043d\u043e\u0441\u0442\u044c \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u044d\u0442\u0438\u043c \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430\u043c \u0441\u043b\u0443\u0436\u0431\u0435 \u043c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u043d\u0433\u0430, \u0432\u043b\u0430\u0434\u0435\u043b\u044c\u0446\u0430\u043c \u0438\u043b\u0438 \u043f\u043e\u0442\u0440\u0435\u0431\u0438\u0442\u0435\u043b\u044f\u043c API \u0438 \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u043e\u043d\u0438 \u043c\u043e\u0433\u0443\u0442 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432\u043d\u0435 \u0437\u0430\u043a\u0440\u044b\u0442\u043e\u0433\u043e \u043a\u043e\u043d\u0442\u0443\u0440\u0430, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d \u043c\u0435\u043d\u0435\u0434\u0436\u0435\u0440 API. \u0414\u0430 \u0438 \u0438\u043c\u0435\u0442\u044c \u0432\u0441\u044e \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u0443\u044e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043f\u043e \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u043c API \u043d\u0430 \u043e\u0434\u043d\u043e\u043c \u044d\u043a\u0440\u0430\u043d\u0435 \u0432\u0441\u0435\u0433\u0434\u0430 \u0443\u0434\u043e\u0431\u043d\u0435\u0435.<br \/>\u0412\u0438\u0434\u0435\u0442\u044c \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u044f\u0449\u0435\u0435 \u043d\u0430 \u0448\u043b\u044e\u0437\u0430\u0445, \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u043d\u0435 \u0432\u0434\u0430\u0432\u0430\u044f\u0441\u044c \u0432 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 Gravitee, \u0430 \u0430\u0434\u043c\u0438\u043d\u0438\u0441\u0442\u0440\u0430\u0442\u043e\u0440\u0430\u043c &#8212; \u043d\u0435 \u0442\u0440\u0430\u0442\u0438\u0442\u044c \u0432\u0440\u0435\u043c\u044f \u043d\u0430 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 \u0438 \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0440\u043e\u043b\u0435\u0439 \u0438 \u043f\u0440\u0438\u0432\u0438\u043b\u0435\u0433\u0438\u0439 \u0432\u043d\u0443\u0442\u0440\u0438 Gravitee.<br \/>\u041d\u0430 \u0425\u0430\u0431\u0440\u0435 \u0443\u0436\u0435 \u0431\u044b\u043b\u0430 \u043f\u0430\u0440\u0430 \u0441\u0442\u0430\u0442\u0435\u0439 \u043f\u043e\u0441\u0432\u044f\u0449\u0435\u043d\u043d\u044b\u0445 APIM Gravitee, <a href=\"https:\/\/habr.com\/ru\/company\/X5RetailGroup\/blog\/543324\/\" rel=\"noopener noreferrer nofollow\">\u0442\u0443\u0442<\/a> \u0438 <a href=\"https:\/\/habr.com\/ru\/company\/X5RetailGroup\/blog\/559686\/\" rel=\"noopener noreferrer nofollow\">\u0442\u0443\u0442<\/a>. \u041f\u043e \u044d\u0442\u043e\u043c\u0443, \u0432 \u0441\u0432\u043e\u0435\u0439 \u0437\u0430\u043c\u0435\u0442\u043a\u0435, \u0431\u0443\u0434\u0443 \u043f\u043e\u0434\u0440\u0430\u0437\u0443\u043c\u0435\u0432\u0430\u0442\u044c, \u0447\u0442\u043e \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u044c \u0443\u0436\u0435 \u0437\u043d\u0430\u043a\u043e\u043c \u0441 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u043c \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438\/\u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 APIM Gravitee \u0438 Grafana, \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u044e \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0438\u0445 \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u0438.<\/p>\n<h3>\u041f\u043e\u0447\u0435\u043c\u0443 \u043d\u0435\u043b\u044c\u0437\u044f \u043f\u043e\u0439\u0442\u0438 \u043f\u0440\u043e\u0441\u0442\u044b\u043c \u043f\u0443\u0442\u0451\u043c?<\/h3>\n<p>\u041f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e, \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0435\u043c \u0434\u043b\u044f \u0430\u043d\u0430\u043b\u0438\u0442\u0438\u043a\u0438 Gravitee \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f ElasticSearch. \u0418\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u043d\u0430\u043a\u0430\u043f\u043b\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0432 \u0447\u0435\u0442\u044b\u0440\u0451\u0445 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0438\u043d\u0434\u0435\u043a\u0441\u0430\u0445, \u0441 \u043f\u043e\u0441\u0443\u0442\u043e\u0447\u043d\u043e\u0439 \u0440\u0430\u0437\u0431\u0438\u0432\u043a\u043e\u0439:<\/p>\n<ul>\n<li>\n<p><strong>gravitee-request-YYYY.MM.DD<\/strong> &#8212; \u0437\u0434\u0435\u0441\u044c \u0445\u0440\u0430\u043d\u0438\u0442\u0441\u044f \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u043f\u043e \u043a\u0430\u0436\u0434\u043e\u043c\u0443 \u0437\u0430\u043f\u0440\u043e\u0441\u0443 (\u0430\u043d\u0430\u043b\u043e\u0433 access.log \u0432 nginx). \u042d\u0442\u043e \u043d\u0430\u0448\u0430 \u043e\u0441\u043d\u043e\u0432\u043d\u0430\u044f \u0446\u0435\u043b\u044c;<\/p>\n<\/li>\n<\/ul>\n<ul>\n<li>\n<p><strong>gravitee-log-YYYY.MM.DD<\/strong> &#8212; \u0437\u0434\u0435\u0441\u044c \u0443\u0436\u0435 \u0445\u0440\u0430\u043d\u0438\u0442\u0441\u044f \u0431\u043e\u043b\u0435\u0435 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0430\u044f \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u043e \u0437\u0430\u043f\u0440\u043e\u0441\u0435 (\u043f\u0440\u0438 \u0443\u0441\u043b\u043e\u0432\u0438\u0438, \u0447\u0442\u043e \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u0430 \u043e\u0442\u043b\u0430\u0434\u043a\u0430, \u0441\u043c. \u0440\u0438\u0441\u0443\u043d\u043e\u043a \u043d\u0438\u0436\u0435). \u0410 \u0438\u043c\u0435\u043d\u043d\u043e \u043f\u043e\u043b\u043d\u044b\u0435 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u0438 \u043e\u0442\u0432\u0435\u0442\u043e\u0432, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043f\u043e\u043b\u0435\u0437\u043d\u0430\u044f \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0430. \u0412 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043a, \u043b\u043e\u0433\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043c\u043e\u0436\u0435\u0442 \u043a\u0430\u043a \u043e\u0431\u043c\u0435\u043d \u043c\u0435\u0436\u0434\u0443 \u043f\u043e\u0442\u0440\u0435\u0431\u0438\u0442\u0435\u043b\u0435\u043c \u0438 \u0448\u043b\u044e\u0437\u043e\u043c, \u0442\u0430\u043a \u0438\/\u0438\u043b\u0438 \u0448\u043b\u044e\u0437\u043e\u043c \u0438 \u043f\u043e\u0441\u0442\u0430\u0432\u0449\u0438\u043a\u043e\u043c API;<\/p>\n<figure class=\"full-width\"><figcaption>\u042d\u043a\u0440\u0430\u043d \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f\/\u043e\u0442\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u043d\u043e\u0433\u043e \u043b\u043e\u0433\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f<\/figcaption><\/figure>\n<\/li>\n<\/ul>\n<ul>\n<li>\n<p><strong>gravitee-monitor-YYYY.MM.DD<\/strong> &#8212; \u044d\u0442\u043e\u0442 \u043d\u0430\u0441 \u043d\u0435 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0443\u0435\u0442;<\/p>\n<\/li>\n<li>\n<p><strong>gravitee-health-YYYY.MM.DD<\/strong> &#8212; \u044d\u0442\u043e\u0442 \u043d\u0430\u0441 \u043d\u0435 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0443\u0435\u0442.<\/p>\n<\/li>\n<\/ul>\n<p>\u0418 \u043a\u0430\u0437\u0430\u043b\u043e\u0441\u044c \u0431\u044b, \u0447\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043f\u0440\u043e\u0449\u0435: \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0439 ElasticSearch \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 Grafana \u0438 \u0432\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0439, \u043d\u043e \u043d\u0435 \u0432\u0441\u0451 \u0442\u0430\u043a \u043f\u0440\u043e\u0441\u0442\u043e. <br \/>\u0412\u043e \u043f\u0435\u0440\u0432\u044b\u0445, \u0432 \u0438\u043d\u0434\u0435\u043a\u0441\u0435 \u0445\u0440\u0430\u043d\u044f\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u044b \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432, \u0442.\u0435. \u0447\u0435\u043b\u043e\u0432\u0435\u043a\u043e-\u0447\u0438\u0442\u0430\u0435\u043c\u044b\u0445 \u0438\u043c\u0451\u043d \u043f\u043e\u0441\u0442\u0430\u0432\u0449\u0438\u043a\u043e\u0432 \u0438 \u043f\u043e\u0442\u0440\u0435\u0431\u0438\u0442\u0435\u043b\u0435\u0439, \u0432\u044b \u0442\u0430\u043c \u043d\u0435 \u0443\u0432\u0438\u0434\u0438\u0442\u0435. \u0412\u043e \u0432\u0442\u043e\u0440\u044b\u0445, \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043f\u043e\u043b\u043d\u0443\u044e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u0441\u043e\u0435\u0434\u0438\u043d\u0438\u0432 \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 \u0434\u0432\u0443\u0445 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u043e\u0432 \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0432 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0435 Grafana, \u043a\u0440\u0430\u0439\u043d\u0435 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430\u0442\u0438\u0447\u043d\u043e. Gravitee \u0445\u0440\u0430\u043d\u0438\u0442 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430\u0445 \u0438 \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0443 \u0441\u0432\u043e\u0435\u0439 \u0440\u0430\u0431\u043e\u0442\u044b \u0432 \u0440\u0430\u0437\u043d\u044b\u0445 \u043c\u0435\u0441\u0442\u0430\u0445. \u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438, \u0432 MongoDB \u0438\u043b\u0438 PostgreSQL, \u043f\u043e \u0441\u0443\u0442\u0438 \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f. \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u0432 \u043e\u0434\u043d\u043e\u043c \u043c\u0435\u0441\u0442\u0435 \u0443 \u043d\u0430\u0441 (\u0432 \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u0445 Grafana) &#8212; \u0442\u0430\u0431\u043b\u0438\u0446\u0430, \u0432 \u0434\u0440\u0443\u0433\u043e\u043c &#8212; \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u0440\u044f\u0434. <\/p>\n<h3>B \u043a\u0430\u043a \u0436\u0435 \u0431\u044b\u0442\u044c?<\/h3>\n<p>\u0411\u043e\u043b\u044c\u0448\u0438\u043c \u043f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u043e\u043c \u0421\u0423\u0411\u0414 PostgreSQL \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0431\u043e\u0433\u0430\u0442\u044b\u0439 \u043d\u0430\u0431\u043e\u0440 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0439 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0432\u043d\u0435\u0448\u043d\u0438\u043c\u0438 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0430\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u0445, \u0432 \u0442\u043e\u043c \u0447\u0438\u0441\u043b\u0435 \u0438 \u0441 ElasticSearch (<a href=\"https:\/\/github.com\/matthewfranglen\/postgres-elasticsearch-fdw\" rel=\"noopener noreferrer nofollow\">\u0442\u0443\u0442<\/a>). \u0411\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u044d\u0442\u043e\u043c\u0443 \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u044f \u0441\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u043a \u0442\u043e\u043c\u0443, \u0447\u0442\u043e Grafana \u043e\u0431\u0449\u0430\u0435\u0442\u0441\u044f \u0441 \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u043c \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u043e\u043c \u0434\u0430\u043d\u043d\u044b\u0445 &#8212; \u0421\u0423\u0411\u0414 PostgreSQL, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0432 \u0441\u0432\u043e\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 ElasticSearch \u0438 \u043e\u0431\u043e\u0433\u0430\u0449\u0430\u0435\u0442 \u0438\u0445 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0435\u0439 \u0438 \u0434\u0435\u043b\u0430\u0435\u0442 \u0447\u0438\u0442\u0430\u0435\u043c\u043e\u0439 \u0434\u043b\u044f \u0430\u0434\u043c\u0438\u043d\u0438\u0441\u0442\u0440\u0430\u0442\u043e\u0440\u0430 \u0438\u043b\u0438 \u043b\u044e\u0431\u043e\u0433\u043e \u0434\u0440\u0443\u0433\u043e\u0433\u043e \u0431\u0435\u043d\u0435\u0444\u0438\u0446\u0438\u0430\u0440\u0430.<br \/>\u0421\u0445\u0435\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u044d\u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c (\u0440\u0438\u0441\u0443\u043d\u043e\u043a \u043d\u0438\u0436\u0435).<\/p>\n<figure class=\"full-width\"><figcaption>\u0421\u0445\u0435\u043c\u0430 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u043c\u043e\u0434\u0443\u043b\u0435\u0439 Gravitee<\/figcaption><\/figure>\n<h3>\u041d\u0443 \u0447\u0442\u043e \u0436\u0435, \u0437\u0430 \u0434\u0435\u043b\u043e!<\/h3>\n<p>\u0412\u0441\u0435 \u043d\u0438\u0436\u0435 \u043e\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0430\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u044b \u0434\u043b\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438: CentOS 7, APIM Gravitee 3.6, \u0421\u0423\u0411\u0414 PostgreSQL 11, ElasticSearch 7.+<\/p>\n<p>\u041d\u0430\u0447\u043d\u0451\u043c \u0441 \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u0438 PostgreSQL \u0438 ElasticSearch. \u0421\u0430\u043c \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u0438 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043f\u0440\u043e\u0441\u0442 \u0438 \u0434\u0435\u043b\u0438\u0442\u0441\u044f \u043d\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0448\u0430\u0433\u0438:<\/p>\n<ol>\n<li>\n<p>\u0423\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0435 multicorn11 \u0438 \u0435\u0441\u043b\u0438 \u043d\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d pip, \u0442\u043e \u0441\u0442\u0430\u0432\u0438\u043c \u0438 \u0435\u0433\u043e:<\/p>\n<pre><code class=\"bash\">yum install multicorn11 python3-pip<\/code><\/pre>\n<\/li>\n<li>\n<p>\u0414\u0430\u043b\u0435\u0435 \u0438\u0437 pip-\u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u044f, \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 python3 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 ElasticSearch:<\/p>\n<pre><code class=\"bash\">pip3 install pg_es_fdw<\/code><\/pre>\n<\/li>\n<li>\n<p>\u0414\u0430\u043b\u0435\u0435, \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u043a \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0435  PostgreSQL. \u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u043c\u0441\u044f \u0446\u0435\u043b\u0435\u0432\u043e\u0439 \u0411\u0414 \u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0435 multicorn \u0438 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u0443\u044e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443:<\/p>\n<pre><code class=\"pgsql\">GRANT USAGE on FOREIGN DATA WRAPPER multicorn TO gatewaytest; GRANT USAGE ON FOREIGN SERVER multicorn_es TO gatewaytest;<\/code><\/pre>\n<pre><code class=\"pgsql\"> CREATE EXTENSION multicorn;  CREATE SERVER multicorn_es FOREIGN DATA WRAPPER multicorn   OPTIONS (wrapper 'pg_es_fdw.ElasticsearchFDW');<\/code><\/pre>\n<\/li>\n<li>\n<p>\u0412\u044b\u0434\u0430\u0451\u043c \u043f\u0440\u0430\u0432\u0430, \u043d\u0435\u043f\u0440\u0438\u0432\u0438\u043b\u0435\u0433\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u043c\u0443 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e. \u0412 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u044d\u0442\u043e logreader:<\/p>\n<pre><code class=\"pgsql\">GRANT USAGE on FOREIGN DATA WRAPPER multicorn TO logreader; GRANT USAGE ON FOREIGN SERVER multicorn_es TO logreader;<\/code><\/pre>\n<\/li>\n<li>\n<p>\u0414\u043b\u044f \u0443\u0434\u043e\u0431\u0441\u0442\u0432\u0430, \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u0443\u044e \u0441\u0445\u0435\u043c\u0443 logging, \u0432\u043b\u0430\u0434\u0435\u043b\u044c\u0446\u0435\u043c \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0431\u0443\u0434\u0435\u0442 \u043d\u0430\u0448 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c  logreader:<\/p>\n<pre><code class=\"pgsql\">CREATE SCHEMA logging AUTHORIZATION logreader;<\/code><\/pre>\n<\/li>\n<li>\n<p>\u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u0441\u043a\u0443\u044e \u0442\u0430\u0431\u043b\u0438\u0446\u0443, \u043a \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0442\u044c \u043d\u043e\u0432\u044b\u0435 \u0438\u043d\u0434\u0435\u043a\u0441\u044b \u0438 \u0443\u0434\u0430\u043b\u044f\u0442\u044c \u043d\u0435 \u0430\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0435:<\/p>\n<pre><code class=\"pgsql\">CREATE TABLE logging.requests (   id varchar(36),   \"@timestamp\" timestamp with time zone,   api varchar(36),   \"api-response-time\" int,   application varchar(36),   custom json,   endpoint text,   gateway varchar(36),   \"local-address\" varchar(16),   method int,   path text,   plan varchar(36),   \"proxy-latency\" int,   \"remote-address\" varchar(16),   \"request-content-length\" int,   \"response-content-length\" int,   \"response-time\" int,   sort text,   status int,   subscription varchar(36),   uri text,   query TEXT,   score NUMERIC) PARTITION BY RANGE(\"@timestamp\");<\/code><\/pre>\n<p>\u041a\u043e\u043d\u0435\u0447\u043d\u043e \u0436\u0435, \u0438\u043d\u0434\u0435\u043a\u0441\u044b \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442 \u0431\u043e\u043b\u044c\u0448\u0435 \u043f\u043e\u043b\u0435\u0439, \u043d\u043e \u0434\u043b\u044f \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0442\u0435\u043a\u0443\u0449\u0435\u0439 \u0437\u0430\u0434\u0430\u0447\u0438, \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u043d\u044b\u0445 \u0432\u044b\u0448\u0435 &#8212; \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e.            <\/p>\n<\/li>\n<li>\n<p>\u0414\u043b\u044f \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u0438 \u043e\u0442\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u0438\u043d\u0434\u0435\u043a\u0441\u043e\u0432, \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0439 shell-\u0441\u043a\u0440\u0438\u043f\u0442 \u0438 \u0431\u0443\u0434\u0435\u043c \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c \u0435\u0433\u043e \u0440\u0430\u0437 \u0432 \u0441\u0443\u0442\u043a\u0438 \u0447\u0435\u0440\u0435\u0437 cron:<\/p>\n<pre><code class=\"bash\">#!\/bin\/sh  NEWPART=${1:-$(date +'%Y.%m.%d')} OLDPART=$(date --date='14 days ago' +'%Y.%m.%d')  curl http:\/\/gateway.corp\/test  psql gateway -U logreader -c \"CREATE FOREIGN TABLE logging.\\\"requests_${NEWPART}\\\" PARTITION OF logging.requests    FOR VALUES FROM ('${NEWPART} 00:00:00') TO ('${NEWPART} 23:59:59') SERVER multicorn_es OPTIONS ( \thost 'els-host',   port '9200',   index 'gravitee-request-${NEWPART}',   rowid_column 'id',   query_column 'query',   query_dsl 'false',     score_column 'score',   sort_column 'sort',   refresh 'false',   complete_returning 'false',   timeout '20',   username 'elastic-ro',   password 'Sup3rS3cr3tP@ssw0rd');\"      psql gateway -U gatewaydev -c \"drop foreign table logging.\\\"requests_${OLDPART}\\\"\"<\/code><\/pre>\n<p>\u041d\u0435\u043c\u043d\u043e\u0433\u043e \u043f\u043e\u044f\u0441\u043d\u0435\u043d\u0438\u0439:<\/p>\n<ul>\n<li>\n<p><strong>NEWPART<\/strong> &#8212; \u0442\u0435\u043a\u0443\u0449\u0430\u044f \u0434\u0430\u0442\u0430, \u0434\u043b\u044f \u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0438\u043c\u0435\u043d\u0438 \u043f\u0430\u0440\u0442\u0438\u0446\u0438\u0438 , \u043f\u0440\u0438 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0438 \u043d\u043e\u0432\u043e\u0433\u043e \u0438\u043d\u0434\u0435\u043a\u0441\u0430 \u0438\u0437 ElasticSearch;<\/p>\n<\/li>\n<li>\n<p><strong>OLDPART<\/strong> &#8212; \u0434\u0430\u0442\u0430 \u0438\u0441\u0442\u0435\u043a\u0448\u0435\u0433\u043e, \u043d\u0435\u0430\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u043e \u0438\u043d\u0434\u0435\u043a\u0441\u0430, \u0437\u0434\u0435\u0441\u044c \u044d\u0442\u043e 14 \u0434\u043d\u0435\u0439 (\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442\u0441\u044f \u0438\u0441\u0445\u043e\u0434\u044f \u0438\u0437 \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043a ES Curator). \u0423\u0434\u0430\u043b\u044f\u0442\u044c \u043f\u0430\u0440\u0442\u0438\u0446\u0438\u0438, \u0441\u0441\u044b\u043b\u0430\u044e\u0449\u0438\u0435\u0441\u044f \u043d\u0430 \u043d\u0435\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 &#8212; \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e. \u0412 \u043f\u0440\u043e\u0442\u0438\u0432\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u044b, \u043a \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u0435, \u0431\u0443\u0434\u0443\u0442 \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u0442\u044c\u0441\u044f \u0441 \u043e\u0448\u0438\u0431\u043a\u0430\u043c\u0438;<\/p>\n<\/li>\n<li>\n<p>\u0412\u044b\u0437\u043e\u0432 <strong>&#8216;curl http:\/\/gateway.corp\/test&#8217;<\/strong>, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u0431\u044b \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u043b\u0441\u044f \u0438\u043d\u0434\u0435\u043a\u0441 \u0442\u0435\u043a\u0443\u0449\u0435\u0433\u043e \u0434\u043d\u044f, \u0442\u0430\u043a \u043a\u0430\u043a \u043e\u043d \u0441\u043e\u0437\u0434\u0430\u0451\u0442\u0441\u044f \u0432 \u043c\u043e\u043c\u0435\u043d\u0442 \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u044f \u043a \u043b\u044e\u0431\u043e\u043c\u0443 \u043f\u043e\u0441\u0442\u0430\u0432\u0449\u0438\u043a\u0443 API. \u0415\u0441\u043b\u0438 \u0435\u0433\u043e \u043d\u0435 \u0441\u043e\u0437\u0434\u0430\u0442\u044c, \u0442\u043e \u044d\u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442\u044c \u043a \u043e\u0448\u0438\u0431\u043a\u0435, \u043e\u043f\u0438\u0441\u0430\u043d\u043d\u043e\u0439 \u0432\u044b\u0448\u0435. \u0422\u0430\u043a\u0430\u044f \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0431\u043e\u043b\u044c\u0448\u0435 \u0430\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u0430 \u0434\u043b\u044f \u0442\u0435\u0441\u0442\u043e\u0432\u044b\u0445 \u0441\u0442\u0435\u043d\u0434\u043e\u0432 \u0438 \u0441\u0442\u0435\u043d\u0434\u043e\u0432 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438;<\/p>\n<\/li>\n<li>\n<p>\u0417\u0430\u0442\u0435\u043c, \u0441\u043e\u0437\u0434\u0430\u0451\u043c \u043f\u0430\u0440\u0442\u0438\u0446\u0438\u044e \u043d\u0430 \u0438\u043d\u0434\u0435\u043a\u0441 \u0442\u0435\u043a\u0443\u0449\u0435\u0433\u043e \u0434\u043d\u044f;<\/p>\n<\/li>\n<li>\n<p>\u0418 \u043d\u0430 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u043c \u0448\u0430\u0433\u0435 &#8212; \u0443\u0434\u0430\u043b\u044f\u0435\u043c \u043d\u0435\u0430\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0439 \u0438\u043d\u0434\u0435\u043a\u0441.<\/p>\n<\/li>\n<li>\n<p>\u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u0447\u0442\u043e \u0432\u0441\u0451 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442<\/p>\n<pre><code class=\"pgsql\">TABLE logging.requests LIMIT 1;<\/code><\/pre>\n<p>\u0415\u0441\u043b\u0438 \u0432\u0441\u0451 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e, \u0442\u043e \u0434\u043e\u043b\u0436\u043d\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043f\u043e\u0445\u043e\u0436\u0438\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442<\/p>\n<\/li>\n<\/ul>\n<pre><code>-[ RECORD 1 ]-----------+------------------------------------- id                      | 55efea8a-9c91-4a61-afea-8a9c917a6133 @timestamp              | 2021-05-16 00:00:02.025+03 api                     | 9db39338-1019-453c-b393-381019f53c72 api-response-time       | 0 application             | 1 custom                  | {} endpoint                |  gateway                 | 7804bc6c-2b72-497f-84bc-6c2b72897fa9 local-address           | 10.15.79.29 method                  | 3 path                    |  plan                    |  proxy-latency           | 2 remote-address          | 10.15.79.27 request-content-length  | 0 response-content-length | 49 response-time           | 2 sort                    |  status                  | 401 subscription            |  uri                     | \/test query                   |  score                   | 1.0 <\/code><\/pre>\n<\/li>\n<\/ol>\n<h3>\u0420\u0438\u0441\u0443\u0435\u043c \u0433\u0440\u0430\u0444\u0438\u043a\u0438<\/h3>\n<p>\u0418 \u0432\u043e\u0442 \u043c\u044b \u043f\u043e\u0434\u043e\u0448\u043b\u0438 \u043a \u0442\u043e\u043c\u0443, \u0440\u0430\u0434\u0438 \u0447\u0435\u0433\u043e \u0432\u0441\u0451 \u0438 \u0434\u0435\u043b\u0430\u043b\u043e\u0441\u044c &#8212; \u0432\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u043c \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0443 Gravitee. \u0411\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u0442\u043e\u043c\u0443, \u0447\u0442\u043e \u0434\u043b\u044f \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u0430\u043d\u0430\u043b\u0438\u0442\u0438\u043a\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0435\u0434\u0438\u043d\u0430\u044f \u0442\u043e\u0447\u043a\u0430 \u0432\u0445\u043e\u0434\u0430, \u0430 \u0438\u043c\u0435\u043d\u043d\u043e \u0421\u0423\u0411\u0414 PostgreSQL, \u044d\u0442\u043e \u0434\u0430\u0451\u0442 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432\u044b\u0432\u043e\u0434\u0438\u0442\u044c \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0443\u044e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e: \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u043e\u0441\u0442\u0430\u0432\u0449\u0438\u043a\u043e\u0432, \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u043e\u0442\u0440\u0435\u0431\u0438\u0442\u0435\u043b\u0435\u0439 \u0438 \u0438\u0445 \u0441\u0442\u0430\u0442\u0443\u0441\u044b; \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0438 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043f\u043e\u0434\u043f\u0438\u0441\u043e\u043a; \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 \u0434\u043b\u044f \u043f\u043e\u0441\u0442\u0430\u0432\u0449\u0438\u043a\u0430 \u0438 \u043c\u043d\u043e\u0433\u043e\u0435 \u0434\u0440\u0443\u0433\u043e\u0435, \u043d\u0430\u0440\u044f\u0434\u0443 \u0441 \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u043c\u0438.<br \/>\u0412 \u0442\u043e\u043c \u0447\u0438\u0441\u043b\u0435 \u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u0431\u044b \u043e\u0442\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e \u0443 \u043f\u043e\u0441\u0442\u0430\u0432\u0449\u0438\u043a\u043e\u0432 \u0438 \u043f\u043e\u0442\u0440\u0435\u0431\u0438\u0442\u0435\u043b\u0435\u0439 \u0438\u043c\u0435\u0435\u0442\u0441\u044f \u0440\u0430\u0437\u0434\u0435\u043b Metadata, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u043a\u0430\u0441\u0442\u043e\u043c\u043d\u044b\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u0438 \u0442\u0430\u043a \u0436\u0435 \u0432\u044b\u0432\u043e\u0434\u0438\u0442\u044c \u0432 \u0434\u0430\u0448\u0431\u043e\u0440\u0434\u044b Grafana.<\/p>\n<p>\u0412\u043e\u0442 \u0442\u0443\u0442:<\/p>\n<figure class=\"full-width\"><figcaption>\u0420\u0430\u0437\u0434\u0435\u043b Metadata \u0432 Gravitee<\/figcaption><\/figure>\n<p>\u0410 \u0432\u043e\u0442 \u0442\u0430\u043a \u044d\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u043e\u0442\u043e\u0431\u0440\u0430\u0437\u0438\u0442\u044c \u0432 Grafana:<\/p>\n<figure class=\"full-width\"><figcaption>\u0412\u0430\u0440\u0438\u0430\u043d\u0442 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f Metadata \u0432 Grafana<\/figcaption><\/figure>\n<pre><code class=\"pgsql\">SELECT   name \"\u041d\u0430\u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u0435\",   value \"\u0417\u043d\u0430\u0447\u0435\u043d\u0438\u0435\" FROM   metadata WHERE   reference_id='${apis}'<\/code><\/pre>\n<h4>\u041f\u0440\u0438\u043c\u0435\u0440 \u043a\u043e\u043c\u043f\u043b\u0435\u043a\u0441\u043d\u043e\u0433\u043e \u044d\u043a\u0440\u0430\u043d\u0430<\/h4>\n<figure class=\"full-width\"><figcaption>\u0412\u0430\u0440\u0438\u0430\u043d\u0442 \u043a\u043e\u043c\u043f\u043b\u0435\u043a\u0441\u043d\u043e\u0433\u043e \u044d\u043a\u0440\u0430\u043d\u0430<\/figcaption><\/figure>\n<p><strong>APIs<\/strong> (\u0441\u0442\u0430\u0442\u0438\u043a\u0430) &#8212; \u043e\u0431\u0449\u0435\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u043e\u0441\u0442\u0430\u0432\u0449\u0438\u043a\u043e\u0432 \u0438 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0430\u043a\u0442\u0438\u0432\u043d\u044b\u0445.<\/p>\n<pre><code class=\"pgsql\">SELECT COUNT(*) AS \"\u0412\u0441\u0435\u0433\u043e\" FROM apis; SELECT COUNT(*) AS \"\u0410\u043a\u0442\u0438\u0432\u043d\u044b\u0445\" FROM apis WHERE lifecycle_state='STARTED';<\/code><\/pre>\n<p>\u0414\u043b\u044f Applications, \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u0441\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u043f\u043e \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e, \u0442\u043e\u043b\u044c\u043a\u043e \u0438\u0437 \u0442\u0430\u0431\u043b\u0438\u0446\u044b <strong>applications<\/strong><\/p>\n<p><strong>API Hits<\/strong> &#8212; \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0432\u044b\u0437\u043e\u0432\u043e\u0432 \u043f\u043e \u043a\u0430\u0436\u0434\u043e\u043c\u0443 \u043f\u043e\u0441\u0442\u0430\u0432\u0449\u0438\u043a\u0443. \u0422\u0443\u0442 \u0443\u0436\u0435 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043f\u043e \u0441\u043b\u043e\u0436\u043d\u0435\u0435<\/p>\n<pre><code class=\"pgsql\">SELECT   date_trunc('minute',\"@timestamp\") AS time,   apis.name,ee \u0441 Grafana   \ufffc   COUNT(*) FROM   logging.requests al JOIN   apis ON al.api = apis.id WHERE   query='@timestamp:[$__from TO $__to]' GROUP BY 1,2<\/code><\/pre>\n<p><strong>Average response time by API<\/strong> &#8212; \u0441\u0440\u0435\u0434\u043d\u0435\u0435 \u0432\u0440\u0435\u043c\u044f \u043e\u0442\u0432\u0435\u0442\u0430, \u043f\u043e \u043a\u0430\u0436\u0434\u043e\u043c\u0443 \u043f\u043e\u0441\u0442\u0430\u0432\u0449\u0438\u043a\u0443 \u0441\u0447\u0438\u0442\u0430\u0435\u0442\u0441\u044f \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u044b\u043c \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u043c.<\/p>\n<pre><code class=\"pgsql\">SELECT   date_trunc('minute',\"@timestamp\") AS time,   apis.name,   AVG(al.\"api-response-time\") FROM   logging.requests al JOIN   apis ON al.api = apis.id WHERE   query='@timestamp:[$__from TO $__to]' GROUP BY 1,2<\/code><\/pre>\n<p>\u0415\u0449\u0435 \u043e\u0434\u0438\u043d \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0439 \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c <strong>Hits, by gateways<\/strong>, \u044d\u0442\u043e \u0440\u0430\u0432\u043d\u043e\u043c\u0435\u0440\u043d\u043e\u0441\u0442\u044c \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u043f\u043e \u0448\u043b\u044e\u0437\u0430\u043c. \u0421\u0447\u0438\u0442\u0430\u0435\u0442\u0441\u044f \u0442\u0430\u043a:<\/p>\n<pre><code class=\"pgsql\">SELECT   date_trunc('minute',\"@timestamp\") as time,   al.\"local-address\",   COUNT(*) FROM   logging.requests al WHERE   query='@timestamp:[$__from TO $__to]' GROUP BY 1,2<\/code><\/pre>\n<figure class=\"full-width\"><figcaption>\u0413\u0440\u0430\u0444\u0438\u043a \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u043f\u043e \u0448\u043b\u044e\u0437\u0430\u043c<\/figcaption><\/figure>\n<h3>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h3>\n<p>\u041f\u0440\u0438\u0432\u0435\u0434\u0451\u043d\u043d\u043e\u0435 \u0432\u044b\u0448\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435, \u043f\u043e \u043c\u043e\u0435\u043c\u0443 \u0441\u0443\u0431\u044a\u0435\u043a\u0442\u0438\u0432\u043d\u043e\u043c\u0443 \u043c\u043d\u0435\u043d\u0438\u044e, \u043d\u0438\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043d\u0435 \u0443\u0441\u0442\u0443\u043f\u0430\u0435\u0442 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u043c \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0430\u043c \u0432\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 APIM Gravitee, \u0430 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u043e \u043b\u0438\u0448\u044c \u0444\u0430\u043d\u0442\u0430\u0437\u0438\u0435\u0439 \u0438 \u043f\u043e\u0442\u0440\u0435\u0431\u043d\u043e\u0441\u0442\u044f\u043c\u0438.<br \/>\u0423\u0447\u0438\u0442\u044b\u0432\u0430\u044f \u0442\u043e, \u0447\u0442\u043e Grafana, \u043e\u0431\u044b\u0447\u043d\u043e \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0446\u0435\u043d\u0442\u0440\u0430\u043b\u044c\u043d\u044b\u043c \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u043c \u0438\u043d\u0444\u0440\u0430\u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u043c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u043d\u0433\u0430, \u0442\u043e \u043f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u0430 \u0442\u0430\u043a\u043e\u0433\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u044f <\/br><\/p>\n<\/p>\n<\/p>\n<p><\/br><\/p>\n<\/div>\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-323991","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/323991","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=323991"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/323991\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=323991"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=323991"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=323991"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}