{"id":399075,"date":"2024-06-29T14:27:20","date_gmt":"2024-06-29T14:27:20","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=399075"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=399075","title":{"rendered":"<span>Elastic APM \u0434\u043b\u044f PHP-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432: \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c APM c Laravel \u0438 Lumen<\/span>"},"content":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/313\/125\/823\/313125823beffb2b7b701a479440a58b.png\" alt=\"\u0418\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0441: https:\/\/www.elastic.co\/guide\/en\/apm\/get-started\/current\/images\/apm-architecture-cloud.png\" title=\"\u0418\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0441: https:\/\/www.elastic.co\/guide\/en\/apm\/get-started\/current\/images\/apm-architecture-cloud.png\" width=\"786\" height=\"169\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/313\/125\/823\/313125823beffb2b7b701a479440a58b.png\"\/><\/p>\n<div><figcaption>\u0418\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0441: <a href=\"https:\/\/www.elastic.co\/guide\/en\/apm\/get-started\/current\/images\/apm-architecture-cloud.png\"><u>https:\/\/www.elastic.co\/guide\/en\/apm\/get-started\/current\/images\/apm-architecture-cloud.png<\/u><\/a><\/figcaption><\/div>\n<\/figure>\n<p>APM \u0440\u0430\u0441\u0448\u0438\u0444\u0440\u043e\u0432\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043a\u0430\u043a Application Performance Monitoring (\u043c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u043d\u0433 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439). \u0415\u0441\u043b\u0438 \u043d\u0430 \u0432\u0430\u0448\u0435\u043c \u043f\u0443\u0442\u0438 \u0432\u0441\u0442\u0440\u0435\u0447\u0430\u0435\u0442\u0441\u044f \u044d\u0442\u0430 \u0430\u0431\u0431\u0440\u0435\u0432\u0438\u0430\u0442\u0443\u0440\u0430, \u0442\u043e \u0440\u0435\u0447\u044c \u0441\u043a\u043e\u0440\u0435\u0435 \u0432\u0441\u0435\u0433\u043e \u0438\u0434\u0435\u0442 \u043e \u0438\u0437\u043c\u0435\u0440\u0435\u043d\u0438\u0438 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0432\u0430\u0448\u0435\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0438 \u0432\u0430\u0448\u0438\u0445 \u0441\u0435\u0440\u0432\u0435\u0440\u043e\u0432. \u041a\u0430\u043a \u043e\u043d\u0438 \u0441\u043f\u0440\u0430\u0432\u043b\u044f\u044e\u0442\u0441\u044f, \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u0430\u043c\u044f\u0442\u0438 \u043e\u043d\u0438 \u043f\u043e\u0442\u0440\u0435\u0431\u043b\u044f\u044e\u0442, \u0433\u0434\u0435 \u0443\u0437\u043a\u0438\u0435 \u043c\u0435\u0441\u0442\u0430? \u0418 \u044d\u0442\u043e \u0434\u0430\u043b\u0435\u043a\u043e \u043d\u0435 \u0432\u0441\u0435. \u0421 \u043f\u043e\u043c\u043e\u0449\u044c\u044e APM \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0435 \u0443\u0432\u0435\u0434\u043e\u043c\u043b\u0435\u043d\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0431\u0443\u0434\u0443\u0442 \u043e\u043f\u043e\u0432\u0435\u0449\u0430\u0442\u044c \u0432\u0430\u0441, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043e \u0442\u043e\u043c, \u0447\u0442\u043e \u043f\u043e\u0442\u0440\u0435\u0431\u043b\u0435\u043d\u0438\u0435 \u043f\u0430\u043c\u044f\u0442\u0438 \u0434\u043e\u0441\u0442\u0438\u0433\u043b\u043e \u043e\u0447\u0435\u043d\u044c \u0432\u044b\u0441\u043e\u043a\u0438\u0445 \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u0435\u0439 \u0438\u043b\u0438 \u0443\u0434\u0430\u043b\u0435\u043d\u043d\u044b\u0439 \u0432\u044b\u0437\u043e\u0432 \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u0442 \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u043c\u043d\u043e\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438. \u0422\u0440\u0438\u0433\u0433\u0435\u0440\u044b \u0434\u043b\u044f \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0445 \u0443\u0432\u0435\u0434\u043e\u043c\u043b\u0435\u043d\u0438\u0439 \u043c\u043e\u0433\u0443\u0442 \u043e\u043f\u0438\u0440\u0430\u0442\u044c\u0441\u044f \u043d\u0430 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0448\u0438\u0440\u043e\u043a\u0438\u0439 \u043d\u0430\u0431\u043e\u0440 \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u0435\u0439 \u0438 \u0441\u043e\u0431\u044b\u0442\u0438\u0439. \u041d\u043e \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u043d\u0435 \u0431\u0443\u0434\u0435\u043c \u0437\u0430\u0431\u0435\u0433\u0430\u0442\u044c \u0432\u043f\u0435\u0440\u0435\u0434.<\/p>\n<h3>\u041d\u0435\u043c\u043d\u043e\u0433\u043e \u0438\u0441\u0442\u043e\u0440\u0438\u0438<\/h3>\n<p>\u041a\u043e\u0433\u0434\u0430 \u044f \u0435\u0449\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u043b \u0432 <a href=\"https:\/\/pathao.com\/?lang=en\"><u>Pathao<\/u><\/a>, \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0438 New Relic. New Relic \u043e\u0447\u0435\u043d\u044c \u0443\u0434\u043e\u0431\u0435\u043d. \u0427\u0442\u043e\u0431\u044b \u043d\u0430\u0447\u0430\u0442\u044c \u0441 \u043d\u0438\u043c \u0440\u0430\u0431\u043e\u0442\u0443 \u0432 PHP \u0432\u0430\u043c \u043f\u0440\u043e\u0441\u0442\u043e \u043d\u0443\u0436\u043d\u043e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0435\u0433\u043e \u043f\u0430\u043a\u0435\u0442 \u0438 \u0430\u0433\u0435\u043d\u0442. \u0418 \u043d\u0430 \u044d\u0442\u043e\u043c \u0432\u0441\u0435. \u0412\u044b \u0441\u0440\u0430\u0437\u0443 \u0436\u0435 \u0443\u0432\u0438\u0434\u0438\u0442\u0435 \u0432\u0441\u044e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u0443\u044e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043d\u0430 \u0434\u0430\u0448\u0431\u043e\u0440\u0434\u0435 New Relic, \u043a\u0430\u043a \u0442\u043e\u043b\u044c\u043a\u043e \u0441\u0435\u0440\u0432\u0435\u0440 \u043d\u0430\u0447\u043d\u0435\u0442 \u043e\u0431\u0441\u043b\u0443\u0436\u0438\u0432\u0430\u0442\u044c \u0437\u0430\u043f\u0440\u043e\u0441\u044b. \u041d\u043e \u043c\u043e\u044f \u043d\u044b\u043d\u0435\u0448\u043d\u044f\u044f \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u044f (<a href=\"https:\/\/dh.health\/\"><u>Digital Healthcare Solutions<\/u><\/a>, \u0440\u0430\u043d\u0435\u0435 \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u0430\u044f \u043a\u0430\u043a Telenor Health), \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0438\u043b\u0430 Elastic APM. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043c\u043d\u0435 \u043f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u0440\u0430\u0437\u0431\u0438\u0440\u0430\u0442\u044c\u0441\u044f, \u043a\u0430\u043a \u043e\u043d \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442. \u0414\u043e \u044d\u0442\u043e\u0433\u043e \u043c\u043e\u043c\u0435\u043d\u0442 \u044f \u0443\u0436\u0435 \u043a\u0430\u043a \u043c\u0438\u043d\u0438\u043c\u0443\u043c 4 \u0440\u0430\u0437\u0430 \u043f\u0440\u043e\u0431\u043e\u0432\u0430\u043b \u0437\u0430\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0441\u0435\u0431\u044f \u043e\u0441\u0432\u043e\u0438\u0442\u044c Elastic Search, \u043d\u043e \u0432\u0441\u0435 \u0431\u0435\u0437\u0443\u0441\u043f\u0435\u0448\u043d\u043e. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u044f \u0438\u0441\u043a\u0430\u043b \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0435 \u0433\u043e\u0442\u043e\u0432\u044b\u0435 \u043f\u0430\u043a\u0435\u0442\u044b. \u0418 \u044f \u043d\u0430\u0448\u0435\u043b \u043a\u043e\u0435-\u0447\u0442\u043e. \u042d\u0442\u043e \u0431\u044b\u043b \u043e\u0447\u0435\u043d\u044c \u0445\u043e\u0440\u043e\u0448\u0438\u0439 \u043f\u0430\u043a\u0435\u0442, \u043d\u043e \u043f\u043e\u0434 \u043a\u0430\u043f\u043e\u0442\u043e\u043c \u043e\u043d \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u043b <strong>HTTP-\u0437\u0430\u043f\u0440\u043e\u0441\u044b<\/strong> \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440 APM. \u0427\u0442\u043e \u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0437\u0430\u0442\u0440\u0430\u0442\u043d\u043e. \u0418 \u043e\u043d \u043d\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u043b APM Server 7.x.<\/p>\n<p><a href=\"https:\/\/github.com\/philkra\/elastic-apm-laravel\">github.com<\/a><\/p>\n<p>\u0412\u043e\u0442 \u043f\u043e\u0447\u0435\u043c\u0443 \u043c\u043d\u0435 \u043f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0441\u0432\u043e\u0439 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u043f\u0430\u043a\u0435\u0442 \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0441 \u043d\u0443\u043b\u044f. \u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u0441\u043e\u0431\u0438\u0440\u0430\u044e\u0441\u044c \u043f\u0440\u043e\u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432\u0430\u043c, \u043a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043c\u043e\u0439 \u043f\u0430\u043a\u0435\u0442 \u0441 \u0430\u0431\u0441\u043e\u043b\u044e\u0442\u043d\u043e \u043b\u044e\u0431\u044b\u043c PHP-\u043a\u043e\u0434\u043e\u043c. \u041f\u0430\u043a\u0435\u0442 \u0443\u0436\u0435 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441 Laravel \u0438\u043b\u0438 Lumen. \u041d\u043e \u0432\u0430\u043c \u043d\u0435 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0447\u0442\u043e-\u043b\u0438\u0431\u043e \u0438\u0437 \u044d\u0442\u043e\u0433\u043e. \u041f\u0440\u0435\u043b\u0435\u0441\u0442\u044c \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0435\u0433\u043e \u043a\u0430\u043a \u0437\u0430\u0445\u043e\u0442\u0438\u0442\u0435.<\/p>\n<h3>\u0427\u0442\u043e \u0442\u0430\u043a\u043e\u0435 Elastic APM?<\/h3>\n<p>\u041e\u0431\u0440\u0430\u0442\u0438\u043b\u0438 \u043b\u0438 \u0432\u044b \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0432\u043d\u0430\u0447\u0430\u043b\u0435 \u0441\u0442\u0430\u0442\u044c\u0438? \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043d\u0435\u043d\u0430\u0434\u043e\u043b\u0433\u043e \u0432\u0435\u0440\u043d\u0435\u043c\u0441\u044f \u043a \u043d\u0435\u043c\u0443. \u041d\u0430 \u044d\u0442\u043e\u043c \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0438 \u043e\u0442\u0440\u0430\u0436\u0435\u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u043d\u0430\u044f \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u044d\u0442\u043e \u0432\u0441\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442. \u0412\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c APM-\u0430\u0433\u0435\u043d\u0442 \u0434\u043b\u044f \u0432\u0430\u0448\u0435\u0433\u043e \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0433\u043e \u044f\u0437\u044b\u043a\u0430 (APM-\u0430\u0433\u0435\u043d\u0442\u044b \u0434\u043e \u0441\u0438\u0445 \u043f\u043e\u0440 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u044e\u0442 \u043d\u0435 \u0432\u0441\u0435 \u044f\u0437\u044b\u043a\u0438, \u0442\u0430\u043a \u0447\u0442\u043e \u0438\u043c\u0435\u0439\u0442\u0435 \u044d\u0442\u043e \u0432\u0432\u0438\u0434\u0443). \u042d\u0442\u043e\u0442 \u0430\u0433\u0435\u043d\u0442 \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0431\u0438\u0440\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0438 \u0432\u0430\u0448\u0435\u0433\u043e \u043a\u043e\u0434\u0430. \u0417\u0430\u0442\u0435\u043c \u043e\u043d \u0431\u0443\u0434\u0435\u0442 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0438\u0445 \u043d\u0430 APM-\u0441\u0435\u0440\u0432\u0435\u0440. \u0414\u0430\u043b\u0435\u0435 \u0441\u0435\u0440\u0432\u0435\u0440\u044b APM \u043f\u0435\u0440\u0435\u0434\u0430\u044e\u0442 \u044d\u0442\u0438 \u0434\u0430\u043d\u043d\u044b\u0435 \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440 Elasticsearch, \u0438 \u0432\u044b \u0441\u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u0440\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u044d\u0442\u0438 \u0434\u0430\u043d\u043d\u044b\u0435 \u0432 Kibana. \u0421\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u043d\u0438\u0447\u0435\u0433\u043e \u0441\u0432\u0435\u0440\u0445\u044a\u0435\u0441\u0442\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0433\u043e. \u041d\u043e \u044f \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u043b, \u0447\u0442\u043e APM Dashboard UI \u043f\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441 XPack, \u0430 \u044d\u0442\u043e \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442, \u0447\u0442\u043e \u0432\u0430\u043c \u043f\u0440\u0438\u0434\u0435\u0442\u0441\u044f \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0440\u0430\u0441\u043a\u043e\u0448\u0435\u043b\u0438\u0442\u044c\u0441\u044f.<\/p>\n<h3>\u0418\u043d\u0441\u0442\u0430\u043b\u043b\u044f\u0446\u0438\u044f<\/h3>\n<p>Elastic \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 APM-\u0430\u0433\u0435\u043d\u0442\u0430 \u0434\u043b\u044f PHP. \u042d\u0442\u043e\u0442 \u0430\u0433\u0435\u043d\u0442 \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0431\u0438\u0440\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0441 \u043d\u0430\u0448\u0435\u0433\u043e \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c \u0438\u0445 \u043d\u0430 APM-\u0441\u0435\u0440\u0432\u0435\u0440. \u0421\u0432\u043e\u0435 PHP-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u044f \u0440\u0430\u0437\u043c\u0435\u0441\u0442\u0438\u043b \u0432 \u0434\u043e\u043a\u0435\u0440-\u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0435. \u0414\u043e\u043a\u0435\u0440-\u0444\u0430\u0439\u043b \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<pre><code class=\"php\">FROM php:7.4-fpm  RUN apt-get update  RUN apt-get install -y libpq-dev libpng-dev curl nano unzip zip git jq supervisor  RUN docker-php-ext-install pdo_pgsql  RUN pecl install -o -f redis  RUN docker-php-ext-enable redis  RUN curl -sS https:\/\/getcomposer.org\/installer | php -- --install-dir=\/usr\/local\/bin --filename=composer  RUN apt-get -y update &amp;&amp; apt-get -y install build-essential autoconf libcurl4-openssl-dev --no-install-recommends RUN mkdir -p \/home\/apm-agent &amp;&amp; \\     cd \/home\/apm-agent &amp;&amp; \\     git clone https:\/\/github.com\/elastic\/apm-agent-php.git apm &amp;&amp; \\     cd apm\/src\/ext &amp;&amp; \\     \/usr\/local\/bin\/phpize &amp;&amp; .\/configure --enable-elastic_apm &amp;&amp; \\     make clean &amp;&amp; make &amp;&amp; make install COPY .\/elastic_apm.ini \/usr\/local\/etc\/php\/conf.d\/elastic_apm.ini RUN mkdir \/app WORKDIR \/app   CMD [\"php\", \"-S\", \"0.0.0.0:80\", \"index.php\"]<\/code><\/pre>\n<p><em>\u0414\u043e\u043a\u0435\u0440-\u0444\u0430\u0439\u043b \u0434\u043b\u044f PHP-\u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0430. \u0418\u0433\u043d\u043e\u0440\u0438\u0440\u0443\u0439\u0442\u0435 \u0440\u0430\u0437\u0434\u0435\u043b CMD.<\/em><\/p>\n<p>\u0412 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u043d\u043e\u043c \u0432\u044b\u0448\u0435 \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442\u0435 \u0432\u0430\u043c \u0441\u0442\u043e\u0438\u0442 \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u044c \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430\u00a0 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0432 <em>\u0441\u0442\u0440\u043e\u043a\u0435 16<\/em>. \u041c\u044b \u043a\u043b\u043e\u043d\u0438\u0440\u0443\u0435\u043c git-\u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439 APM, \u0430 \u0437\u0430\u0442\u0435\u043c \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u043c \u0435\u0433\u043e \u0438 \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u0432 \u043d\u0430\u0448 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440.<\/p>\n<p>\u0412 <em>\u0441\u0442\u0440\u043e\u043a\u0435 22<\/em> \u043c\u044b \u043a\u043e\u043f\u0438\u0440\u0443\u0435\u043c <code>.ini<\/code> \u0444\u0430\u0439\u043b. \u0412\u043e\u0442 \u044d\u0442\u043e\u0442 <code>.ini<\/code> \u0444\u0430\u0439\u043b:<\/p>\n<pre><code class=\"php\">extension=elastic_apm.so elastic_apm.bootstrap_php_part_file=\/home\/apm-agent\/apm\/src\/bootstrap_php_part.php elastic_apm.enabled=true elastic_apm.server_url=\"http:\/\/docker.for.mac.localhost:8200\" ; elastic_apm.secret_token= elastic_apm.service_name=\"PHP APM Test Service\" ; service_version= ${git rev-parse HEAD} elastic_apm.log_level=DEBUG ; Available Log levels ; OFF | CRITICAL | ERROR | WARNING | NOTICE | INFO | DEBUG | TRACE<\/code><\/pre>\n<p><em>elastic_apm.ini file<\/em><\/p>\n<p>\u0412 \u0444\u0430\u0439\u043b\u0435 <code>elastic_apm.ini<\/code> <em>\u0441\u0442\u0440\u043e\u043a\u0430 2<\/em> \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u043f\u0443\u0442\u044c \u043a \u043d\u0430\u0448\u0435\u043c\u0443 \u0444\u0430\u0439\u043b\u0443 \u043a\u043b\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0433\u043e git-\u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u044f \u2013 <code>src\/bootstrap_php_part.php<\/code>. <em>\u0421\u0442\u0440\u043e\u043a\u0430 4<\/em> \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 URL <strong>APM-\u0441\u0435\u0440\u0432\u0435\u0440\u0430<\/strong>. \u0415\u0441\u043b\u0438 \u0432\u044b \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0435 \u0434\u043e\u043a\u0435\u0440, \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0441\u0434\u0435\u043b\u0430\u0442\u044c <em>git clone<\/em> \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u044f, \u0430 \u0437\u0430\u0442\u0435\u043c \u043f\u0440\u043e\u0441\u0442\u043e \u0438\u043d\u0441\u0442\u0430\u043b\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0435\u0433\u043e. \u0414\u0430\u043b\u044c\u0448\u0435 \u043c\u044b \u0438\u043d\u0442\u0435\u0433\u0440\u0438\u0440\u0443\u0435\u043c \u0441 php \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0435. \u042d\u0442\u043e \u0432\u0441\u0435, \u0447\u0442\u043e \u043a\u0430\u0441\u0430\u0435\u0442\u0441\u044f \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 APM-\u0430\u0433\u0435\u043d\u0442\u0430.<\/p>\n<p>\u041f\u0440\u0435\u0436\u0434\u0435 \u0447\u0435\u043c \u043c\u044b \u0443\u0433\u043b\u0443\u0431\u0438\u043c\u0441\u044f \u0432 \u0441\u0430\u043c \u043f\u0430\u043a\u0435\u0442, \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0441\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u043e\u0431 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0445 \u043f\u043e\u043d\u044f\u0442\u0438\u044f\u0445 \u0438\u0437 <a href=\"https:\/\/github.com\/elastic\/apm-agent-php\/blob\/master\/docs\/public-api.asciidoc\"><u>\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u043f\u043e \u0430\u0433\u0435\u043d\u0442\u0443<\/u><\/a>.<\/p>\n<p>\u041f\u043e \u0441\u0443\u0442\u0438 \u0432\u0441\u0435 \u0441\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u0432\u0441\u0435\u0433\u043e \u043a \u0434\u0432\u0443\u043c:<\/p>\n<ul>\n<li>\n<p><strong>\u0422\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u044f:<\/strong> \u041a\u043e\u0433\u0434\u0430 \u0432\u0430\u0448\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442, \u043e\u043d\u043e \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0438. \u041a\u0430\u0436\u0434\u044b\u0439 \u0437\u0430\u043f\u0440\u043e\u0441 \u0441\u0447\u0438\u0442\u0430\u0435\u0442\u0441\u044f \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0435\u0439. \u041a\u0430\u0436\u0434\u0430\u044f \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u044f \u0438\u043c\u0435\u0435\u0442 \u0438\u043c\u044f \u0438 \u0442\u0438\u043f.<\/p>\n<\/li>\n<\/ul>\n<ul>\n<li>\n<p><strong>\u0421\u043f\u0430\u043d:<\/strong> \u041a\u043e\u0433\u0434\u0430 \u0432\u044b \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0435 \u043a\u0430\u043a\u043e\u0439-\u043d\u0438\u0443\u0431\u0434\u044c \u043a\u043e\u0434, \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f, \u0441 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0432\u044b \u0438\u043c\u0435\u0435\u0442\u0435 \u0434\u0435\u043b\u043e, \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0430 \u200b\u200b\u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440 \u0432 \u0432\u0438\u0434\u0435 \u0441\u043f\u0430\u043d\u0430. \u0421\u043f\u0430\u043d (span) \u2014 \u044d\u0442\u043e \u0437\u0430\u043f\u0438\u0441\u044c \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438, \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u043c\u0430\u044f \u043e\u0434\u043d\u0438\u043c \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442\u043e\u043c \u043a\u043e\u0434\u0430. \u0417\u0430\u043f\u0440\u043e\u0441 \u043a \u0431\u0430\u0437\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0441\u043f\u0430\u043d\u043e\u043c, \u0442\u043e\u0447\u043d\u043e \u0442\u0430\u043a \u0436\u0435 \u043a\u0430\u043a \u0438 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f HTTP-\u0437\u0430\u043f\u0440\u043e\u0441\u0430.<\/p>\n<\/li>\n<\/ul>\n<h3>\u0421\u0430\u043c \u043f\u0430\u043a\u0435\u0442 \u0438 \u0440\u0430\u0431\u043e\u0442\u0430 \u0441 \u043d\u0438\u043c<\/h3>\n<p><a href=\"https:\/\/github.com\/ssi-anik\/elastic-apm-php\">github.com<\/a><\/p>\n<p>\u0418\u0442\u0430\u043a, \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0440\u0430\u0437\u0431\u0435\u0440\u0435\u043c\u0441\u044f, \u043a\u0430\u043a \u0438\u043d\u0442\u0435\u0433\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u0430\u043a\u0435\u0442 \u0441 PHP. \u0417\u0430\u0442\u0435\u043c \u043c\u044b \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u043a\u0430\u043a \u043e\u043d \u0438\u043d\u0442\u0435\u0433\u0440\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0441 Laravel\/Lumen. \u0421\u0430\u043c \u0430\u0433\u0435\u043d\u0442 \u0442\u0440\u0435\u0431\u0443\u0435\u0442 PHP \u0432\u0435\u0440\u0441\u0438\u0438 \u2265 7.2, \u0432\u043e\u0442 \u043f\u043e\u0447\u0435\u043c\u0443 \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0435 \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u0435 \u0434\u043b\u044f \u043f\u0430\u043a\u0435\u0442\u0430 \u2013 PHP 7.2.<\/p>\n<h3>\u0418\u043d\u0441\u0442\u0430\u043b\u043b\u044f\u0446\u0438\u044f<\/h3>\n<pre><code>composer require anik\/elastic-apm-php<\/code><\/pre>\n<h3>\u0418\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u044f \u0441 PHP<\/h3>\n<ul>\n<li>\n<p>\u041a\u043b\u0430\u0441\u0441 <code>Anik\\ElasticApm\\Agent<\/code> \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u0443\u0431\u043b\u0438\u0447\u043d\u043e\u0439 \u0442\u043e\u0447\u043a\u043e\u0439 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u0434\u043b\u044f \u0432\u0441\u0435\u0445 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439. \u041a\u043b\u0430\u0441\u0441 Agent \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0438\u043d\u0441\u0442\u0430\u043d\u0446\u0438\u0440\u043e\u0432\u0430\u043d \u2013 \u043e\u043d \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043e\u0431\u043e\u0439 \u0441\u0438\u043d\u0433\u043b\u0442\u043e\u043d. \u0422\u043e \u0435\u0441\u0442\u044c, \u0432\u0441\u044f\u043a\u0438\u0439 \u0440\u0430\u0437, \u043a\u043e\u0433\u0434\u0430 \u0432\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u043a\u0430\u043a-\u043b\u0438\u0431\u043e \u0441 \u043d\u0438\u043c \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c, \u0432\u044b \u0431\u0443\u0434\u0435\u0442\u0435 \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c <code>Agent::instance()<\/code>. \u0412\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0435 \u043e\u0434\u0438\u043d \u0438 \u0442\u043e\u0442 \u0436\u0435 \u043e\u0431\u044a\u0435\u043a\u0442, \u043e\u0442\u043a\u0443\u0434\u0430 \u0431\u044b \u0432\u044b \u0435\u0433\u043e \u043d\u0435 \u0432\u044b\u0437\u044b\u0432\u0430\u043b\u0438, \u043d\u0430 \u043f\u0440\u043e\u0442\u044f\u0436\u0435\u043d\u0438\u0438 \u0432\u0441\u0435\u0433\u043e \u0436\u0438\u0437\u043d\u0435\u043d\u043d\u043e\u0433\u043e \u0446\u0438\u043a\u043b\u0430 \u0437\u0430\u043f\u0440\u043e\u0441\u0430.<\/p>\n<\/li>\n<\/ul>\n<ul>\n<li>\n<p>\u0427\u0442\u043e\u0431\u044b \u0437\u0430\u0434\u0430\u0442\u044c \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0438 <strong>\u0438\u043c\u044f<\/strong> \u0438 <strong>\u0442\u0438\u043f<\/strong> \u0432\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u0438\u043d\u0441\u0442\u0430\u043d\u0446\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043e\u0431\u044a\u0435\u043a\u0442 <code>Anik\\ElasticApm\\Transaction<\/code> \u0441 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c\u0438 <em>name<\/em> \u0438 <em>type<\/em>. \u041f\u043e\u0441\u043b\u0435 \u0443\u0441\u043f\u0435\u0448\u043d\u043e\u0433\u043e \u0438\u043d\u0441\u0442\u0430\u043d\u0446\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u0432\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u0435\u0433\u043e \u0432 \u043a\u043b\u0430\u0441\u0441 <code>Agent<\/code> \u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u043e\u043c \u0435\u0433\u043e \u043c\u0435\u0442\u043e\u0434\u0430 <code>setTransaction<\/code>.<\/p>\n<\/li>\n<\/ul>\n<pre><code>Agent::instance()->setTransaction(new Transaction('name', 'type'));<\/code><\/pre>\n<ul>\n<li>\n<p>\u0415\u0441\u043b\u0438 \u0432\u044b \u0445\u043e\u0442\u0438\u0442\u0435 \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u044d\u0442\u043e\u0439 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0438 \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440, \u0432\u0430\u043c \u043f\u0440\u0438\u0434\u0435\u0442\u0441\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u043f\u0430\u043d. \u0427\u0442\u043e\u0431\u044b \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043d\u043e\u0432\u044b\u0439 \u0441\u043f\u0430\u043d, \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 <code>Anik\\ElasticApm\\Contracts\\SpanContract<\/code>, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u0442\u0430\u043a\u0438\u0435 \u043c\u0435\u0442\u043e\u0434\u044b, \u043a\u0430\u043a <code>getSpanData()<\/code>, <code>getName()<\/code>, <code>getType()<\/code>, <code>getSubType()<\/code>. \u041d\u043e \u0435\u0441\u043b\u0438 \u0432\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0435 \u0442\u0440\u0435\u0439\u0442 <code>Anik\\ElasticApm\\Spans\\SpanEmptyFieldsTrait<\/code>, \u0442\u043e\u0433\u0434\u0430 \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043e\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u043c\u0435\u0442\u043e\u0434\u044b <code>getAction()<\/code> \u0438 <code>getLabels()<\/code>. \u0415\u0441\u043b\u0438 \u0436\u0435 \u0432\u044b \u0445\u043e\u0442\u0438\u0442\u0435 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u043d\u0430 \u0441\u0432\u043e\u0439 APM-\u0441\u0435\u0440\u0432\u0435\u0440, \u0442\u043e \u0432\u0430\u043c \u043d\u0435 \u043f\u043e\u043c\u0435\u0448\u0430\u043b\u043e \u0431\u044b \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u044d\u0442\u0438 \u043c\u0435\u0442\u043e\u0434\u044b. \u042f \u043d\u0435 \u0431\u0443\u0434\u0443 \u0437\u0434\u0435\u0441\u044c \u043e\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0442\u044c\u0441\u044f \u043d\u0430 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u044b\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f\u0445 \u043c\u0435\u0442\u043e\u0434\u043e\u0432, \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043d\u0430\u0439\u0442\u0438 \u044d\u0442\u0443 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u0432 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u043f\u043e \u0430\u0433\u0435\u043d\u0442\u0443 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u043d\u043e\u0439 \u0432\u044b\u0448\u0435.<\/p>\n<\/li>\n<\/ul>\n<ul>\n<li>\n<p>\u041a\u043e\u0433\u0434\u0430 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043a\u043b\u0430\u0441\u0441\u0430 <strong>Span<\/strong> \u0431\u0443\u0434\u0435\u0442 \u0433\u043e\u0442\u043e\u0432\u0430, \u0432\u044b \u0441\u043c\u043e\u0436\u0435\u0442\u0435 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c \u0441\u043f\u0430\u043d \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<\/li>\n<\/ul>\n<pre><code>Agent::instance()->addSpan(\" class=\"formula inline\">implementedSpanObject);<\/code><\/pre>\n<ul>\n<li>\n<p>\u041d\u0430\u043a\u043e\u043d\u0435\u0446, \u043a\u043e\u0433\u0434\u0430 \u0432\u044b \u0437\u0430\u043a\u043e\u043d\u0447\u0438\u0442\u0435 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c \u0441\u043f\u0430\u043d\u044b, \u0442\u043e, \u043f\u0440\u0435\u0436\u0434\u0435 \u0447\u0435\u043c \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0442\u044c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442, \u0432\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u0432\u0441\u0435 \u044d\u0442\u0438 <em>\u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0438 <\/em>\u0438 <em>\u0441\u043f\u0430\u043d\u044b<\/em> \u0432 APM-\u0430\u0433\u0435\u043d\u0442. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435<\/p>\n<\/li>\n<\/ul>\n<pre><code>Agent::instance()->capture();<\/code><\/pre>\n<p>\u041f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u043d\u044b\u0439 \u0432\u044b\u0448\u0435 \u043c\u0435\u0442\u043e\u0434 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442 \u0432\u0441\u0435 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0438 \u0438 \u0441\u043f\u0430\u043d\u044b, \u0430 \u0437\u0430\u0442\u0435\u043c \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u0442 \u0438\u0445 \u0430\u0433\u0435\u043d\u0442\u0443, \u043f\u043e\u0441\u043b\u0435 \u0447\u0435\u0433\u043e \u0430\u0433\u0435\u043d\u0442 \u0431\u0435\u0440\u0435\u0442 \u043d\u0430 \u0441\u0435\u0431\u044f \u0437\u0430\u0431\u043e\u0442\u0443 \u043e\u0431 \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0435 \u0438\u0445 \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440.<\/p>\n<p><strong>\u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u0435<\/strong>: \u0415\u0441\u043b\u0438 \u0432\u044b \u0445\u043e\u0442\u0438\u0442\u0435 \u0434\u0435\u043b\u0430\u0442\u044c \u0432\u0441\u0435 \u0441\u0430\u043c\u043e\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e, \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <code>Agent::getElasticApmTransaction()<\/code>, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0442\u0435\u043a\u0443\u0449\u0443\u044e \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u044e \u0430\u0433\u0435\u043d\u0442\u0430, \u0438\u043b\u0438 <code>Agent::newApmTransaction($name, $type)<\/code>, \u0447\u0442\u043e\u0431\u044b \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043d\u043e\u0432\u0443\u044e \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u044e. \u041e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0432\u044b\u0437\u044b\u0432\u0430\u0439\u0442\u0435 \u043c\u0435\u0442\u043e\u0434 <code>end()<\/code>, \u0435\u0441\u043b\u0438 \u0432\u044b \u0441\u043e\u0437\u0434\u0430\u043b\u0438 \u043d\u043e\u0432\u044b\u0439 \u043e\u0431\u044a\u0435\u043a\u0442 <code>Transaction<\/code>. \u0418\u043b\u0438, \u0435\u0441\u043b\u0438 \u0432\u044b \u0445\u043e\u0442\u0438\u0442\u0435 \u043f\u043e\u043c\u0435\u0441\u0442\u0438\u0442\u044c \u0441\u043f\u0430\u043d\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u044b \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442\u0435, \u0432 \u043d\u043e\u0432\u0443\u044e \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u044e, \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043c\u0435\u0442\u043e\u0434 <code>Agent::captureOnNew()<\/code>, \u0447\u0442\u043e\u0431\u044b \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u0438\u0445 \u0441 \u043d\u043e\u0432\u043e\u0439 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0435\u0439. \u0412\u0430\u043c \u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c <code>end<\/code>, \u043a\u043e\u0433\u0434\u0430 \u0432\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0435 <code>captureOnNew<\/code>. \u0415\u0441\u043b\u0438 \u0432\u0430\u043c \u0432\u0434\u0440\u0443\u0433 \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u044c\u0441\u044f \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0441\u0432\u0435\u0436\u0438\u0439 \u0438\u043d\u0441\u0442\u0430\u043d\u0441 <code>Agent<\/code>, \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u0432\u044b\u0437\u0432\u0430\u0442\u044c <code>Agent::reset()<\/code>, \u0430 \u043f\u043e\u0442\u043e\u043c <code>Agent::instance()<\/code>, \u043d\u043e <code>Agent::reinstance()<\/code> \u0431\u0443\u0434\u0435\u0442 \u0434\u0435\u043b\u0430\u0442\u044c \u0442\u043e \u0436\u0435 \u0441\u0430\u043c\u043e\u0435. \u041d\u0430\u043a\u043e\u043d\u0435\u0446, \u0438\u043c\u0435\u0439\u0442\u0435 \u0432 \u0432\u0438\u0434\u0443, \u0447\u0442\u043e \u0435\u0441\u043b\u0438 \u0432\u044b \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0435 \u043b\u044e\u0431\u043e\u0439 \u0438\u0437 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 <code>capture*()<\/code>, \u0442\u043e \u0441 \u043d\u0438\u043c \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d \u043e\u0431\u044a\u0435\u043a\u0442 <code>Transaction<\/code>. \u0411\u0435\u0437 \u043e\u0431\u044a\u0435\u043a\u0442\u0430 Transaction \u0432\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0435 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 <code>Anik\\ElasticApm\\Exceptions\\RequirementMissingException<\/code>.<\/p>\n<p>\u041d\u0430 \u044d\u0442\u043e\u043c \u043c\u044b \u0437\u0430\u043a\u043e\u043d\u0447\u0438\u043b\u0438 \u0441 \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u0435\u0439 \u0441 PHP.<\/p>\n<h3>\u0418\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u044f \u0441 Laravel\/Lumen<\/h3>\n<p>\u0414\u043b\u044f <strong>Laravel:<\/strong><\/p>\n<ul>\n<li>\n<p>\u041f\u0430\u043a\u0435\u0442 \u0443\u0436\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0438\u044f \u043f\u0430\u043a\u0435\u0442\u043e\u0432. \u041d\u043e \u0432\u0441\u0435 \u0436\u0435 \u0434\u043e\u0431\u0430\u0432\u044c\u0442\u0435 <code>Anik\\ElasticApm\\Providers\\ElasticApmServiceProvider::class<\/code><em> <\/em>\u0432 \u043c\u0430\u0441\u0441\u0438\u0432 <code>providers<\/code> \u0432\u0430\u0448\u0435\u0433\u043e <code>config\/app.php.<\/code><\/p>\n<\/li>\n<\/ul>\n<ul>\n<li>\n<p>\u0414\u043e\u0431\u0430\u0432\u044c\u0442\u0435 <code>Anik\\ElasticApm\\Facades\\Agent::class<\/code> \u0432 \u043c\u0430\u0441\u0441\u0438\u0432 <code>facade<\/code> \u0432\u0430\u0448\u0435\u0433\u043e <code>config\/app.php<\/code>.<\/p>\n<\/li>\n<\/ul>\n<ul>\n<li>\n<p>\u0417\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u0435 <code>php artisan vendor:publish<\/code>, \u0447\u0442\u043e\u0431\u044b \u043e\u043f\u0443\u0431\u043b\u0438\u043a\u043e\u0432\u0430\u0442\u044c \u0444\u0430\u0439\u043b \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438.<\/p>\n<\/li>\n<\/ul>\n<p>\u0414\u043b\u044f <strong>Lumen:<\/strong><\/p>\n<ul>\n<li>\n<p>\u0412\u0430\u043c \u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u0432\u043e\u0437\u0438\u0442\u044c\u0441\u044f \u0441 <strong>Facade<\/strong>, \u0447\u0442\u043e\u0431\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u044d\u0442\u043e\u0442 \u043f\u0430\u043a\u0435\u0442.<\/p>\n<\/li>\n<\/ul>\n<ul>\n<li>\n<p>\u0421\u043a\u043e\u043f\u0438\u0440\u0443\u0439\u0442\u0435 <code>elastic-apm.php<\/code> \u0438\u0437 \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0430 <code>src\/config<\/code> \u043f\u0430\u043a\u0435\u0442\u0430 \u0432 \u043a\u0430\u0442\u0430\u043b\u043e\u0433 <em>config <\/em>\u0432\u0430\u0448\u0435\u0433\u043e lumen-\u043f\u0440\u043e\u0435\u043a\u0442\u0430.<\/p>\n<\/li>\n<\/ul>\n<pre><code class=\"php\">\/\/ \u0432 \u0432\u0430\u0448 \u0444\u0430\u0439\u043b bootstrap\/app.php. use Anik\\ElasticApm\\Providers\\ElasticApmServiceProvider; $app->register(ElasticApmServiceProvider::class); $app->configure('elastic-apm');<\/code><\/pre>\n<p>\u0412\u044b \u0442\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u0435\u0442\u0435 \u0441\u043c\u0435\u043b\u043e \u0438\u0437\u043c\u0435\u043d\u044f\u0442\u044c \u0444\u0430\u0439\u043b \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 \u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0438 \u0441 \u0432\u0430\u0448\u0438\u043c\u0438 \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u044f\u043c\u0438.<\/p>\n<h3>\u041e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u043d\u0438\u0435 \u043e\u0448\u0438\u0431\u043e\u043a \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439<\/h3>\n<p>\u0415\u0441\u043b\u0438 \u0432\u044b \u0445\u043e\u0442\u0438\u0442\u0435 \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u043e\u0431 \u043e\u0448\u0438\u0431\u043a\u0435 \u043d\u0430 \u0432\u0430\u0448 APM-\u0441\u0435\u0440\u0432\u0435\u0440, \u0442\u043e<\/p>\n<ul>\n<li>\n<p>\u0414\u043b\u044f Laravel, \u0432 <code>bootstrap\/app.php<\/code><\/p>\n<\/li>\n<\/ul>\n<pre><code class=\"php\">\/\/ \u042d\u0422\u041e\u0422 \u0420\u0410\u0417\u0414\u0415\u041b \u0421\u041b\u0415\u0414\u0423\u0415\u0422 \u0417\u0410\u041a\u041e\u041c\u041c\u0415\u041d\u0422\u0418\u0420\u041e\u0412\u0410\u0422\u042c \/**  *  $app->singleton(  *      Illuminate\\Contracts\\Debug\\ExceptionHandler::class,  *      App\\Exceptions\\Handler::class  *  );  *\/ \/\/ \u0418\u0421\u041f\u041e\u041b\u042c\u0417\u0423\u0419\u0422\u0415 \u042d\u0422\u041e\u0422 \u0420\u0410\u0417\u0414\u0415\u041b use Illuminate\\Contracts\\Debug\\ExceptionHandler; use Anik\\ElasticApm\\Exceptions\\Handler; use App\\Exceptions\\Handler as AppExceptionHandler; use Symfony\\Component\\HttpKernel\\Exception\\NotFoundHttpException; use GuzzleHttp\\Exception\\ConnectException; $app->singleton(ExceptionHandler::class, function ($app) {     return new Handler(new AppExceptionHandler($app), [         \/\/ NotFoundHttpException::class, \/\/(1)         \/\/ ConnectException::class, \/\/(2)     ]); });<\/code><\/pre>\n<p><code>Anik\\ElasticApm\\Exceptions\\Handler<\/code><strong> <\/strong>\u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u043c\u0430\u0441\u0441\u0438\u0432 \u043a\u043b\u0430\u0441\u0441\u043e\u0432 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0439 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0432\u0442\u043e\u0440\u043e\u0433\u043e \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430 (\u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c\u0441\u044f \u043d\u0430 APM-\u0441\u0435\u0440\u0432\u0435\u0440). \u041f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u043e\u0448\u0438\u0431\u043a\u0438 <code>NotFoundHttpException<\/code><strong> <\/strong>\u043d\u0435 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u043d\u0430 APM-\u0441\u0435\u0440\u0432\u0435\u0440. \u0421\u0442\u0440\u043e\u0447\u043a\u0438, \u043f\u043e\u043c\u0435\u0447\u0435\u043d\u043d\u044b\u0435 (1) \u0438 (2) \u0431\u044b\u043b\u0438 \u0437\u0430\u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u044b, \u0447\u0442\u043e\u0431\u044b \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u0432\u0430\u043c \u043d\u0430 \u044d\u0442\u043e.<\/p>\n<p>\u0415\u0441\u043b\u0438 \u0432\u0430\u0448\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0441\u0442\u0430\u043b\u043a\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0441 <em>\u043e\u0448\u0438\u0431\u043a\u043e\u0439<\/em>, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0431\u044b\u043b\u0430 \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u043f\u0435\u0440\u0435\u0445\u0432\u0430\u0447\u0435\u043d\u0430 <em>\u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u043c \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0439 <\/em>(Exception Handler), \u0438 \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u0443\u0436\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043d\u044b \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0438, \u0442\u043e APM-\u0441\u0435\u0440\u0432\u0435\u0440 \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442 \u0441\u0442\u0435\u043a-\u0442\u0440\u0435\u0439\u0441 \u043e\u0448\u0438\u0431\u043a\u0438. \u041f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 PHP-\u0430\u0433\u0435\u043d\u0442 \u043d\u0435 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 API \u0434\u043b\u044f \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438 \u0441\u0442\u0435\u043a\u0430-\u0442\u0440\u0435\u0439\u0441\u0430, \u0432\u0430\u0448 \u0442\u0440\u0435\u0439\u0441 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043e\u0431\u0440\u0435\u0437\u0430\u043d \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u043c \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0439.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/efb\/151\/1de\/efb1511de8c723c7101bc2aa7d2e0260.png\" alt=\"\u0412 \u043e\u0442\u0432\u0435\u0442\u0435 \u0431\u044b\u043b\u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0435\u043d\u044b \u043a\u043e\u0434 500 (\u043e\u0442\u043c\u0435\u0447\u0435\u043d\u043e) \u0438 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0441\u043e \u0441\u0442\u0435\u043a-\u0442\u0440\u0435\u0439\u0441\u043e\u043c.\" title=\"\u0412 \u043e\u0442\u0432\u0435\u0442\u0435 \u0431\u044b\u043b\u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0435\u043d\u044b \u043a\u043e\u0434 500 (\u043e\u0442\u043c\u0435\u0447\u0435\u043d\u043e) \u0438 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0441\u043e \u0441\u0442\u0435\u043a-\u0442\u0440\u0435\u0439\u0441\u043e\u043c.\" width=\"786\" height=\"194\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/efb\/151\/1de\/efb1511de8c723c7101bc2aa7d2e0260.png\"\/><\/p>\n<div><figcaption>\u0412 \u043e\u0442\u0432\u0435\u0442\u0435 \u0431\u044b\u043b\u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0435\u043d\u044b \u043a\u043e\u0434 500 (\u043e\u0442\u043c\u0435\u0447\u0435\u043d\u043e) \u0438 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0441\u043e \u0441\u0442\u0435\u043a-\u0442\u0440\u0435\u0439\u0441\u043e\u043c.<\/figcaption><\/div>\n<\/figure>\n<h3>\u041e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u043d\u0438\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u0438 \u043e\u0442\u0432\u0435\u0442\u043e\u0432 \u0432\u0430\u0448\u0435\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f<\/h3>\n<p>\u0414\u043b\u044f \u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u043d\u0438\u044f \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043e\u0431\u0441\u043b\u0443\u0436\u0438\u0432\u0430\u0435\u0442 \u0432\u0430\u0448\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435, \u043a\u043e\u0434\u043e\u0432 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u0438 \u0432\u0440\u0435\u043c\u0435\u043d\u0438, \u0437\u0430\u0442\u0440\u0430\u0447\u0435\u043d\u043d\u043e\u0433\u043e \u043d\u0430 \u0438\u0445 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0443, \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0435 \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u043e\u0435 middleware.<\/p>\n<ul>\n<li>\n<p>\u0414\u043b\u044f Laravel, \u0432 \u0432\u0430\u0448\u0435\u043c \u043a\u043b\u0430\u0441\u0441\u0435 <code>app\/Http\/Kernel.php<\/code>:<\/p>\n<\/li>\n<\/ul>\n<pre><code class=\"php\">&lt;?php use Anik\\ElasticApm\\Middleware\\RecordForegroundTransaction; class Kernel extends HttpKernel {     protected $middleware = [         \/\/ ...                 RecordForegroundTransaction::class,         \/\/ ..     ]; }<\/code><\/pre>\n<ul>\n<li>\n<p>\u0414\u043b\u044f Lumen, \u0432 \u0432\u0430\u0448\u0435\u043c \u0444\u0430\u0439\u043b\u0435 <code>bootstrap\/app.php<\/code>:<\/p>\n<\/li>\n<\/ul>\n<pre><code class=\"php\">use Anik\\ElasticApm\\Middleware\\RecordForegroundTransaction; $app->middleware([     \/\/ ...     RecordForegroundTransaction::class,     \/\/ ... ]);<\/code><\/pre>\n<p>\u0418\u043c\u044f \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0438 \u0434\u043b\u044f \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u043c\u044b\u0445 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u043f\u043e\u0434\u0447\u0438\u043d\u044f\u0435\u0442\u0441\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u043b\u043e\u0433\u0438\u043a\u0435:<\/p>\n<ul>\n<li>\n<p>\u0415\u0441\u043b\u0438 route handler \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 <code>uses<\/code>, \u0442.\u0435.; <code>HomeController@index<\/code> (\u043c\u0435\u0442\u043e\u0434 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430).<\/p>\n<\/li>\n<li>\n<p>\u0415\u0441\u043b\u0438 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u00a0 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 <code>as<\/code>, \u0442.\u0435.<code>;['as' => 'home.index']<\/code> (\u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u043c\u0430\u0440\u0448\u0440\u0443\u0442).<\/p>\n<\/li>\n<li>\n<p>\u0415\u0441\u043b\u0438 \u044d\u0442\u043e \u043d\u0435 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u0432\u044b\u0448\u0435, \u0442\u043e \u0442\u043e\u0433\u0434\u0430 \u2013 <code>HTTP_VERB ROUTE_PATH<\/code>, \u0442.\u0435.; <code>GET \/user\/api<\/code>.<\/p>\n<\/li>\n<li>\n<p>\u0415\u0441\u043b\u0438 \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u043f\u043e\u0434\u0445\u043e\u0434\u0438\u0442, 404, \u0437\u0430\u0442\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f index.php \u0438\u043b\u0438 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043d\u043e\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u043c \u0438\u043c\u044f \u0438\u0437 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438.<\/p>\n<\/li>\n<\/ul>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/ef7\/7de\/d9b\/ef77ded9b7045dffc9172083f1d36f46.png\" alt=\"\u0422\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u0430 (\u0428\u0430\u0433 1)\" title=\"\u0422\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u0430 (\u0428\u0430\u0433 1)\" width=\"1400\" height=\"47\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/ef7\/7de\/d9b\/ef77ded9b7045dffc9172083f1d36f46.png\"\/><\/p>\n<div><figcaption>\u0422\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u0430 (\u0428\u0430\u0433 1)<\/figcaption><\/div>\n<\/figure>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/1fe\/f39\/af5\/1fef39af55222d3220117bb88162204b.png\" alt=\"\u041d\u0430\u0437\u044b\u0432\u0430\u0435\u043c \u043c\u0430\u0440\u0448\u0440\u0443\u0442 \u043a\u0430\u043a \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u044e (\u0448\u0430\u0433 2)\" title=\"\u041d\u0430\u0437\u044b\u0432\u0430\u0435\u043c \u043c\u0430\u0440\u0448\u0440\u0443\u0442 \u043a\u0430\u043a \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u044e (\u0448\u0430\u0433 2)\" width=\"1400\" height=\"47\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/1fe\/f39\/af5\/1fef39af55222d3220117bb88162204b.png\"\/><\/p>\n<div><figcaption>\u041d\u0430\u0437\u044b\u0432\u0430\u0435\u043c \u043c\u0430\u0440\u0448\u0440\u0443\u0442 \u043a\u0430\u043a \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u044e (\u0448\u0430\u0433 2)<\/figcaption><\/div>\n<\/figure>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/97a\/cbf\/f12\/97acbff120ebc940de2e59aa3c92dc63.png\" alt=\"\u041c\u0430\u0440\u0448\u0440\u0443\u0442 \u0441 \u0433\u043b\u0430\u0433\u043e\u043b\u043e\u043c (\u0448\u0430\u0433 3)\" title=\"\u041c\u0430\u0440\u0448\u0440\u0443\u0442 \u0441 \u0433\u043b\u0430\u0433\u043e\u043b\u043e\u043c (\u0448\u0430\u0433 3)\" width=\"1400\" height=\"49\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/97a\/cbf\/f12\/97acbff120ebc940de2e59aa3c92dc63.png\"\/><\/p>\n<div><figcaption>\u041c\u0430\u0440\u0448\u0440\u0443\u0442 \u0441 \u0433\u043b\u0430\u0433\u043e\u043b\u043e\u043c (\u0448\u0430\u0433 3)<\/figcaption><\/div>\n<\/figure>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/2c5\/7e2\/fa5\/2c57e2fa536e284257e6bb45f1859d27.png\" alt=\"\u041c\u0430\u0440\u0448\u0440\u0443\u0442\u044b \u043d\u0435 \u043d\u0430\u0439\u0434\u0435\u043d\u044b (\u0428\u0430\u0433 4)\" title=\"\u041c\u0430\u0440\u0448\u0440\u0443\u0442\u044b \u043d\u0435 \u043d\u0430\u0439\u0434\u0435\u043d\u044b (\u0428\u0430\u0433 4)\" width=\"1400\" height=\"47\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/2c5\/7e2\/fa5\/2c57e2fa536e284257e6bb45f1859d27.png\"\/><\/p>\n<div><figcaption>\u041c\u0430\u0440\u0448\u0440\u0443\u0442\u044b \u043d\u0435 \u043d\u0430\u0439\u0434\u0435\u043d\u044b (\u0428\u0430\u0433 4)<\/figcaption><\/div>\n<\/figure>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/38e\/bc0\/c7e\/38ebc0c7e30c8247789ee96d71cc6e46.png\" alt=\"\u0421\u043f\u0430\u043d \u0441 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u043d\u043d\u044b\u043c \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u043c\" title=\"\u0421\u043f\u0430\u043d \u0441 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u043d\u043d\u044b\u043c \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u043c\" width=\"1400\" height=\"50\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/38e\/bc0\/c7e\/38ebc0c7e30c8247789ee96d71cc6e46.png\"\/><\/p>\n<div><figcaption>\u0421\u043f\u0430\u043d \u0441 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u043d\u043d\u044b\u043c \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u043c<\/figcaption><\/div>\n<\/figure>\n<h3>\u041e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u043d\u0438\u0435 \u0443\u0434\u0430\u043b\u0435\u043d\u043d\u044b\u0445 HTTP-\u0432\u044b\u0437\u043e\u0432\u043e\u0432\u00a0<\/h3>\n<p>\u0415\u0441\u043b\u0438 \u0432\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0435 Guzzle, \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u043e\u0435 middleware \u0434\u043b\u044f Guzzle.<\/p>\n<pre><code class=\"php\">use GuzzleHttp\\HandlerStack; use GuzzleHttp\\Client; use Anik\\ElasticApm\\Middleware\\RecordHttpTransaction;  $stack = HandlerStack::create(); $stack->push(new RecordHttpTransaction(), 'whatever-you-wish'); $client = new Client([     'base_uri' => 'https:\/\/httpbin.org',     'timeout'  => 10.0,     'handler'  => $stack, ]); $client->request('GET', '\/');<\/code><\/pre>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/baf\/df7\/cc5\/bafdf7cc5ec54da608a8a769c1cc4806.png\" alt=\"\u041e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u043d\u0438\u0435 \u0443\u0434\u0430\u043b\u0435\u043d\u043d\u043e\u0433\u043e HTTP-\u0432\u044b\u0437\u043e\u0432\u0430\" title=\"\u041e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u043d\u0438\u0435 \u0443\u0434\u0430\u043b\u0435\u043d\u043d\u043e\u0433\u043e HTTP-\u0432\u044b\u0437\u043e\u0432\u0430\" width=\"1400\" height=\"50\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/baf\/df7\/cc5\/bafdf7cc5ec54da608a8a769c1cc4806.png\"\/><\/p>\n<div><figcaption>\u041e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u043d\u0438\u0435 \u0443\u0434\u0430\u043b\u0435\u043d\u043d\u043e\u0433\u043e HTTP-\u0432\u044b\u0437\u043e\u0432\u0430<\/figcaption><\/div>\n<\/figure>\n<h3>\u041e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u043d\u0438\u0435 \u0440\u0430\u0431\u043e\u0442\u043d\u0438\u043a\u0430 \u043e\u0447\u0435\u0440\u0435\u0434\u0438<\/h3>\n<p>\u0427\u0442\u043e\u0431\u044b \u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u0442\u044c \u0437\u0430\u0434\u0430\u0447\u0438 (jobs), \u0432\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u043e\u0435 (Job) middleware \u0432\u0441\u044f\u043a\u0438\u0439 \u0440\u0430\u0437, \u043a\u043e\u0433\u0434\u0430 \u0432\u044b \u0434\u0438\u0441\u043f\u0430\u0442\u0447\u0438\u0442\u0435 \u043d\u043e\u0432\u0443\u044e \u0437\u0430\u0434\u0430\u0447\u0443. \u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043b\u044e\u0431\u043e\u0435 \u0438\u0437 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u043d\u044b\u0445 \u043d\u0438\u0436\u0435:<\/p>\n<ul>\n<li>\n<p>\u0418\u0437 \u043a\u043b\u0430\u0441\u0441\u0430 \u0441 \u043c\u0435\u0442\u043e\u0434\u043e\u043c <strong>middleware<\/strong>:<\/p>\n<\/li>\n<\/ul>\n<pre><code class=\"php\">use Anik\\ElasticApm\\Middleware\\RecordBackgroundTransaction; use Illuminate\\Contracts\\Queue\\ShouldQueue; class TestSimpleJob implements ShouldQueue  {     public function middleware () {         return [ new RecordBackgroundTransaction()];     }          public function handle () {         app('log')->info('job is handled');     } }<\/code><\/pre>\n<ul>\n<li>\n<p>\u0412 \u043f\u0440\u043e\u0442\u0438\u0432\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435, \u043f\u0440\u0438 \u0434\u0438\u0441\u043f\u0430\u0442\u0447\u0435 \u0437\u0430\u0434\u0430\u0447\u0438:<\/p>\n<\/li>\n<\/ul>\n<pre><code class=\"php\">use Anik\\ElasticApm\\Middleware\\RecordBackgroundTransaction as JM; use App\\Jobs\\ExampleJob; dispatch((new ExampleJob())->through([new JM()]);<\/code><\/pre>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/00f\/323\/1f6\/00f3231f6f2e4ab79d645d109b9f5d56.png\" alt=\"\u041e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u043d\u0438\u0435 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0437\u0430\u0434\u0430\u0447\" title=\"\u041e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u043d\u0438\u0435 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0437\u0430\u0434\u0430\u0447\" width=\"1400\" height=\"100\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/00f\/323\/1f6\/00f3231f6f2e4ab79d645d109b9f5d56.png\"\/><\/p>\n<div><figcaption>\u041e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u043d\u0438\u0435 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0437\u0430\u0434\u0430\u0447<\/figcaption><\/div>\n<\/figure>\n<p><strong>\u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u0435<\/strong>: \u0415\u0441\u043b\u0438 \u0432\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0435\u00a0 <code>php artisan queue:work<\/code>, \u0442\u043e \u044d\u0442\u043e \u0437\u043d\u0430\u0447\u0438\u0442, \u0447\u0442\u043e \u0437\u0430\u0434\u0430\u0447\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0434\u043e\u043b\u0433\u043e. \u0418\u043c\u0435\u043d\u043d\u043e \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0431\u0443\u0434\u0435\u0442 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0430 \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u043d\u0430 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u044f. \u0415\u0441\u043b\u0438 \u043d\u0435 \u0441\u043e\u0437\u0434\u0430\u0435\u0442\u0441\u044f \u043f\u0440\u043e\u0446\u0435\u0441\u0441, \u0442\u043e \u0432\u044b \u043d\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0435 \u043d\u0438 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0438, \u043d\u0438 \u0441\u043f\u0430\u043d\u0430. \u0421 \u0434\u0440\u0443\u0433\u043e\u0439 \u0441\u0442\u043e\u0440\u043e\u043d\u044b, \u0435\u0441\u043b\u0438 \u0432\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0435 <code>queue:listen<\/code>, \u0442.\u0435.: <code>php artisan queue:listen<\/code> \u2013 \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d \u043d\u043e\u0432\u044b\u0439 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0438, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0432\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0435 \u043d\u043e\u0432\u0443\u044e \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u044e \u0438 \u0441\u043f\u0430\u043d\u044b \u0434\u043b\u044f \u044d\u0442\u043e\u0439 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0438 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0438.<\/p>\n<h3>\u041e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u043d\u0438\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u0430<\/h3>\n<p>\u0412\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u0442\u0441\u044f \u043d\u0430 APM-\u0441\u0435\u0440\u0432\u0435\u0440.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/340\/1d8\/f44\/3401d8f44c506687b468003b1f3862d1.png\" alt=\"\u0412\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u0430\" title=\"\u0412\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u0430\" width=\"1400\" height=\"76\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/340\/1d8\/f44\/3401d8f44c506687b468003b1f3862d1.png\"\/><\/p>\n<div><figcaption>\u0412\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u0430<\/figcaption><\/div>\n<\/figure>\n<p>\u0412\u043e\u0442 \u0438 \u0432\u0441\u0435. \u041d\u0430\u0434\u0435\u044e\u0441\u044c, \u0432\u0430\u043c \u043f\u043e\u043d\u0440\u0430\u0432\u0438\u043b\u043e\u0441\u044c. \u041d\u0435 \u0437\u0430\u0431\u0443\u0434\u044c\u0442\u0435 \u043f\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u044d\u0442\u043e\u043c\u0443 \u043f\u0440\u043e\u0435\u043a\u0442\u0443 \u0437\u0432\u0435\u0437\u0434\u0443)<\/p>\n<h3>\u041e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u043d\u0438\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f Redis-\u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432\u00a0<\/h3>\n<p>\u0412\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 Redis-\u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u043d\u0435 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438. \u0415\u0441\u043b\u0438 \u0432\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0435 Redis \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0434\u0440\u0430\u0439\u0432\u0435\u0440\u0430 \u043a\u044d\u0448\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f (Cache Driver), \u0432\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u044f\u0432\u043d\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u044c, \u0447\u0442\u043e \u0432\u044b \u0445\u043e\u0442\u0438\u0442\u0435 \u0432\u043a\u043b\u044e\u0447\u0438\u0442\u044c Redis Query Logging, \u0434\u043e\u0431\u0430\u0432\u0438\u0432 <code>ELASTIC_APM_SEND_REDIS=true<\/code> \u0432 \u0432\u0430\u0448 .env \u0444\u0430\u0439\u043b.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/759\/608\/a9b\/759608a9bceefa5a4da74341e28b1905.png\" alt=\"\u0412\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 Redis-\u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432\" title=\"\u0412\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 Redis-\u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432\" width=\"1400\" height=\"99\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/759\/608\/a9b\/759608a9bceefa5a4da74341e28b1905.png\"\/><\/p>\n<div><figcaption>\u0412\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 Redis-\u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432<\/figcaption><\/div>\n<\/figure>\n<p>\u0410 \u0442\u0430\u043a\u0436\u0435 \u0432 \u0446\u0435\u043b\u044f\u0445 \u0441\u0430\u043c\u043e\u0440\u0430\u0437\u0432\u0438\u0442\u0438\u044f, \u0432\u043e\u0442 \u0432\u0430\u043c docker-compose.yml \u0444\u0430\u0439\u043b \u0434\u043b\u044f ES, Kibana \u0438 APM (<strong><em>\u041d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435 \u0432 \u043f\u0440\u043e\u0434\u0430\u043a\u0448\u0435\u043d\u0435!<\/em><\/strong>)<\/p>\n<pre><code class=\"php\">version: \"2\"  services:     php:         build:             dockerfile: php.dockerfile             context: .         volumes:             - .:\/app         ports:             - 8008:80         links:             - apm          elasticsearch:         image: bitnami\/elasticsearch:7.8.0         volumes:             - ~\/.backup\/elasticsearch\/elastic-apm:\/bitnami\/elasticsearch\/data             - .\/bitnami_es_config.yml:\/opt\/bitnami\/elasticsearch\/config\/elasticsearch.yml         ports:             - 60200:9200         environment:             - BITNAMI_DEBUG=true          kibana:         image: bitnami\/kibana:7.8.0         ports:             - 5601:5601         volumes:             - ~\/.backup\/kibana\/elastic-apm:\/bitnami         links:             - elasticsearch         environment:             - KIBANA_ELASTICSEARCH_URL=elasticsearch          apm:         image: docker.elastic.co\/apm\/apm-server-oss:7.8.0         ports:             - 8200:8200         user: apm-server         links:             - elasticsearch             - kibana         command: --strict.perms=false         environment:             - apm-server.host=0.0.0.0             - apm-server.kibana.enabled=true             - apm-server.kibana.host=\"http:\/\/kibana:5601\"             - output.elasticsearch.hosts=[\"elasticsearch:9200\"]             - output.elasticsearch.max_retries=1          apm2:         image: docker.elastic.co\/apm\/apm-server-oss:6.8.9         ports:             - 8201:8200         user: apm-server         links:             - elasticsearch             - kibana         command: --strict.perms=false         environment:             - apm-server.host=0.0.0.0             - apm-server.kibana.enabled=true             - apm-server.kibana.host=\"http:\/\/kibana:5601\"             - output.elasticsearch.hosts=[\"elasticsearch:9200\"]             - output.elasticsearch.max_retries=1 <\/code><\/pre>\n<p><em>docker-compose.yml<\/em><\/p>\n<hr\/>\n<p>\u041c\u0430\u0442\u0435\u0440\u0438\u0430\u043b \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043b\u0435\u043d \u0432 \u043f\u0440\u0435\u0434\u0434\u0432\u0435\u0440\u0438\u0438 \u0441\u0442\u0430\u0440\u0442\u0430 <a href=\"https:\/\/otus.pw\/9OvY\/\">\u043e\u043d\u043b\u0430\u0439\u043d-\u043a\u0443\u0440\u0441\u0430 &#171;PHP Developer. Professional&#187;.<\/a><\/p>\n<\/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\/730760\/\"> https:\/\/habr.com\/ru\/articles\/730760\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<figure class=\"full-width\">\n<div><figcaption>\u0418\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0441: <a href=\"https:\/\/www.elastic.co\/guide\/en\/apm\/get-started\/current\/images\/apm-architecture-cloud.png\"><u>https:\/\/www.elastic.co\/guide\/en\/apm\/get-started\/current\/images\/apm-architecture-cloud.png<\/u><\/a><\/figcaption><\/div>\n<\/figure>\n<p>APM \u0440\u0430\u0441\u0448\u0438\u0444\u0440\u043e\u0432\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043a\u0430\u043a Application Performance Monitoring (\u043c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u043d\u0433 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439). \u0415\u0441\u043b\u0438 \u043d\u0430 \u0432\u0430\u0448\u0435\u043c \u043f\u0443\u0442\u0438 \u0432\u0441\u0442\u0440\u0435\u0447\u0430\u0435\u0442\u0441\u044f \u044d\u0442\u0430 \u0430\u0431\u0431\u0440\u0435\u0432\u0438\u0430\u0442\u0443\u0440\u0430, \u0442\u043e \u0440\u0435\u0447\u044c \u0441\u043a\u043e\u0440\u0435\u0435 \u0432\u0441\u0435\u0433\u043e \u0438\u0434\u0435\u0442 \u043e \u0438\u0437\u043c\u0435\u0440\u0435\u043d\u0438\u0438 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0432\u0430\u0448\u0435\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0438 \u0432\u0430\u0448\u0438\u0445 \u0441\u0435\u0440\u0432\u0435\u0440\u043e\u0432. \u041a\u0430\u043a \u043e\u043d\u0438 \u0441\u043f\u0440\u0430\u0432\u043b\u044f\u044e\u0442\u0441\u044f, \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u0430\u043c\u044f\u0442\u0438 \u043e\u043d\u0438 \u043f\u043e\u0442\u0440\u0435\u0431\u043b\u044f\u044e\u0442, \u0433\u0434\u0435 \u0443\u0437\u043a\u0438\u0435 \u043c\u0435\u0441\u0442\u0430? \u0418 \u044d\u0442\u043e \u0434\u0430\u043b\u0435\u043a\u043e \u043d\u0435 \u0432\u0441\u0435. \u0421 \u043f\u043e\u043c\u043e\u0449\u044c\u044e APM \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0435 \u0443\u0432\u0435\u0434\u043e\u043c\u043b\u0435\u043d\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0431\u0443\u0434\u0443\u0442 \u043e\u043f\u043e\u0432\u0435\u0449\u0430\u0442\u044c \u0432\u0430\u0441, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043e \u0442\u043e\u043c, \u0447\u0442\u043e \u043f\u043e\u0442\u0440\u0435\u0431\u043b\u0435\u043d\u0438\u0435 \u043f\u0430\u043c\u044f\u0442\u0438 \u0434\u043e\u0441\u0442\u0438\u0433\u043b\u043e \u043e\u0447\u0435\u043d\u044c \u0432\u044b\u0441\u043e\u043a\u0438\u0445 \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u0435\u0439 \u0438\u043b\u0438 \u0443\u0434\u0430\u043b\u0435\u043d\u043d\u044b\u0439 \u0432\u044b\u0437\u043e\u0432 \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u0442 \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u043c\u043d\u043e\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438. \u0422\u0440\u0438\u0433\u0433\u0435\u0440\u044b \u0434\u043b\u044f \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0445 \u0443\u0432\u0435\u0434\u043e\u043c\u043b\u0435\u043d\u0438\u0439 \u043c\u043e\u0433\u0443\u0442 \u043e\u043f\u0438\u0440\u0430\u0442\u044c\u0441\u044f \u043d\u0430 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0448\u0438\u0440\u043e\u043a\u0438\u0439 \u043d\u0430\u0431\u043e\u0440 \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u0435\u0439 \u0438 \u0441\u043e\u0431\u044b\u0442\u0438\u0439. \u041d\u043e \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u043d\u0435 \u0431\u0443\u0434\u0435\u043c \u0437\u0430\u0431\u0435\u0433\u0430\u0442\u044c \u0432\u043f\u0435\u0440\u0435\u0434.<\/p>\n<h3>\u041d\u0435\u043c\u043d\u043e\u0433\u043e \u0438\u0441\u0442\u043e\u0440\u0438\u0438<\/h3>\n<p>\u041a\u043e\u0433\u0434\u0430 \u044f \u0435\u0449\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u043b \u0432 <a href=\"https:\/\/pathao.com\/?lang=en\"><u>Pathao<\/u><\/a>, \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0438 New Relic. New Relic \u043e\u0447\u0435\u043d\u044c \u0443\u0434\u043e\u0431\u0435\u043d. \u0427\u0442\u043e\u0431\u044b \u043d\u0430\u0447\u0430\u0442\u044c \u0441 \u043d\u0438\u043c \u0440\u0430\u0431\u043e\u0442\u0443 \u0432 PHP \u0432\u0430\u043c \u043f\u0440\u043e\u0441\u0442\u043e \u043d\u0443\u0436\u043d\u043e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0435\u0433\u043e \u043f\u0430\u043a\u0435\u0442 \u0438 \u0430\u0433\u0435\u043d\u0442. \u0418 \u043d\u0430 \u044d\u0442\u043e\u043c \u0432\u0441\u0435. \u0412\u044b \u0441\u0440\u0430\u0437\u0443 \u0436\u0435 \u0443\u0432\u0438\u0434\u0438\u0442\u0435 \u0432\u0441\u044e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u0443\u044e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043d\u0430 \u0434\u0430\u0448\u0431\u043e\u0440\u0434\u0435 New Relic, \u043a\u0430\u043a \u0442\u043e\u043b\u044c\u043a\u043e \u0441\u0435\u0440\u0432\u0435\u0440 \u043d\u0430\u0447\u043d\u0435\u0442 \u043e\u0431\u0441\u043b\u0443\u0436\u0438\u0432\u0430\u0442\u044c \u0437\u0430\u043f\u0440\u043e\u0441\u044b. \u041d\u043e \u043c\u043e\u044f \u043d\u044b\u043d\u0435\u0448\u043d\u044f\u044f \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u044f (<a href=\"https:\/\/dh.health\/\"><u>Digital Healthcare Solutions<\/u><\/a>, \u0440\u0430\u043d\u0435\u0435 \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u0430\u044f \u043a\u0430\u043a Telenor Health), \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0438\u043b\u0430 Elastic APM. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043c\u043d\u0435 \u043f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u0440\u0430\u0437\u0431\u0438\u0440\u0430\u0442\u044c\u0441\u044f, \u043a\u0430\u043a \u043e\u043d \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442. \u0414\u043e \u044d\u0442\u043e\u0433\u043e \u043c\u043e\u043c\u0435\u043d\u0442 \u044f \u0443\u0436\u0435 \u043a\u0430\u043a \u043c\u0438\u043d\u0438\u043c\u0443\u043c 4 \u0440\u0430\u0437\u0430 \u043f\u0440\u043e\u0431\u043e\u0432\u0430\u043b \u0437\u0430\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0441\u0435\u0431\u044f \u043e\u0441\u0432\u043e\u0438\u0442\u044c Elastic Search, \u043d\u043e \u0432\u0441\u0435 \u0431\u0435\u0437\u0443\u0441\u043f\u0435\u0448\u043d\u043e. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u044f \u0438\u0441\u043a\u0430\u043b \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0435 \u0433\u043e\u0442\u043e\u0432\u044b\u0435 \u043f\u0430\u043a\u0435\u0442\u044b. \u0418 \u044f \u043d\u0430\u0448\u0435\u043b \u043a\u043e\u0435-\u0447\u0442\u043e. \u042d\u0442\u043e \u0431\u044b\u043b \u043e\u0447\u0435\u043d\u044c \u0445\u043e\u0440\u043e\u0448\u0438\u0439 \u043f\u0430\u043a\u0435\u0442, \u043d\u043e \u043f\u043e\u0434 \u043a\u0430\u043f\u043e\u0442\u043e\u043c \u043e\u043d \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u043b <strong>HTTP-\u0437\u0430\u043f\u0440\u043e\u0441\u044b<\/strong> \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440 APM. \u0427\u0442\u043e \u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0437\u0430\u0442\u0440\u0430\u0442\u043d\u043e. \u0418 \u043e\u043d \u043d\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u043b APM Server 7.x.<\/p>\n<p><a href=\"https:\/\/github.com\/philkra\/elastic-apm-laravel\">github.com<\/a><\/p>\n<p>\u0412\u043e\u0442 \u043f\u043e\u0447\u0435\u043c\u0443 \u043c\u043d\u0435 \u043f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0441\u0432\u043e\u0439 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u043f\u0430\u043a\u0435\u0442 \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0441 \u043d\u0443\u043b\u044f. \u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u0441\u043e\u0431\u0438\u0440\u0430\u044e\u0441\u044c \u043f\u0440\u043e\u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432\u0430\u043c, \u043a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043c\u043e\u0439 \u043f\u0430\u043a\u0435\u0442 \u0441 \u0430\u0431\u0441\u043e\u043b\u044e\u0442\u043d\u043e \u043b\u044e\u0431\u044b\u043c PHP-\u043a\u043e\u0434\u043e\u043c. \u041f\u0430\u043a\u0435\u0442 \u0443\u0436\u0435 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441 Laravel \u0438\u043b\u0438 Lumen. \u041d\u043e \u0432\u0430\u043c \u043d\u0435 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0447\u0442\u043e-\u043b\u0438\u0431\u043e \u0438\u0437 \u044d\u0442\u043e\u0433\u043e. \u041f\u0440\u0435\u043b\u0435\u0441\u0442\u044c \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0435\u0433\u043e \u043a\u0430\u043a \u0437\u0430\u0445\u043e\u0442\u0438\u0442\u0435.<\/p>\n<h3>\u0427\u0442\u043e \u0442\u0430\u043a\u043e\u0435 Elastic APM?<\/h3>\n<p>\u041e\u0431\u0440\u0430\u0442\u0438\u043b\u0438 \u043b\u0438 \u0432\u044b \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0432\u043d\u0430\u0447\u0430\u043b\u0435 \u0441\u0442\u0430\u0442\u044c\u0438? \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043d\u0435\u043d\u0430\u0434\u043e\u043b\u0433\u043e \u0432\u0435\u0440\u043d\u0435\u043c\u0441\u044f \u043a \u043d\u0435\u043c\u0443. \u041d\u0430 \u044d\u0442\u043e\u043c \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0438 \u043e\u0442\u0440\u0430\u0436\u0435\u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u043d\u0430\u044f \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u044d\u0442\u043e \u0432\u0441\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442. \u0412\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c APM-\u0430\u0433\u0435\u043d\u0442 \u0434\u043b\u044f \u0432\u0430\u0448\u0435\u0433\u043e \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0433\u043e \u044f\u0437\u044b\u043a\u0430 (APM-\u0430\u0433\u0435\u043d\u0442\u044b \u0434\u043e \u0441\u0438\u0445 \u043f\u043e\u0440 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u044e\u0442 \u043d\u0435 \u0432\u0441\u0435 \u044f\u0437\u044b\u043a\u0438, \u0442\u0430\u043a \u0447\u0442\u043e \u0438\u043c\u0435\u0439\u0442\u0435 \u044d\u0442\u043e \u0432\u0432\u0438\u0434\u0443). \u042d\u0442\u043e\u0442 \u0430\u0433\u0435\u043d\u0442 \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0431\u0438\u0440\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0438 \u0432\u0430\u0448\u0435\u0433\u043e \u043a\u043e\u0434\u0430. \u0417\u0430\u0442\u0435\u043c \u043e\u043d \u0431\u0443\u0434\u0435\u0442 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0438\u0445 \u043d\u0430 APM-\u0441\u0435\u0440\u0432\u0435\u0440. \u0414\u0430\u043b\u0435\u0435 \u0441\u0435\u0440\u0432\u0435\u0440\u044b APM \u043f\u0435\u0440\u0435\u0434\u0430\u044e\u0442 \u044d\u0442\u0438 \u0434\u0430\u043d\u043d\u044b\u0435 \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440 Elasticsearch, \u0438 \u0432\u044b \u0441\u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u0440\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u044d\u0442\u0438 \u0434\u0430\u043d\u043d\u044b\u0435 \u0432 Kibana. \u0421\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u043d\u0438\u0447\u0435\u0433\u043e \u0441\u0432\u0435\u0440\u0445\u044a\u0435\u0441\u0442\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0433\u043e. \u041d\u043e \u044f \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u043b, \u0447\u0442\u043e APM Dashboard UI \u043f\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441 XPack, \u0430 \u044d\u0442\u043e \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442, \u0447\u0442\u043e \u0432\u0430\u043c \u043f\u0440\u0438\u0434\u0435\u0442\u0441\u044f \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0440\u0430\u0441\u043a\u043e\u0448\u0435\u043b\u0438\u0442\u044c\u0441\u044f.<\/p>\n<h3>\u0418\u043d\u0441\u0442\u0430\u043b\u043b\u044f\u0446\u0438\u044f<\/h3>\n<p>Elastic \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 APM-\u0430\u0433\u0435\u043d\u0442\u0430 \u0434\u043b\u044f PHP. \u042d\u0442\u043e\u0442 \u0430\u0433\u0435\u043d\u0442 \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0431\u0438\u0440\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0441 \u043d\u0430\u0448\u0435\u0433\u043e \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c \u0438\u0445 \u043d\u0430 APM-\u0441\u0435\u0440\u0432\u0435\u0440. \u0421\u0432\u043e\u0435 PHP-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u044f \u0440\u0430\u0437\u043c\u0435\u0441\u0442\u0438\u043b \u0432 \u0434\u043e\u043a\u0435\u0440-\u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0435. \u0414\u043e\u043a\u0435\u0440-\u0444\u0430\u0439\u043b \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<pre><code class=\"php\">FROM php:7.4-fpm  RUN apt-get update  RUN apt-get install -y libpq-dev libpng-dev curl nano unzip zip git jq supervisor  RUN docker-php-ext-install pdo_pgsql  RUN pecl install -o -f redis  RUN docker-php-ext-enable redis  RUN curl -sS https:\/\/getcomposer.org\/installer | php -- --install-dir=\/usr\/local\/bin --filename=composer  RUN apt-get -y update &amp;&amp; apt-get -y install build-essential autoconf libcurl4-openssl-dev --no-install-recommends RUN mkdir -p \/home\/apm-agent &amp;&amp; \\     cd \/home\/apm-agent &amp;&amp; \\     git clone https:\/\/github.com\/elastic\/apm-agent-php.git apm &amp;&amp; \\     cd apm\/src\/ext &amp;&amp; \\     \/usr\/local\/bin\/phpize &amp;&amp; .\/configure --enable-elastic_apm &amp;&amp; \\     make clean &amp;&amp; make &amp;&amp; make install COPY .\/elastic_apm.ini \/usr\/local\/etc\/php\/conf.d\/elastic_apm.ini RUN mkdir \/app WORKDIR \/app   CMD [\"php\", \"-S\", \"0.0.0.0:80\", \"index.php\"]<\/code><\/pre>\n<p><em>\u0414\u043e\u043a\u0435\u0440-\u0444\u0430\u0439\u043b \u0434\u043b\u044f PHP-\u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0430. \u0418\u0433\u043d\u043e\u0440\u0438\u0440\u0443\u0439\u0442\u0435 \u0440\u0430\u0437\u0434\u0435\u043b CMD.<\/em><\/p>\n<p>\u0412 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u043d\u043e\u043c \u0432\u044b\u0448\u0435 \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442\u0435 \u0432\u0430\u043c \u0441\u0442\u043e\u0438\u0442 \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u044c \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430\u00a0 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0432 <em>\u0441\u0442\u0440\u043e\u043a\u0435 16<\/em>. \u041c\u044b \u043a\u043b\u043e\u043d\u0438\u0440\u0443\u0435\u043c git-\u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439 APM, \u0430 \u0437\u0430\u0442\u0435\u043c \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u043c \u0435\u0433\u043e \u0438 \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u0432 \u043d\u0430\u0448 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440.<\/p>\n<p>\u0412 <em>\u0441\u0442\u0440\u043e\u043a\u0435 22<\/em> \u043c\u044b \u043a\u043e\u043f\u0438\u0440\u0443\u0435\u043c <code>.ini<\/code> \u0444\u0430\u0439\u043b. \u0412\u043e\u0442 \u044d\u0442\u043e\u0442 <code>.ini<\/code> \u0444\u0430\u0439\u043b:<\/p>\n<pre><code class=\"php\">extension=elastic_apm.so elastic_apm.bootstrap_php_part_file=\/home\/apm-agent\/apm\/src\/bootstrap_php_part.php elastic_apm.enabled=true elastic_apm.server_url=\"http:\/\/docker.for.mac.localhost:8200\" ; elastic_apm.secret_token= elastic_apm.service_name=\"PHP APM Test Service\" ; service_version= ${git rev-parse HEAD} elastic_apm.log_level=DEBUG ; Available Log levels ; OFF | CRITICAL | ERROR | WARNING | NOTICE | INFO | DEBUG | TRACE<\/code><\/pre>\n<p><em>elastic_apm.ini file<\/em><\/p>\n<p>\u0412 \u0444\u0430\u0439\u043b\u0435 <code>elastic_apm.ini<\/code> <em>\u0441\u0442\u0440\u043e\u043a\u0430 2<\/em> \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u043f\u0443\u0442\u044c \u043a \u043d\u0430\u0448\u0435\u043c\u0443 \u0444\u0430\u0439\u043b\u0443 \u043a\u043b\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0433\u043e git-\u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u044f \u2013 <code>src\/bootstrap_php_part.php<\/code>. <em>\u0421\u0442\u0440\u043e\u043a\u0430 4<\/em> \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 URL <strong>APM-\u0441\u0435\u0440\u0432\u0435\u0440\u0430<\/strong>. \u0415\u0441\u043b\u0438 \u0432\u044b \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0435 \u0434\u043e\u043a\u0435\u0440, \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0441\u0434\u0435\u043b\u0430\u0442\u044c <em>git clone<\/em> \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u044f, \u0430 \u0437\u0430\u0442\u0435\u043c \u043f\u0440\u043e\u0441\u0442\u043e \u0438\u043d\u0441\u0442\u0430\u043b\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0435\u0433\u043e. \u0414\u0430\u043b\u044c\u0448\u0435 \u043c\u044b \u0438\u043d\u0442\u0435\u0433\u0440\u0438\u0440\u0443\u0435\u043c \u0441 php \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0435. \u042d\u0442\u043e \u0432\u0441\u0435, \u0447\u0442\u043e \u043a\u0430\u0441\u0430\u0435\u0442\u0441\u044f \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 APM-\u0430\u0433\u0435\u043d\u0442\u0430.<\/p>\n<p>\u041f\u0440\u0435\u0436\u0434\u0435 \u0447\u0435\u043c \u043c\u044b \u0443\u0433\u043b\u0443\u0431\u0438\u043c\u0441\u044f \u0432 \u0441\u0430\u043c \u043f\u0430\u043a\u0435\u0442, \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0441\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u043e\u0431 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0445 \u043f\u043e\u043d\u044f\u0442\u0438\u044f\u0445 \u0438\u0437 <a href=\"https:\/\/github.com\/elastic\/apm-agent-php\/blob\/master\/docs\/public-api.asciidoc\"><u>\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u043f\u043e \u0430\u0433\u0435\u043d\u0442\u0443<\/u><\/a>.<\/p>\n<p>\u041f\u043e \u0441\u0443\u0442\u0438 \u0432\u0441\u0435 \u0441\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u0432\u0441\u0435\u0433\u043e \u043a \u0434\u0432\u0443\u043c:<\/p>\n<ul>\n<li>\n<p><strong>\u0422\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u044f:<\/strong> \u041a\u043e\u0433\u0434\u0430 \u0432\u0430\u0448\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442, \u043e\u043d\u043e \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0438. \u041a\u0430\u0436\u0434\u044b\u0439 \u0437\u0430\u043f\u0440\u043e\u0441 \u0441\u0447\u0438\u0442\u0430\u0435\u0442\u0441\u044f \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0435\u0439. \u041a\u0430\u0436\u0434\u0430\u044f \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u044f \u0438\u043c\u0435\u0435\u0442 \u0438\u043c\u044f \u0438 \u0442\u0438\u043f.<\/p>\n<\/li>\n<\/ul>\n<ul>\n<li>\n<p><strong>\u0421\u043f\u0430\u043d:<\/strong> \u041a\u043e\u0433\u0434\u0430 \u0432\u044b \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0435 \u043a\u0430\u043a\u043e\u0439-\u043d\u0438\u0443\u0431\u0434\u044c \u043a\u043e\u0434, \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f, \u0441 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0432\u044b \u0438\u043c\u0435\u0435\u0442\u0435 \u0434\u0435\u043b\u043e, \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0430 \u200b\u200b\u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440 \u0432 \u0432\u0438\u0434\u0435 \u0441\u043f\u0430\u043d\u0430. \u0421\u043f\u0430\u043d (span) \u2014 \u044d\u0442\u043e \u0437\u0430\u043f\u0438\u0441\u044c \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438, \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u043c\u0430\u044f \u043e\u0434\u043d\u0438\u043c \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442\u043e\u043c \u043a\u043e\u0434\u0430. \u0417\u0430\u043f\u0440\u043e\u0441 \u043a \u0431\u0430\u0437\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0441\u043f\u0430\u043d\u043e\u043c, \u0442\u043e\u0447\u043d\u043e \u0442\u0430\u043a \u0436\u0435 \u043a\u0430\u043a \u0438 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f HTTP-\u0437\u0430\u043f\u0440\u043e\u0441\u0430.<\/p>\n<\/li>\n<\/ul>\n<h3>\u0421\u0430\u043c \u043f\u0430\u043a\u0435\u0442 \u0438 \u0440\u0430\u0431\u043e\u0442\u0430 \u0441 \u043d\u0438\u043c<\/h3>\n<p><a href=\"https:\/\/github.com\/ssi-anik\/elastic-apm-php\">github.com<\/a><\/p>\n<p>\u0418\u0442\u0430\u043a, \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0440\u0430\u0437\u0431\u0435\u0440\u0435\u043c\u0441\u044f, \u043a\u0430\u043a \u0438\u043d\u0442\u0435\u0433\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u0430\u043a\u0435\u0442 \u0441 PHP. \u0417\u0430\u0442\u0435\u043c \u043c\u044b \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u043a\u0430\u043a \u043e\u043d \u0438\u043d\u0442\u0435\u0433\u0440\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0441 Laravel\/Lumen. \u0421\u0430\u043c \u0430\u0433\u0435\u043d\u0442 \u0442\u0440\u0435\u0431\u0443\u0435\u0442 PHP \u0432\u0435\u0440\u0441\u0438\u0438 \u2265 7.2, \u0432\u043e\u0442 \u043f\u043e\u0447\u0435\u043c\u0443 \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0435 \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u0435 \u0434\u043b\u044f \u043f\u0430\u043a\u0435\u0442\u0430 \u2013 PHP 7.2.<\/p>\n<h3>\u0418\u043d\u0441\u0442\u0430\u043b\u043b\u044f\u0446\u0438\u044f<\/h3>\n<pre><code>composer require anik\/elastic-apm-php<\/code><\/pre>\n<h3>\u0418\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u044f \u0441 PHP<\/h3>\n<ul>\n<li>\n<p>\u041a\u043b\u0430\u0441\u0441 <code>Anik\\ElasticApm\\Agent<\/code> \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u0443\u0431\u043b\u0438\u0447\u043d\u043e\u0439 \u0442\u043e\u0447\u043a\u043e\u0439 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u0434\u043b\u044f \u0432\u0441\u0435\u0445 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439. \u041a\u043b\u0430\u0441\u0441 Agent \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0438\u043d\u0441\u0442\u0430\u043d\u0446\u0438\u0440\u043e\u0432\u0430\u043d \u2013 \u043e\u043d \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043e\u0431\u043e\u0439 \u0441\u0438\u043d\u0433\u043b\u0442\u043e\u043d. \u0422\u043e \u0435\u0441\u0442\u044c, \u0432\u0441\u044f\u043a\u0438\u0439 \u0440\u0430\u0437, \u043a\u043e\u0433\u0434\u0430 \u0432\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u043a\u0430\u043a-\u043b\u0438\u0431\u043e \u0441 \u043d\u0438\u043c \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c, \u0432\u044b \u0431\u0443\u0434\u0435\u0442\u0435 \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c <code>Agent::instance()<\/code>. \u0412\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0435 \u043e\u0434\u0438\u043d \u0438 \u0442\u043e\u0442 \u0436\u0435 \u043e\u0431\u044a\u0435\u043a\u0442, \u043e\u0442\u043a\u0443\u0434\u0430 \u0431\u044b \u0432\u044b \u0435\u0433\u043e \u043d\u0435 \u0432\u044b\u0437\u044b\u0432\u0430\u043b\u0438, \u043d\u0430 \u043f\u0440\u043e\u0442\u044f\u0436\u0435\u043d\u0438\u0438 \u0432\u0441\u0435\u0433\u043e \u0436\u0438\u0437\u043d\u0435\u043d\u043d\u043e\u0433\u043e \u0446\u0438\u043a\u043b\u0430 \u0437\u0430\u043f\u0440\u043e\u0441\u0430.<\/p>\n<\/li>\n<\/ul>\n<ul>\n<li>\n<p>\u0427\u0442\u043e\u0431\u044b \u0437\u0430\u0434\u0430\u0442\u044c \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0438 <strong>\u0438\u043c\u044f<\/strong> \u0438 <strong>\u0442\u0438\u043f<\/strong> \u0432\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u0438\u043d\u0441\u0442\u0430\u043d\u0446\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043e\u0431\u044a\u0435\u043a\u0442 <code>Anik\\ElasticApm\\Transaction<\/code> \u0441 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c\u0438 <em>name<\/em> \u0438 <em>type<\/em>. \u041f\u043e\u0441\u043b\u0435 \u0443\u0441\u043f\u0435\u0448\u043d\u043e\u0433\u043e \u0438\u043d\u0441\u0442\u0430\u043d\u0446\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u0432\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u0435\u0433\u043e \u0432 \u043a\u043b\u0430\u0441\u0441 <code>Agent<\/code> \u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u043e\u043c \u0435\u0433\u043e \u043c\u0435\u0442\u043e\u0434\u0430 <code>setTransaction<\/code>.<\/p>\n<\/li>\n<\/ul>\n<pre><code>Agent::instance()->setTransaction(new Transaction('name', 'type'));<\/code><\/pre>\n<ul>\n<li>\n<p>\u0415\u0441\u043b\u0438 \u0432\u044b \u0445\u043e\u0442\u0438\u0442\u0435 \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u044d\u0442\u043e\u0439 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0438 \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440, \u0432\u0430\u043c \u043f\u0440\u0438\u0434\u0435\u0442\u0441\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u043f\u0430\u043d. \u0427\u0442\u043e\u0431\u044b \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043d\u043e\u0432\u044b\u0439 \u0441\u043f\u0430\u043d, \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 <code>Anik\\ElasticApm\\Contracts\\SpanContract<\/code>, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u0442\u0430\u043a\u0438\u0435 \u043c\u0435\u0442\u043e\u0434\u044b, \u043a\u0430\u043a <code>getSpanData()<\/code>, <code>getName()<\/code>, <code>getType()<\/code>, <code>getSubType()<\/code>. \u041d\u043e \u0435\u0441\u043b\u0438 \u0432\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0435 \u0442\u0440\u0435\u0439\u0442 <code>Anik\\ElasticApm\\Spans\\SpanEmptyFieldsTrait<\/code>, \u0442\u043e\u0433\u0434\u0430 \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043e\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u043c\u0435\u0442\u043e\u0434\u044b <code>getAction()<\/code> \u0438 <code>getLabels()<\/code>. \u0415\u0441\u043b\u0438 \u0436\u0435 \u0432\u044b \u0445\u043e\u0442\u0438\u0442\u0435 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u043d\u0430 \u0441\u0432\u043e\u0439 APM-\u0441\u0435\u0440\u0432\u0435\u0440, \u0442\u043e \u0432\u0430\u043c \u043d\u0435 \u043f\u043e\u043c\u0435\u0448\u0430\u043b\u043e \u0431\u044b \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u044d\u0442\u0438 \u043c\u0435\u0442\u043e\u0434\u044b. \u042f \u043d\u0435 \u0431\u0443\u0434\u0443 \u0437\u0434\u0435\u0441\u044c \u043e\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0442\u044c\u0441\u044f \u043d\u0430 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u044b\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f\u0445 \u043c\u0435\u0442\u043e\u0434\u043e\u0432, \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043d\u0430\u0439\u0442\u0438 \u044d\u0442\u0443 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u0432 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u043f\u043e \u0430\u0433\u0435\u043d\u0442\u0443 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u043d\u043e\u0439 \u0432\u044b\u0448\u0435.<\/p>\n<\/li>\n<\/ul>\n<ul>\n<li>\n<p>\u041a\u043e\u0433\u0434\u0430 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043a\u043b\u0430\u0441\u0441\u0430 <strong>Span<\/strong> \u0431\u0443\u0434\u0435\u0442 \u0433\u043e\u0442\u043e\u0432\u0430, \u0432\u044b \u0441\u043c\u043e\u0436\u0435\u0442\u0435 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c \u0441\u043f\u0430\u043d \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<\/li>\n<\/ul>\n<pre><code>Agent::instance()->addSpan(\" class=\"formula inline\">implementedSpanObject);<\/code><\/pre>\n<ul>\n<li>\n<p>\u041d\u0430\u043a\u043e\u043d\u0435\u0446, \u043a\u043e\u0433\u0434\u0430 \u0432\u044b \u0437\u0430\u043a\u043e\u043d\u0447\u0438\u0442\u0435 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c \u0441\u043f\u0430\u043d\u044b, \u0442\u043e, \u043f\u0440\u0435\u0436\u0434\u0435 \u0447\u0435\u043c \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0442\u044c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442, \u0432\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u0432\u0441\u0435 \u044d\u0442\u0438 <em>\u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0438 <\/em>\u0438 <em>\u0441\u043f\u0430\u043d\u044b<\/em> \u0432 APM-\u0430\u0433\u0435\u043d\u0442. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435<\/p>\n<\/li>\n<\/ul>\n<pre><code>Agent::instance()->capture();<\/code><\/pre>\n<p>\u041f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u043d\u044b\u0439 \u0432\u044b\u0448\u0435 \u043c\u0435\u0442\u043e\u0434 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442 \u0432\u0441\u0435 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0438 \u0438 \u0441\u043f\u0430\u043d\u044b, \u0430 \u0437\u0430\u0442\u0435\u043c \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u0442 \u0438\u0445 \u0430\u0433\u0435\u043d\u0442\u0443, \u043f\u043e\u0441\u043b\u0435 \u0447\u0435\u0433\u043e \u0430\u0433\u0435\u043d\u0442 \u0431\u0435\u0440\u0435\u0442 \u043d\u0430 \u0441\u0435\u0431\u044f \u0437\u0430\u0431\u043e\u0442\u0443 \u043e\u0431 \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0435 \u0438\u0445 \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440.<\/p>\n<p><strong>\u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u0435<\/strong>: \u0415\u0441\u043b\u0438 \u0432\u044b \u0445\u043e\u0442\u0438\u0442\u0435 \u0434\u0435\u043b\u0430\u0442\u044c \u0432\u0441\u0435 \u0441\u0430\u043c\u043e\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e, \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <code>Agent::getElasticApmTransaction()<\/code>, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0442\u0435\u043a\u0443\u0449\u0443\u044e \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u044e \u0430\u0433\u0435\u043d\u0442\u0430, \u0438\u043b\u0438 <code>Agent::newApmTransaction($name, $type)<\/code>, \u0447\u0442\u043e\u0431\u044b \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043d\u043e\u0432\u0443\u044e \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u044e. \u041e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0432\u044b\u0437\u044b\u0432\u0430\u0439\u0442\u0435 \u043c\u0435\u0442\u043e\u0434 <code>end()<\/code>, \u0435\u0441\u043b\u0438 \u0432\u044b \u0441\u043e\u0437\u0434\u0430\u043b\u0438 \u043d\u043e\u0432\u044b\u0439 \u043e\u0431\u044a\u0435\u043a\u0442 <code>Transaction<\/code>. \u0418\u043b\u0438, \u0435\u0441\u043b\u0438 \u0432\u044b \u0445\u043e\u0442\u0438\u0442\u0435 \u043f\u043e\u043c\u0435\u0441\u0442\u0438\u0442\u044c \u0441\u043f\u0430\u043d\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u044b \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442\u0435, \u0432 \u043d\u043e\u0432\u0443\u044e \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u044e, \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043c\u0435\u0442\u043e\u0434 <code>Agent::captureOnNew()<\/code>, \u0447\u0442\u043e\u0431\u044b \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u0438\u0445 \u0441 \u043d\u043e\u0432\u043e\u0439 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0435\u0439. \u0412\u0430\u043c \u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c <code>end<\/code>, \u043a\u043e\u0433\u0434\u0430 \u0432\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0435 <code>captureOnNew<\/code>. \u0415\u0441\u043b\u0438 \u0432\u0430\u043c \u0432\u0434\u0440\u0443\u0433 \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u044c\u0441\u044f \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0441\u0432\u0435\u0436\u0438\u0439 \u0438\u043d\u0441\u0442\u0430\u043d\u0441 <code>Agent<\/code>, \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u0432\u044b\u0437\u0432\u0430\u0442\u044c <code>Agent::reset()<\/code>, \u0430 \u043f\u043e\u0442\u043e\u043c <code>Agent::instance()<\/code>, \u043d\u043e <code>Agent::reinstance()<\/code> \u0431\u0443\u0434\u0435\u0442 \u0434\u0435\u043b\u0430\u0442\u044c \u0442\u043e \u0436\u0435 \u0441\u0430\u043c\u043e\u0435. \u041d\u0430\u043a\u043e\u043d\u0435\u0446, \u0438\u043c\u0435\u0439\u0442\u0435 \u0432 \u0432\u0438\u0434\u0443, \u0447\u0442\u043e \u0435\u0441\u043b\u0438 \u0432\u044b \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0435 \u043b\u044e\u0431\u043e\u0439 \u0438\u0437 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 <code>capture*()<\/code>, \u0442\u043e \u0441 \u043d\u0438\u043c \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d \u043e\u0431\u044a\u0435\u043a\u0442 <code>Transaction<\/code>. \u0411\u0435\u0437 \u043e\u0431\u044a\u0435\u043a\u0442\u0430 Transaction \u0432\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0435 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 <code>Anik\\ElasticApm\\Exceptions\\RequirementMissingException<\/code>.<\/p>\n<p>\u041d\u0430 \u044d\u0442\u043e\u043c \u043c\u044b \u0437\u0430\u043a\u043e\u043d\u0447\u0438\u043b\u0438 \u0441 \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u0435\u0439 \u0441 PHP.<\/p>\n<h3>\u0418\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u044f \u0441 Laravel\/Lumen<\/h3>\n<p>\u0414\u043b\u044f <strong>Laravel:<\/strong><\/p>\n<ul>\n<li>\n<p>\u041f\u0430\u043a\u0435\u0442 \u0443\u0436\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0438\u044f \u043f\u0430\u043a\u0435\u0442\u043e\u0432. \u041d\u043e \u0432\u0441\u0435 \u0436\u0435 \u0434\u043e\u0431\u0430\u0432\u044c\u0442\u0435 <code>Anik\\ElasticApm\\Providers\\ElasticApmServiceProvider::class<\/code><em> <\/em>\u0432 \u043c\u0430\u0441\u0441\u0438\u0432 <code>providers<\/code> \u0432\u0430\u0448\u0435\u0433\u043e <code>config\/app.php.<\/code><\/p>\n<\/li>\n<\/ul>\n<ul>\n<li>\n<p>\u0414\u043e\u0431\u0430\u0432\u044c\u0442\u0435 <code>Anik\\ElasticApm\\Facades\\Agent::class<\/code> \u0432 \u043c\u0430\u0441\u0441\u0438\u0432 <code>facade<\/code> \u0432\u0430\u0448\u0435\u0433\u043e <code>config\/app.php<\/code>.<\/p>\n<\/li>\n<\/ul>\n<ul>\n<li>\n<p>\u0417\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u0435 <code>php artisan vendor:publish<\/code>, \u0447\u0442\u043e\u0431\u044b \u043e\u043f\u0443\u0431\u043b\u0438\u043a\u043e\u0432\u0430\u0442\u044c \u0444\u0430\u0439\u043b \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438.<\/p>\n<\/li>\n<\/ul>\n<p>\u0414\u043b\u044f <strong>Lumen:<\/strong><\/p>\n<ul>\n<li>\n<p>\u0412\u0430\u043c \u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u0432\u043e\u0437\u0438\u0442\u044c\u0441\u044f \u0441 <strong>Facade<\/strong>, \u0447\u0442\u043e\u0431\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u044d\u0442\u043e\u0442 \u043f\u0430\u043a\u0435\u0442.<\/p>\n<\/li>\n<\/ul>\n<ul>\n<li>\n<p>\u0421\u043a\u043e\u043f\u0438\u0440\u0443\u0439\u0442\u0435 <code>elastic-apm.php<\/code> \u0438\u0437 \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0430 <code>src\/config<\/code> \u043f\u0430\u043a\u0435\u0442\u0430 \u0432 \u043a\u0430\u0442\u0430\u043b\u043e\u0433 <em>config <\/em>\u0432\u0430\u0448\u0435\u0433\u043e lumen-\u043f\u0440\u043e\u0435\u043a\u0442\u0430.<\/p>\n<\/li>\n<\/ul>\n<pre><code class=\"php\">\/\/ \u0432 \u0432\u0430\u0448 \u0444\u0430\u0439\u043b bootstrap\/app.php. use Anik\\ElasticApm\\Providers\\ElasticApmServiceProvider; $app->register(ElasticApmServiceProvider::class); $app->configure('elastic-apm');<\/code><\/pre>\n<p>\u0412\u044b \u0442\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u0435\u0442\u0435 \u0441\u043c\u0435\u043b\u043e \u0438\u0437\u043c\u0435\u043d\u044f\u0442\u044c \u0444\u0430\u0439\u043b \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 \u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0438 \u0441 \u0432\u0430\u0448\u0438\u043c\u0438 \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u044f\u043c\u0438.<\/p>\n<h3>\u041e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u043d\u0438\u0435 \u043e\u0448\u0438\u0431\u043e\u043a \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439<\/h3>\n<p>\u0415\u0441\u043b\u0438 \u0432\u044b \u0445\u043e\u0442\u0438\u0442\u0435 \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u043e\u0431 \u043e\u0448\u0438\u0431\u043a\u0435 \u043d\u0430 \u0432\u0430\u0448 APM-\u0441\u0435\u0440\u0432\u0435\u0440, \u0442\u043e<\/p>\n<ul>\n<li>\n<p>\u0414\u043b\u044f Laravel, \u0432 <code>bootstrap\/app.php<\/code><\/p>\n<\/li>\n<\/ul>\n<pre><code class=\"php\">\/\/ \u042d\u0422\u041e\u0422 \u0420\u0410\u0417\u0414\u0415\u041b \u0421\u041b\u0415\u0414\u0423\u0415\u0422 \u0417\u0410\u041a\u041e\u041c\u041c\u0415\u041d\u0422\u0418\u0420\u041e\u0412\u0410\u0422\u042c \/**  *  $app->singleton(  *      Illuminate\\Contracts\\Debug\\ExceptionHandler::class,  *      App\\Exceptions\\Handler::class  *  );  *\/ \/\/ \u0418\u0421\u041f\u041e\u041b\u042c\u0417\u0423\u0419\u0422\u0415 \u042d\u0422\u041e\u0422 \u0420\u0410\u0417\u0414\u0415\u041b use Illuminate\\Contracts\\Debug\\ExceptionHandler; use Anik\\ElasticApm\\Exceptions\\Handler; use App\\Exceptions\\Handler as AppExceptionHandler; use Symfony\\Component\\HttpKernel\\Exception\\NotFoundHttpException; use GuzzleHttp\\Exception\\ConnectException;<\/code><\/pre>\n<\/div>\n<\/div>\n<\/div>\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-399075","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/399075","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=399075"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/399075\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=399075"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=399075"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=399075"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}