{"id":31014,"date":"2019-10-31T21:38:54","date_gmt":"2019-10-31T18:38:54","guid":{"rendered":"https:\/\/prohoster.info\/blog\/trassirovka-servisov-opentracing-i-jaeger\/"},"modified":"2019-10-31T21:38:54","modified_gmt":"2019-10-31T18:38:54","slug":"trassirovka-servisov-opentracing-i-jaeger","status":"publish","type":"post","link":"https:\/\/prohoster.info\/hu\/blog\/administrirovanie\/trassirovka-servisov-opentracing-i-jaeger","title":{"rendered":"Szolg\u00e1ltat\u00e1sok nyomk\u00f6vet\u00e9se, OpenTracing \u00e9s Jaeger","gt_translate_keys":[{"key":"rendered","format":"text"}]},"content":{"rendered":"<p><img decoding=\"async\" alt=\"Szolg\u00e1ltat\u00e1sok nyomk\u00f6vet\u00e9se, OpenTracing \u00e9s Jaeger\" src=\"\/wp-content\/uploads\/2019\/04\/045800f00c8da9702f62cf3de53df7b6.png\" style=\"display:block;margin: 0 auto;\" \/><br \/>\n<br \/>\nProjektjeinkben mikroszolg\u00e1ltat\u00e1s-architekt\u00far\u00e1t haszn\u00e1lunk. Teljes\u00edtm\u00e9ny sz\u0171k keresztmetszeteinek felmer\u00fcl\u00e9sekor sok id\u0151t t\u00f6lt\u00fcnk a napl\u00f3z\u00e1s monitoroz\u00e1s\u00e1val \u00e9s elemez\u00e9s\u00e9vel. Amikor egyes m\u0171veletek id\u0151z\u00edt\u00e9seit napl\u00f3f\u00e1jlba \u00edrjuk, \u00e1ltal\u00e1ban neh\u00e9z meg\u00e9rteni, hogy mi okozta ezen m\u0171veletek megh\u00edv\u00e1s\u00e1t, nyomon k\u00f6vetni a l\u00e9p\u00e9sek sorrendj\u00e9t, vagy az egyik m\u0171velet id\u0151z\u00edt\u00e9si elt\u00e9r\u00e9s\u00e9t a m\u00e1sikkal szemben k\u00fcl\u00f6nb\u00f6z\u0151 szolg\u00e1ltat\u00e1sokban. <\/p>\n<p>A manu\u00e1lis munka minimaliz\u00e1l\u00e1sa \u00e9rdek\u00e9ben \u00fagy d\u00f6nt\u00f6tt\u00fcnk, hogy ig\u00e9nybe vesz\u00fcnk egy nyomk\u00f6vet\u00e9si eszk\u00f6zt. Ebben a cikkben arr\u00f3l lesz sz\u00f3, hogy hogyan \u00e9s mire haszn\u00e1lhat\u00f3 a nyomk\u00f6vet\u00e9s, valamint hogyan hajtottuk v\u00e9gre ezt. <br \/>\n<noindex><a rel=\"nofollow\" name=\"habracut\"><\/a><\/noindex><\/p>\n<h3>Milyen probl\u00e9m\u00e1kat lehet megoldani a nyomk\u00f6vet\u00e9s seg\u00edt\u00e9s\u00e9g\u00e9vel<\/h3>\n<p><\/p>\n<ol>\n<li>Aj\u00e1nlott megtal\u00e1lni a teljes\u00edtm\u00e9ny sz\u0171k keresztmetszeteit, ak\u00e1r egyetlen szolg\u00e1ltat\u00e1son bel\u00fcl, ak\u00e1r az \u00f6sszes r\u00e9sztvev\u0151 szolg\u00e1ltat\u00e1s k\u00f6z\u00f6tti v\u00e9grehajt\u00e1si f\u00e1ban. P\u00e9ld\u00e1ul:\n<ul>\n<li>Sok r\u00f6vid egym\u00e1s ut\u00e1ni h\u00edv\u00e1s a szolg\u00e1ltat\u00e1sok k\u00f6z\u00f6tt, p\u00e9ld\u00e1ul geok\u00f3dol\u00e1s vagy adatb\u00e1zis h\u00edv\u00e1sa.<\/li>\n<li>Hossz\u00fa v\u00e1rakoz\u00e1sok a bemenet-kiad\u00e1s ter\u00e9n, p\u00e9ld\u00e1ul adatok tov\u00e1bb\u00edt\u00e1sa a h\u00e1l\u00f3zaton vagy olvas\u00e1s lemezr\u0151l.<\/li>\n<li>Hosszan tart\u00f3 adatok parszol\u00e1sa.<\/li>\n<li>Hossz\u00fa m\u0171veletek, amelyek CPU-t ig\u00e9nyelnek.<\/li>\n<li>Olyan k\u00f3dblokkok, amelyek nem sz\u00fcks\u00e9gesek a v\u00e9gs\u0151 eredm\u00e9ny megszerz\u00e9s\u00e9hez, \u00e9s elt\u00e1vol\u00edthat\u00f3k, vagy elhalaszthat\u00f3k.<\/li>\n<\/ul>\n<\/li>\n<li>Vizu\u00e1lisan \u00e9rthet\u0151v\u00e9 v\u00e1lik, hogy milyen sorrendben t\u00f6rt\u00e9nnek a megh\u00edv\u00e1sok \u00e9s mi t\u00f6rt\u00e9nik, amikor egy m\u0171veletet v\u00e9grehajtanak.<br \/>\n<img decoding=\"async\" alt=\"Szolg\u00e1ltat\u00e1sok nyomk\u00f6vet\u00e9se, OpenTracing \u00e9s Jaeger\" src=\"\/wp-content\/uploads\/2019\/04\/f22f14599568bff5573fe59eeeaea753.png\" style=\"display:block;margin: 0 auto;\" \/><br \/>\nL\u00e1tszik, hogy p\u00e9ld\u00e1ul a K\u00e9r\u00e9s meg\u00e9rkezett a WS szolg\u00e1ltat\u00e1shoz -&gt; a WS szolg\u00e1ltat\u00e1s kieg\u00e9sz\u00edtette az adatokat az R szolg\u00e1ltat\u00e1s seg\u00edts\u00e9g\u00e9vel -&gt; majd tov\u00e1bbk\u00fcldte a k\u00e9r\u00e9st a V szolg\u00e1ltat\u00e1snak -&gt; a V szolg\u00e1ltat\u00e1s sok adatot t\u00f6lt\u00f6tt le az R szolg\u00e1ltat\u00e1sb\u00f3l -&gt; ell\u00e1togattunk a P szolg\u00e1ltat\u00e1shoz -&gt; a P szolg\u00e1ltat\u00e1s ism\u00e9t megl\u00e1togatta az R szolg\u00e1ltat\u00e1st -&gt; a V szolg\u00e1ltat\u00e1s figyelmen k\u00edv\u00fcl hagyta az eredm\u00e9nyt \u00e9s elment a J szolg\u00e1ltat\u00e1shoz -&gt; \u00e9s csak ezut\u00e1n k\u00fcld\u00f6tt v\u00e1laszt a WS szolg\u00e1ltat\u00e1snak, mik\u00f6zben a h\u00e1tt\u00e9rben m\u00e9g valamit sz\u00e1molt.<br \/>\nIlyen nyomoz\u00e1s vagy r\u00e9szletes dokument\u00e1ci\u00f3 n\u00e9lk\u00fcl nagyon neh\u00e9z meg\u00e9rteni, mi t\u00f6rt\u00e9nik, amikor el\u0151sz\u00f6r n\u00e9z\u00fcnk a k\u00f3dra, \u00e9s a k\u00f3d k\u00fcl\u00f6nb\u00f6z\u0151 szolg\u00e1ltat\u00e1sok k\u00f6z\u00f6tt sz\u00f3r\u00f3dik, rejtve sz\u00e1mos bean \u00e9s interf\u00e9sz m\u00f6g\u00f6tt.\n<\/li>\n<li>Inform\u00e1ci\u00f3k gy\u0171jt\u00e9se a v\u00e9grehajt\u00e1si f\u00e1\u00e1r\u00f3l a tov\u00e1bbi k\u00e9sleltetett elemz\u00e9s \u00e9rdek\u00e9ben. A v\u00e9grehajt\u00e1s minden szakasz\u00e1ban a nyomoz\u00e1sba olyan inform\u00e1ci\u00f3t adhatunk hozz\u00e1, amely az adott szakaszban el\u00e9rhet\u0151, \u00e9s k\u00e9s\u0151bb kider\u00edthetj\u00fck, milyen bemeneti adatok vezettek ehhez a forgat\u00f3k\u00f6nyvh\u00f6z. P\u00e9ld\u00e1ul:\n<ul>\n<li>Felhaszn\u00e1l\u00f3 ID<\/li>\n<li>Jogosults\u00e1gok<\/li>\n<li>A kiv\u00e1lasztott m\u00f3dszer t\u00edpusa<\/li>\n<li>A napl\u00f3 vagy a v\u00e9grehajt\u00e1si hiba<\/li>\n<\/ul>\n<\/li>\n<li>A nyomvonalak \u00e1talak\u00edt\u00e1sa metrik\u00e1k alhalmaz\u00e1v\u00e1, \u00e9s tov\u00e1bbi elemz\u00e9s m\u00e1r metrikak\u00e9nt.<\/li>\n<\/ol>\n<h3>Mi tud napl\u00f3zni a nyomvonal. Span<\/h3>\n<p>A nyomvonalban l\u00e9tezik a span fogalma, ez egy log p\u00e1rhuzama a konzolon. A spannek vannak:<\/p>\n<ul>\n<li>N\u00e9v, \u00e1ltal\u00e1ban ez a v\u00e9grehajtott m\u00f3dszer neve<\/li>\n<li>Szolg\u00e1ltat\u00e1s neve, amelyben a span l\u00e9trej\u00f6tt<\/li>\n<li>Saj\u00e1t egyedi azonos\u00edt\u00f3<\/li>\n<li>Valamilyen meta inform\u00e1ci\u00f3 key\/value form\u00e1tumban, amelyet napl\u00f3ztak benne. P\u00e9ld\u00e1ul a m\u00f3dszer param\u00e9terei vagy hogy a m\u00f3dszer hib\u00e1val v\u00e9gz\u0151d\u00f6tt-e vagy sem<\/li>\n<li>Ennek a spannek a v\u00e9grehajt\u00e1s\u00e1nak kezdeti \u00e9s befejez\u00e9si id\u0151pontja<\/li>\n<li>Sz\u00fcl\u0151 span azonos\u00edt\u00f3<\/li>\n<\/ul>\n<p>\nMinden span a span gy\u0171jt\u0151h\u00f6z ker\u00fcl, hogy elt\u00e1rolja az adatb\u00e1zisban a tov\u00e1bbi megtekint\u00e9s c\u00e9lj\u00e1b\u00f3l, amint befejezte a fut\u00e1s\u00e1t. K\u00e9s\u0151bb fel\u00e9p\u00edthet\u0151 az \u00f6sszes span f\u00e1ja a sz\u00fcl\u0151azonos\u00edt\u00f3k alapj\u00e1n. Elemz\u00e9skor p\u00e9ld\u00e1ul megtal\u00e1lhat\u00f3ak azok a spannek egy adott szolg\u00e1ltat\u00e1sban, amelyek meghaladt\u00e1k egy bizonyos id\u0151t. Ezut\u00e1n, ha r\u00e1kattint egy konkr\u00e9t spanra, l\u00e1that\u00f3 az \u00f6sszes fa fentr\u0151l \u00e9s alulr\u00f3l e spannek.<\/p>\n<p><img decoding=\"async\" alt=\"Szolg\u00e1ltat\u00e1sok nyomk\u00f6vet\u00e9se, OpenTracing \u00e9s Jaeger\" src=\"\/wp-content\/uploads\/2019\/04\/9cc97f1278af60f0efd5e393cd183c5c.png\" style=\"display:block;margin: 0 auto;\" \/><br \/>\n<\/p>\n<h3>Opentrace, Jaeger \u00e9s hogyan val\u00f3s\u00edtottuk ezt meg a projektjeinkben<\/h3>\n<p>\nVan egy k\u00f6z\u00f6s szabv\u00e1ny <noindex><a rel=\"nofollow\" href=\"https:\/\/opentracing.io\/docs\/overview\/\">Opentrace<\/a><\/noindex>, amely le\u00edrja, hogyan \u00e9s mit kell \u00f6sszegy\u0171jteni, an\u00e9lk\u00fcl, hogy a nyomvonalat egy nyelv konkr\u00e9t megval\u00f3s\u00edt\u00e1s\u00e1hoz k\u00f6tn\u00e9nk. P\u00e9ld\u00e1ul Java eset\u00e9n a nyomvonalakkal val\u00f3 munka a k\u00f6z\u00f6s Opentrace API-n kereszt\u00fcl t\u00f6rt\u00e9nik, ami m\u00f6g\u00f6tt p\u00e9ld\u00e1ul a Jaeger vagy egy \u00fcres alap\u00e9rtelmezett implement\u00e1ci\u00f3 \u00e1ll, amely semmit sem csin\u00e1l.<br \/>\nN\u00e1lunk a <noindex><a rel=\"nofollow\" href=\"https:\/\/www.jaegertracing.io\/\">Jaeger<\/a><\/noindex> mint az Opentrace implement\u00e1ci\u00f3ja haszn\u00e1latos. T\u00f6bb komponenst tartalmaz:<\/p>\n<p><img decoding=\"async\" alt=\"Szolg\u00e1ltat\u00e1sok nyomk\u00f6vet\u00e9se, OpenTracing \u00e9s Jaeger\" src=\"\/wp-content\/uploads\/2019\/04\/1fd4ae8563569271b067861c81101d71.png\" style=\"display:block;margin: 0 auto;\" \/><br \/>\n<\/p>\n<ul>\n<li>Jaeger-agent \u2014 helyi \u00fcgyn\u00f6k, amely \u00e1ltal\u00e1ban minden g\u00e9pen fut, \u00e9s a szolg\u00e1ltat\u00e1sok logolnak a helyi alap\u00e9rtelmezett portra. Ha az \u00fcgyn\u00f6k nincs, akkor az \u00f6sszes szolg\u00e1ltat\u00e1s nyomvonala ezen a g\u00e9pen \u00e1ltal\u00e1ban le van tiltva<\/li>\n<li>Jaeger-collector \u2014 ebbe minden \u00fcgyn\u00f6k elk\u00fcldi a begy\u0171jt\u00f6tt nyomvonalakat, \u00e9s \u0151 azokat elhelyezi az kiv\u00e1lasztott adatb\u00e1zisban<\/li>\n<li>Adatb\u00e1zis \u2014 \u00e1ltal\u00e1ban a Cassandra prefer\u00e1lt n\u00e1luk, de mi az Elasticsearch-t haszn\u00e1ljuk, van megval\u00f3s\u00edt\u00e1s m\u00e1s p\u00e1r adatb\u00e1zis sz\u00e1m\u00e1ra \u00e9s egy in-memory implement\u00e1ci\u00f3, ami semmit sem t\u00e1rol a lemezen<\/li>\n<li>Jaeger-query \u2014 ez a szolg\u00e1ltat\u00e1s, ami az adatb\u00e1zisba megy \u00e9s visszaadja a m\u00e1r \u00f6sszegy\u0171jt\u00f6tt nyomvonalakat az elemz\u00e9shez<\/li>\n<li>Jaeger-ui \u2014 ez egy webes fel\u00fclet a nyomvonalak keres\u00e9s\u00e9re \u00e9s megtekint\u00e9s\u00e9re, amely a jaeger-query-t haszn\u00e1lja<\/li>\n<\/ul>\n<p><img decoding=\"async\" alt=\"Szolg\u00e1ltat\u00e1sok nyomk\u00f6vet\u00e9se, OpenTracing \u00e9s Jaeger\" src=\"\/wp-content\/uploads\/2019\/04\/afc415cb5d4f19e7ba18394c2c1a9dd5.png\" style=\"display:block;margin: 0 auto;\" \/><br \/>\n<br \/>\nK\u00fcl\u00f6n komponensk\u00e9nt eml\u00edthet\u0151 az Opentrace Jaeger megval\u00f3s\u00edt\u00e1sa konkr\u00e9t nyelvekhez, amelyen kereszt\u00fcl a spannek a jaeger-agentbe ker\u00fclnek.<br \/>\n<noindex><a rel=\"nofollow\" href=\"https:\/\/github.com\/jaegertracing\/jaeger-client-java\">Jaeger csatlakoztat\u00e1sa Java-ban<\/a><\/noindex> Az io.opentracing.Tracer interf\u00e9sz implement\u00e1l\u00e1s\u00e1ra vonatkozik, ezut\u00e1n minden nyom k\u00f6vetni lesz \u00e1tk\u00fcldve a val\u00f3di \u00fcgyn\u00f6kbe.<\/p>\n<p><img decoding=\"async\" alt=\"Szolg\u00e1ltat\u00e1sok nyomk\u00f6vet\u00e9se, OpenTracing \u00e9s Jaeger\" src=\"\/wp-content\/uploads\/2019\/04\/5ce4bdfc06def7e4645bd58163e99dab.png\" style=\"display:block;margin: 0 auto;\" \/><br \/>\n<br \/>\nA Spring komponensekhez is csatlakoztathat\u00f3 <noindex><a rel=\"nofollow\" href=\"https:\/\/github.com\/opentracing-contrib\/java-spring-cloud\">opentracing-spring-cloud-starter<\/a><\/noindex> \u00e9s a Jaeger \u00e1ltal biztos\u00edtott implement\u00e1ci\u00f3 <noindex><a rel=\"nofollow\" href=\"https:\/\/github.com\/opentracing-contrib\/java-spring-jaeger\">opentracing-spring-jaeger-cloud-starter<\/a><\/noindex> amely automatikusan konfigur\u00e1lja a nyomk\u00f6vet\u00e9st minden, ezen komponensek \u00e1ltal \u00e1tfoly\u00f3 dologra, p\u00e9ld\u00e1ul HTTP k\u00e9r\u00e9sek a kontrollerekbe, adatb\u00e1zis-k\u00e9r\u00e9sek JDBC-n kereszt\u00fcl stb.<\/p>\n<h3>Nyomok napl\u00f3z\u00e1sa Java nyelven<\/h3>\n<p>\nValahol a legfels\u0151 szinten l\u00e9tre kell hozni az els\u0151 Span-t, ezt automat\u00e1n egy Spring-vez\u00e9rl\u0151 v\u00e9gezheti egy k\u00e9r\u00e9s \u00e9rkez\u00e9sekor, vagy manu\u00e1lisan, ha nincs ilyen. Ezut\u00e1n \u00e1tker\u00fcl a Scope al\u00e1. Ha egy alatta l\u00e9v\u0151 m\u00f3dszer hozz\u00e1 szeretne adni egy Span-t, a jelenlegi activeSpan-t a Scope-b\u00f3l veszi, \u00faj Span-t hoz l\u00e9tre, megmondja, hogy a sz\u00fcl\u0151je a kapott activeSpan, \u00e9s az \u00faj Span-t akt\u00edvv\u00e1 teszi. A k\u00fcls\u0151 szolg\u00e1ltat\u00e1sok h\u00edv\u00e1sakor az aktu\u00e1lis akt\u00edv Span-t \u00e1tadj\u00e1k nekik, \u00e9s azok \u00faj Spans-t hoznak l\u00e9tre, amelyek ehhez a Span-hoz kapcsol\u00f3dnak.<br \/>\nMindez a Tracer p\u00e9ld\u00e1nyon kereszt\u00fcl t\u00f6rt\u00e9nik, amelyet a DI mechanizmuson kereszt\u00fcl lehet megszerezni, vagy a GlobalTracer.get() haszn\u00e1lat\u00e1val mint glob\u00e1lis v\u00e1ltoz\u00f3t, ha a DI mechanizmus nem m\u0171k\u00f6dik. Alap\u00e9rtelmez\u00e9s szerint, ha a tracer nincs inicializ\u00e1lva, a NoopTracer t\u00e9r vissza, amely semmit sem csin\u00e1l.<br \/>\nA tracet a ScopeManager-en kereszt\u00fcl a jelenlegi scope-b\u00f3l szerzik meg, l\u00e9trehoznak egy \u00faj scope-ot a jelenlegib\u0151l egy \u00faj span hozz\u00e1kapcsol\u00e1s\u00e1val, majd a l\u00e9trehozott Scope-t le is z\u00e1rj\u00e1k, amely bez\u00e1rja a l\u00e9trehozott span-t \u00e9s vissza\u00e1ll\u00edtja az el\u0151z\u0151 Scope akt\u00edv \u00e1llapot\u00e1t. A Scope a sz\u00e1lhoz van k\u00f6tve, ez\u00e9rt t\u00f6bb sz\u00e1las programoz\u00e1sn\u00e1l nem szabad elfelejteni, hogy az akt\u00edv span-t \u00e1t kell adni a m\u00e1sik sz\u00e1lnak, hogy a m\u00e1sik sz\u00e1l Scope-j\u00e1t ehhez a span-hoz kapcsolj\u00e1k.<\/p>\n<pre><code class=\"java\">io.opentracing.Tracer tracer = ...; \/\/ GlobalTracer.get()\n\nvoid DoSmth () {\n   try (Scope scope = tracer.buildSpan(\"DoSmth\").startActive(true)) {\n      ...\n   }\n}\nvoid DoOther () {\n    Span span = tracer.buildSpan(\"someWork\").start();\n    try (Scope scope = tracer.scopeManager().activate(span, false)) {\n        \/\/ Dolgozom.\n    } catch(Exception ex) {\n        Tags.ERROR.set(span, true);\n        span.log(Map.of(Fields.EVENT, \"error\", Fields.ERROR_OBJECT, ex, Fields.MESSAGE, ex.getMessage()));\n    } finally {\n        span.finish();\n    }\n}\n\nvoid DoAsync () {\n    try (Scope scope = tracer.buildSpan(\"ServiceHandlerSpan\").startActive(false)) {\n        ...\n        final Span span = scope.span();\n        doAsyncWork(() -&gt; {\n            \/\/ 2. l\u00e9p\u00e9s fent: a Span \u00fajraaktiv\u00e1l\u00e1sa a callbackben, a startActive() false-ra \u00e1ll\u00edt\u00e1sa, ha a Span befejez\u00e9se sz\u00fcks\u00e9ges.\n            try (Scope scope = tracer.scopeManager().activate(span, false)) {\n                ...\n            }\n        });\n    }\n}<\/code><\/pre>\n<p>A p\u00e1rhuzamos programoz\u00e1shoz szint\u00e9n el\u00e9rhet\u0151 a TracedExecutorService \u00e9s hasonl\u00f3 burkol\u00f3k, amelyek automatikusan tov\u00e1bb\u00edtj\u00e1k a jelenlegi spant a sz\u00e1lba, amikor aszinkron feladatokat ind\u00edtunk:<\/p>\n<pre><code class=\"java\">private ExecutorService executor = new TracedExecutorService(\n    Executors.newFixedThreadPool(10), GlobalTracer.get()\n);<\/code><\/pre>\n<p>K\u00fcls\u0151 HTTP k\u00e9r\u00e9sekhez l\u00e9tezik <noindex><a rel=\"nofollow\" href=\"https:\/\/github.com\/opentracing-contrib\/java-apache-httpclient\">TracingHttpClient<\/a><\/noindex><\/p>\n<pre><code class=\"java\">HttpClient httpClient = new TracingHttpClientBuilder().build();<\/code><\/pre>\n<h3>Probl\u00e9m\u00e1k, amelyekkel szembes\u00fclt\u00fcnk<\/h3>\n<p><\/p>\n<ul>\n<li>A binek \u00e9s a DI nem mindig m\u0171k\u00f6dik, ha a tracer nem szolg\u00e1ltat\u00e1sban vagy komponensben van, akkor <noindex><a rel=\"nofollow\" href=\"https:\/\/habr.com\/ru\/users\/autowired\/\" class=\"user_link\">Autowired<\/a><\/noindex> A Tracer nem m\u0171k\u00f6dhet, \u00e9s akkor a GlobalTracer.get() haszn\u00e1lat\u00e1ra van sz\u00fcks\u00e9g.<\/li>\n<li>Az annot\u00e1ci\u00f3k nem m\u0171k\u00f6dnek, ha ez nem komponens vagy szolg\u00e1ltat\u00e1s, vagy ha a met\u00f3dush\u00edv\u00e1s egy szomsz\u00e9dos met\u00f3dusb\u00f3l t\u00f6rt\u00e9nik ugyanabban az oszt\u00e1lyban. \u00d3vatosnak kell lenni, ellen\u0151rizni, mi m\u0171k\u00f6dik, \u00e9s manu\u00e1lis trace l\u00e9trehoz\u00e1st kell haszn\u00e1lni, ha a @Traced nem m\u0171k\u00f6dik. Ezenk\u00edv\u00fcl hozz\u00e1 lehet rendelni egy kieg\u00e9sz\u00edt\u0151 ford\u00edt\u00f3t a java annot\u00e1ci\u00f3khoz, \u00edgy mindenhol m\u0171k\u00f6dni\u00fck kell.<\/li>\n<li>A r\u00e9gi spring \u00e9s spring boot eset\u00e9n az opentracing spring cloud automatikus konfigur\u00e1ci\u00f3ja nem m\u0171k\u00f6dik a DI hib\u00e1i miatt, \u00edgy ha automatikusan szeretn\u00e9nk, hogy a trace-ek m\u0171k\u00f6djenek a spring komponensekben, hasonl\u00f3an lehet elj\u00e1rni, mint <noindex><a rel=\"nofollow\" href=\"https:\/\/github.com\/opentracing-contrib\/java-spring-jaeger\/blob\/master\/opentracing-spring-jaeger-starter\/src\/main\/java\/io\/opentracing\/contrib\/java\/spring\/jaeger\/starter\/JaegerAutoConfiguration.java\">github.com\/opentracing-contrib\/java-spring-jaeger\/blob\/master\/opentracing-spring-jaeger-starter\/src\/main\/java\/io\/opentracing\/contrib\/java\/spring\/jaeger\/starter\/JaegerAutoConfiguration.java<\/a><\/noindex><\/li>\n<li>A groovy-ban nem m\u0171k\u00f6dik a try with resources, mindenk\u00e9ppen haszn\u00e1lni kell a try finally-t.<\/li>\n<li>Minden szolg\u00e1ltat\u00e1sn\u00e1l meghat\u00e1rozand\u00f3 a saj\u00e1t spring.application.name, amely alatt a trace-ek napl\u00f3z\u00f3dnak. R\u00e1ad\u00e1sul k\u00fcl\u00f6n n\u00e9v a produkci\u00f3s \u00e9s teszt k\u00f6rnyezethez, hogy ne keveredjenek.<\/li>\n<li>Ha a GlobalTracer-t \u00e9s a tomcat-ot haszn\u00e1ljuk, akkor minden, a tomcatban fut\u00f3 szolg\u00e1ltat\u00e1s ugyanazzal a GlobalTracer-rel rendelkezik, \u00edgy mindenhol ugyanaz lesz a szolg\u00e1ltat\u00e1s neve.<\/li>\n<li>Trace-ek hozz\u00e1ad\u00e1sakor biztosnak kell lenni abban, hogy azt nem h\u00edvj\u00e1k meg sokszor ciklusban. Hozz\u00e1 kell adni egy k\u00f6z\u00f6s trace-et minden h\u00edv\u00e1shoz, amely napl\u00f3zza az \u00f6sszes\u00edtett fut\u00e1si id\u0151t. Ellenkez\u0151 esetben a felesleges terhel\u00e9s j\u00f6het l\u00e9tre.<\/li>\n<li>Egyszer a jaeger-ui-ban t\u00fal nagy k\u00e9r\u00e9seket k\u00fcldt\u00fcnk egy nagy sz\u00e1m\u00fa trace-ra, \u00e9s mivel nem v\u00e1rtunk a v\u00e1laszra, \u00fajra megpr\u00f3b\u00e1ltuk. Ennek eredm\u00e9nyek\u00e9nt a jaeger-query sok mem\u00f3ri\u00e1t haszn\u00e1lt \u00e9s lelass\u00edtotta az elastic-et. A jaeger-query \u00fajraind\u00edt\u00e1sa seg\u00edtett.<\/li>\n<\/ul>\n<h3>Trace-ek mintav\u00e9telez\u00e9se, t\u00e1rol\u00e1sa \u00e9s megtekint\u00e9se<\/h3>\n<p>\nH\u00e1rom t\u00edpus l\u00e9tezik <noindex><a rel=\"nofollow\" href=\"https:\/\/www.jaegertracing.io\/docs\/1.9\/sampling\/\">trace mintav\u00e9telez\u00e9se<\/a><\/noindex>:<\/p>\n<ol>\n<li>Const, ami minden trace-t elk\u00fcld \u00e9s t\u00e1rol.<\/li>\n<li>Probabilistic, ami a trace-eket egy megadott val\u00f3sz\u00edn\u0171s\u00e9ggel kisz\u0171ri.<\/li>\n<li>A ratelimiter that limits the number of traces per second. These settings can be configured on the client, either on jaeger-agent or in the collector. Currently, we use const 1 in the stack of validators since the requests are not very frequent but take a considerable amount of time. In the future, if it causes excessive load on the system, a limit can be set.<\/li>\n<\/ol>\n<p>\nIf using Cassandra, it stores traces by default only for two days. We use <noindex><a rel=\"nofollow\" href=\"https:\/\/github.com\/jaegertracing\/jaeger\/tree\/master\/plugin\/storage\/es\">elasticsearch<\/a><\/noindex> and traces are stored indefinitely and are not deleted. A separate index is created each day, for example jaeger-service-2019-03-04. In the future, we need to set up automatic cleanup of old traces.<\/p>\n<p>To view traces, you need to:<\/p>\n<ul>\n<li>Select the service to filter the traces by, for example, tomcat7-default for the service running in Tomcat, which cannot have its own name.<\/li>\n<li>Next, choose the operation, time interval, and minimum operation time, for example, from 10 seconds, to only retrieve long executions.<br \/>\n<img decoding=\"async\" alt=\"Szolg\u00e1ltat\u00e1sok nyomk\u00f6vet\u00e9se, OpenTracing \u00e9s Jaeger\" src=\"\/wp-content\/uploads\/2019\/04\/bc712d4aabfe9c2ae961d3b8f9396a42.png\" style=\"display:block;margin: 0 auto;\" \/><\/li>\n<li>Go to one of the traces and see what caused the slowdown.<br \/>\n<img decoding=\"async\" alt=\"Szolg\u00e1ltat\u00e1sok nyomk\u00f6vet\u00e9se, OpenTracing \u00e9s Jaeger\" src=\"\/wp-content\/uploads\/2019\/04\/16e9dd11903358f5498fe11034bbf848.png\" style=\"display:block;margin: 0 auto;\" \/><\/li>\n<\/ul>\n<p>\nAlso, if a request ID is known, you can find the trace by this ID through tag search if it is logged in the span trace.<\/p>\n<h3>k\u00f3dk\u00f6nyvt\u00e1rra l\u00e9p\u00e9s\u00e9vel \u00e9rheti el.<\/h3>\n<p><\/p>\n<ul>\n<li>OpenTracing documentation <noindex><a rel=\"nofollow\" href=\"https:\/\/opentracing.io\/docs\/overview\/what-is-tracing\/\">opentracing.io\/docs\/overview\/what-is-tracing<\/a><\/noindex><\/li>\n<li>Jaeger documentation <noindex><a rel=\"nofollow\" href=\"https:\/\/www.jaegertracing.io\/docs\/1.10\/\">www.jaegertracing.io\/docs\/1.10<\/a><\/noindex><\/li>\n<li>Connecting Jaeger Java <noindex><a rel=\"nofollow\" href=\"https:\/\/github.com\/jaegertracing\/jaeger-client-java\">github.com\/jaegertracing\/jaeger-client-java<\/a><\/noindex><\/li>\n<li>Connecting Spring OpenTracing<br \/>\n<noindex><a rel=\"nofollow\" href=\"https:\/\/github.com\/jaegertracing\/jaeger-client-java\">github.com\/jaegertracing\/jaeger-client-java<\/a><\/noindex><br \/>\n<noindex><a rel=\"nofollow\" href=\"https:\/\/github.com\/opentracing-contrib\/java-spring-cloud\">github.com\/opentracing-contrib\/java-spring-cloud<\/a><\/noindex><\/li>\n<\/ul>\n<h3>Cikkek<\/h3>\n<p><\/p>\n<ul>\n<li><noindex><a rel=\"nofollow\" href=\"https:\/\/habr.com\/ru\/company\/carprice\/blog\/340946\/\">habr.com\/ru\/company\/carprice\/blog\/340946<\/a><\/noindex> Jaeger OpenTracing and Microservices in a Real Project on PHP and Golang<\/li>\n<li><noindex><a rel=\"nofollow\" href=\"https:\/\/eng.uber.com\/distributed-tracing\/\">eng.uber.com\/distributed-tracing<\/a><\/noindex> Evolving Distributed Tracing at Uber Engineering<\/li>\n<li><noindex><a rel=\"nofollow\" href=\"https:\/\/opentracing.io\/guides\/java\/\">opentracing.io\/guides\/java<\/a><\/noindex><\/li>\n<li><noindex><a rel=\"nofollow\" href=\"https:\/\/medium.com\/jaegertracing\/running-jaeger-agent-on-bare-metal-d1fc47d31fab\">medium.com\/jaegertracing\/running-jaeger-agent-on-bare-metal-d1fc47d31fab<\/a><\/noindex> Running Jaeger Agent on bare metal<\/li>\n<\/ul>\n<h3>Video<\/h3>\n<p><\/p>\n<ul>\n<li><noindex><a rel=\"nofollow\" href=\"https:\/\/www.youtube.com\/watch?v=qg0ENOdP1Lo\">www.youtube.com\/watch?v=qg0ENOdP1Lo<\/a><\/noindex> How We Used Jaeger and Prometheus to Deliver Lightning-Fast User Queries \u2014 Bryan Boreham<\/li>\n<li><noindex><a rel=\"nofollow\" href=\"https:\/\/www.youtube.com\/watch?v=WRntQsUajow\">www.youtube.com\/watch?v=WRntQsUajow<\/a><\/noindex> Intro: Jaeger \u2014 Yuri Shkuro, Uber &amp; Pavol Loffay, Red Hat<\/li>\n<li><noindex><a rel=\"nofollow\" href=\"https:\/\/www.youtube.com\/watch?v=fsHb0qK37bc\">www.youtube.com\/watch?v=fsHb0qK37bc<\/a><\/noindex> Serghei Iakovlev, \"A Short Story of a Great Victory: OpenTracing, AWS and Jaeger\"<\/li>\n<\/ul>\n<p>Forr\u00e1s: <a content=\"nofollow\" rel=\"nofollow\" href=\"https:\/\/habr.com\/ru\/company\/srg\/blog\/446752\/\">habr.com<\/a><\/p>","protected":false,"gt_translate_keys":[{"key":"rendered","format":"html"}]},"excerpt":{"rendered":"<p>\u0412 \u043d\u0430\u0448\u0438\u0445 \u043f\u0440\u043e\u0435\u043a\u0442\u0430\u0445 \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u043c\u0438\u043a\u0440\u043e\u0441\u0435\u0440\u0432\u0438\u0441\u043d\u0443\u044e \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0443. \u041f\u0440\u0438 \u0432\u043e\u0437\u043d\u0438\u043a\u043d\u043e\u0432\u0435\u043d\u0438\u0438 \u0443\u0437\u043a\u0438\u0445 \u043c\u0435\u0441\u0442 \u0432 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043c\u043d\u043e\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0442\u0440\u0430\u0442\u0438\u0442\u0441\u044f \u043d\u0430 \u043c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u043d\u0433 \u0438 \u0440\u0430\u0437\u0431\u043e\u0440 \u043b\u043e\u0433\u043e\u0432. \u041f\u0440\u0438 \u043b\u043e\u0433\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438 \u0442\u0430\u0439\u043c\u0438\u043d\u0433\u043e\u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0445 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439 \u0432 \u043b\u043e\u0433-\u0444\u0430\u0439\u043b, \u043a\u0430\u043a \u043f\u0440\u0430\u0432\u0438\u043b\u043e, \u0441\u043b\u043e\u0436\u043d\u043e \u043f\u043e\u043d\u044f\u0442\u044c \u0447\u0442\u043e \u043f\u0440\u0438\u0432\u0435\u043b\u043e \u043a \u0432\u044b\u0437\u043e\u0432\u0443 \u044d\u0442\u0438\u0445 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439, \u043e\u0442\u0441\u043b\u0435\u0434\u0438\u0442\u044c \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439 \u0438\u043b\u0438 \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u0435 \u0432\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u043e\u0434\u043d\u043e\u0439 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0434\u0440\u0443\u0433\u043e\u0439 \u0432 \u0440\u0430\u0437\u043d\u044b\u0445 \u0441\u0435\u0440\u0432\u0438\u0441\u0430\u0445. \u0414\u043b\u044f \u043c\u0438\u043d\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438 [&hellip;]<\/p>\n","protected":false,"gt_translate_keys":[{"key":"rendered","format":"html"}]},"author":1,"featured_media":22990,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[688],"tags":[],"class_list":["post-31014","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-administrirovanie"],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 5.0.3 - aioseo.com -->\n\t<meta name=\"description\" content=\"\u0412 \u043d\u0430\u0448\u0438\u0445 \u043f\u0440\u043e\u0435\u043a\u0442\u0430\u0445 \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u043c\u0438\u043a\u0440\u043e\u0441\u0435\u0440\u0432\u0438\u0441\u043d\u0443\u044e.\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"Yuri Gagarin\"\/>\n\t<link rel=\"canonical\" href=\"https:\/\/prohoster.info\/hu\/blog\/administrirovanie\/trassirovka-servisov-opentracing-i-jaeger\" \/>\n\t\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 5.0.3\" \/>\n\t\t<meta property=\"og:locale\" content=\"hu_HU\" \/>\n\t\t<meta property=\"og:site_name\" content=\"ProHoster | \u041a\u0443\u043f\u0438\u0442\u044c \u043d\u0430\u0434\u0435\u0436\u043d\u044b\u0439 \u0445\u043e\u0441\u0442\u0438\u043d\u0433 \u0434\u043b\u044f \u0441\u0430\u0439\u0442\u043e\u0432 \u0441 \u0437\u0430\u0449\u0438\u0442\u043e\u0439 \u043e\u0442 DDoS, VPS VDS \u0441\u0435\u0440\u0432\u0435\u0440\u044b\" \/>\n\t\t<meta property=\"og:type\" content=\"article\" \/>\n\t\t<meta property=\"og:title\" content=\"\ud83e\udd47\u0422\u0440\u0430\u0441\u0441\u0438\u0440\u043e\u0432\u043a\u0430 \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432, OpenTracing \u0438 Jaeger | ProHoster\" \/>\n\t\t<meta property=\"og:description\" content=\"\u0412 \u043d\u0430\u0448\u0438\u0445 \u043f\u0440\u043e\u0435\u043a\u0442\u0430\u0445 \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u043c\u0438\u043a\u0440\u043e\u0441\u0435\u0440\u0432\u0438\u0441\u043d\u0443\u044e.\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/prohoster.info\/hu\/blog\/administrirovanie\/trassirovka-servisov-opentracing-i-jaeger\" \/>\n\t\t<meta property=\"og:image\" content=\"https:\/\/prohoster.info\/wp-content\/uploads\/2021\/11\/logo-350.jpg\" \/>\n\t\t<meta property=\"og:image:secure_url\" content=\"https:\/\/prohoster.info\/wp-content\/uploads\/2021\/11\/logo-350.jpg\" \/>\n\t\t<meta property=\"og:image:width\" content=\"350\" \/>\n\t\t<meta property=\"og:image:height\" content=\"350\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2019-10-31T18:38:54+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2019-10-31T18:38:54+00:00\" \/>\n\t\t<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/prohoster\" \/>\n\t\t<meta property=\"article:author\" content=\"https:\/\/www.facebook.com\/prohoster\" \/>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"\ud83e\udd47Service tracing, OpenTracing and Jaeger | ProHoster","description":"In our projects, we use microservices.","canonical_url":"https:\/\/prohoster.info\/hu\/blog\/administrirovanie\/trassirovka-servisov-opentracing-i-jaeger","robots":"max-image-preview:large","keywords":"","webmasterTools":{"miscellaneous":""},"schema":null,"og:locale":"hu_HU","og:site_name":"ProHoster | \u041a\u0443\u043f\u0438\u0442\u044c \u043d\u0430\u0434\u0435\u0436\u043d\u044b\u0439 \u0445\u043e\u0441\u0442\u0438\u043d\u0433 \u0434\u043b\u044f \u0441\u0430\u0439\u0442\u043e\u0432 \u0441 \u0437\u0430\u0449\u0438\u0442\u043e\u0439 \u043e\u0442 DDoS, VPS VDS \u0441\u0435\u0440\u0432\u0435\u0440\u044b","og:type":"article","og:title":"\ud83e\udd47\u0422\u0440\u0430\u0441\u0441\u0438\u0440\u043e\u0432\u043a\u0430 \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432, OpenTracing \u0438 Jaeger | ProHoster","og:description":"\u0412 \u043d\u0430\u0448\u0438\u0445 \u043f\u0440\u043e\u0435\u043a\u0442\u0430\u0445 \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u043c\u0438\u043a\u0440\u043e\u0441\u0435\u0440\u0432\u0438\u0441\u043d\u0443\u044e.","og:url":"https:\/\/prohoster.info\/hu\/blog\/administrirovanie\/trassirovka-servisov-opentracing-i-jaeger","og:image":"https:\/\/prohoster.info\/wp-content\/uploads\/2021\/11\/logo-350.jpg","og:image:secure_url":"https:\/\/prohoster.info\/wp-content\/uploads\/2021\/11\/logo-350.jpg","og:image:width":350,"og:image:height":350,"article:published_time":"2019-10-31T18:38:54+00:00","article:modified_time":"2019-10-31T18:38:54+00:00","article:publisher":"https:\/\/www.facebook.com\/prohoster","article:author":"https:\/\/www.facebook.com\/prohoster"},"aioseo_meta_data":{"post_id":"31014","title":null,"description":null,"keywords":null,"keyphrases":null,"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":null,"og_custom_url":null,"og_article_section":null,"og_article_tags":null,"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"","isEnabled":true},"graphs":[]},"schema_type":null,"schema_type_options":null,"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":null,"robots_max_videopreview":null,"robots_max_imagepreview":"large","priority":null,"frequency":null,"local_seo":null,"seo_analyzer_scan_date":"2026-01-21 04:06:20","breadcrumb_settings":null,"limit_modified_date":false,"reviewed_by":null,"ai":null,"created":"2021-03-01 03:26:04","updated":"2026-01-21 04:06:20","focus_keyword":null,"additional_keywords":null,"truseo_locale":null},"gt_translate_keys":[{"key":"link","format":"url"}],"_links":{"self":[{"href":"https:\/\/prohoster.info\/hu\/wp-json\/wp\/v2\/posts\/31014","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/prohoster.info\/hu\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/prohoster.info\/hu\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/prohoster.info\/hu\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/prohoster.info\/hu\/wp-json\/wp\/v2\/comments?post=31014"}],"version-history":[{"count":0,"href":"https:\/\/prohoster.info\/hu\/wp-json\/wp\/v2\/posts\/31014\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/prohoster.info\/hu\/wp-json\/wp\/v2\/media\/22990"}],"wp:attachment":[{"href":"https:\/\/prohoster.info\/hu\/wp-json\/wp\/v2\/media?parent=31014"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/prohoster.info\/hu\/wp-json\/wp\/v2\/categories?post=31014"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/prohoster.info\/hu\/wp-json\/wp\/v2\/tags?post=31014"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}