![Search icon](https://hackernoon.imgix.net/search-new.png?w=19&h=19)
Mubihe byashize, iyo twavugaga inyuma yinyuma, mubisanzwe twavugaga kuri progaramu imwe nini hamwe numubare munini, base base, kandi kwinjira byari bihagije mugukurikirana. Noneho, dukesha tekinoroji nka Kubernetes , microservices yabaye igipimo. Porogaramu ni nyinshi kandi ziratangwa, kandi kwinjiza gakondo ntibikiri bihagije mugukemura no gusuzuma ibibazo mubisabwa.
Igisubizo cyiza cyo gutegura igenzura ni OpenTelemetry - igitabo kigezweho gishobora gukoreshwa mugukemura no gusesengura imikorere ya sisitemu yatanzwe.
Iyi ngingo igenewe abanyamwuga ba IT bashaka kwagura ubumenyi bwabo muburyo bwiza. Hano hepfo, tuzasobanura icyo OpenTelemetry aricyo, ibitekerezo byingenzi, nibibazo bifasha gukemura. Niba ushishikajwe nuburyo OpenTelemetry ishobora guhindura uburyo bwawe bwo gukurikirana no gukemura sisitemu yinyuma, kuzamura kwizerwa no gukora neza - soma.
Ibigo binini byikoranabuhanga byabanje guhura nikibazo cyo gukwirakwiza ibiti no gushakisha mu mpera za 2000. Mu mwaka wa 2010, Google yasohoye impapuro,
Muri 2014, Kubernetes yagaragaye, yoroshya cyane iterambere rya microservices hamwe nizindi sisitemu zagabanijwe. Ibi byatumye ibigo byinshi bihura nibibazo byo gukwirakwiza ibiti no gukurikirana muri microservices. Kugirango uburinganire bwakwirakwijwe, uburyo bwa OpenTracing, bwemejwe na CNCF, n'umushinga wa Google OpenCensus washyizweho.
Muri 2019, imishinga ya OpenTracing na OpenCensus yatangaje ko yahujwe mwizina rya OpenTelemetry. Ihuriro rihuza imikorere myiza yakusanyirijwe mumyaka myinshi, ituma habaho guhuza bidasubirwaho gushakisha, gutema ibiti, hamwe na metrics muri sisitemu iyo ari yo yose, utitaye kubibazo byabo.
Uyu munsi, OpenTelemetry ntabwo ari umushinga gusa; ni inganda zinganda zo gukusanya no kohereza amakuru ya telemetrie. Yatejwe imbere kandi ishyigikiwe numuryango winzobere namasosiyete ayoboye isoko nka Google na Microsoft. Umushinga ukomeje gutera imbere, wunguka ubushobozi bushya bwo koroshya kwishyira hamwe no gukoresha inzira.
OpenTelemetry ni urutonde rwuzuye rwibikorwa nibikoresho bisobanura ibimenyetso porogaramu ishobora kubyara kugirango imikoranire nisi yo hanze, nuburyo ibyo bimenyetso bishobora gukusanywa no kubonwa amashusho kugirango bikurikirane uko porogaramu na sisitemu muri rusange. Ubwoko butatu bwibimenyetso ni ugukurikirana, gutema , hamwe no gukusanya ibipimo .
** Reka dusuzume neza buri kintu: \
OpenTelemetry itangiza igitekerezo cyibikorwa. Imirongo ikubiyemo cyane cyane ibiranga nka `trace_id`
(ibiranga ibikorwa byubu) na` `span_id`
(ikiranga kubisabwa, hamwe na buri gisubizo cyibisabwa bifite `span_id`
idasanzwe).
Byongeye kandi, imiterere irashobora kuba ikubiyemo amakuru ahamye, nkizina ryizina aho porogaramu yoherejwe cyangwa izina ryibidukikije (prod / qa). Iyi mirima, izwi nkibikoresho muri OpenTelemetry terminologiya, yometse kuri buri giti, ibipimo, cyangwa ibisobanuro kugirango byoroshye gushakisha. Imirongo irashobora kandi gushiramo amakuru yingirakamaro, nkibiranga iherezo ryubu ( `http_path: "GET /user/:id/info"`
), bishobora guhuzwa guhitamo amatsinda y'ibiti, ibipimo, cyangwa ibimenyetso.
OpenTelemetry ibice bishobora kunyuzwa hagati ya porogaramu zitandukanye ukoresheje porotokoro yo gukwirakwiza imiterere. Izi protocole zigizwe numutwe wongeyeho kuri buri HTTP cyangwa gRPC icyifuzo cyangwa imitwe yubutumwa kumurongo. Ibi bituma porogaramu zo hasi zongera kubaka imikorere kuva iyi mitwe.
Dore ingero zimwe zo gukwirakwiza imiterere:
B3-Kwamamaza Iyi ni urutonde rwimitwe ( x-b3-*
) yabanje gukora kuri sisitemu yo gushakisha Zipkin. Yahinduwe muri OpenTracing kandi ikoreshwa nibikoresho byinshi namasomero. B3-Kwamamaza bitwara trace_id
/ span_id
nibendera ryerekana niba icyitegererezo ari ngombwa.
Imiterere ya W3C Yateguwe nitsinda ryakazi rya W3C, iyi ngingo ihuza uburyo butandukanye bwo gukwirakwiza imiterere muburyo bumwe kandi nibisanzwe muri OpenTelemetry. Urugero rwiza rwo gushyira mu bikorwa aya mahame ni ugukurikirana ishyirwa mu bikorwa ryanyuze kuri microservices yashyizwe mu bikorwa n’ikoranabuhanga ritandukanye bitabangamiye gukurikirana no gukemura neza.
Gukurikirana ni inzira yo gufata amajwi hanyuma ugashushanya igihe cyinzira yo gusaba ukoresheje microservices nyinshi.
Mu iyerekwa, buri kabari kitwa "span" kandi gafite "span_id" idasanzwe. Imizi ya span ivugwa nka "trace" kandi ifite "trace_id" , ikora nkibiranga icyifuzo cyose.
Ubu bwoko bwo kubona amashusho bugufasha kuri:
trace_id
na span_id
kugirango ukoreshe mubindi bimenyetso.
Nubwo bigaragara ko byoroshye, gutema bikomeza kuba kimwe mubikoresho bikomeye byo gusuzuma ibibazo. OpenTelemetry yongerera ibiti gakondo wongeyeho amakuru ajyanye. By'umwihariko, niba ibimenyetso bifatika bihari, `trace_id` na` span_id` ibiranga bihita byongerwaho ibiti, bikabihuza nigihe cyagenwe. Byongeye kandi, ibiranga logi bishobora gushiramo amakuru ahamye kuva murwego rwa OpenTelemetry, nkibiranga node, kimwe namakuru yingirakamaro, nkibiranga iherezo rya HTTP (`http_path:" KUBONA / ukoresha /: id "`).
Ukoresheje `trace_id`, urashobora kubona ibiti biva muri microservices zose zijyanye nibisabwa ubu, mugihe` span_id` igufasha gutandukanya ibyo wasabye. Kurugero, mugihe cyo gusubiramo, ibiti biva kugerageza bitandukanye bizagira `span_id`s zitandukanye. Gukoresha ibimuranga bifasha gusesengura byihuse imyitwarire ya sisitemu yose mugihe nyacyo, kwihutisha gusuzuma ibibazo no kongera umutekano no kwizerwa.
Icyegeranyo cyibipimo gitanga amakuru yumubare kubikorwa bya sisitemu, nkubukererwe, igipimo cyamakosa, imikoreshereze yumutungo, nibindi byinshi. Igenzura-nyaryo ryibipimo bigufasha guhita usubiza impinduka zimikorere, ukirinda kunanirwa hamwe numunaniro ukabije, kandi ukemeza ko bihari kandi byizewe bya porogaramu kubakoresha.
Kwishyira hamwe hamwe na sisitemu yo kubika no kwerekana amashusho nka Prometheus na Grafana byoroha kubona amashusho yaya makuru, byoroshe kugenzura.
Gufungura ibipimo bya OpenTelemetry birahujwe na Prometheus na OpenMetrics ibipimo, bigafasha kworohereza ibisubizo bya OpenTelemetry nta mpinduka zikomeye. OpenTelemetry SDK yemerera ingero_idoherezwa hanze hamwe na metrics, bigatuma bishoboka guhuza ibipimo hamwe nurugero rwibiti.
Hamwe na hamwe, ibiti, ibipimo, hamwe no gukurikirana birema ibintu byose byerekana uko sisitemu imeze:
Usibye ibice bitatu byingenzi, OpenTelemetry ikubiyemo ibitekerezo bya Sampling, Imizigo, hamwe nubuyobozi bukoreshwa.
Muri sisitemu iremereye cyane, ingano y'ibiti n'ibisobanuro iba nini cyane, bisaba ibikoresho bifatika kubikorwa remezo no kubika amakuru. Kugira ngo iki kibazo gikemuke, ibipimo bya OpenTelemetry birimo ibimenyetso byerekana ibimenyetso - ubushobozi bwo kohereza igice gusa cyibimenyetso n'ibiti. Kurugero, urashobora kohereza ibimenyetso birambuye uhereye ku ijanisha ryibisabwa, ibyifuzo birebire, cyangwa gusaba amakosa. Ubu buryo butanga icyitegererezo gihagije cyo kubaka imibare mugihe uzigama umutungo wingenzi.
Ariko, niba buri sisitemu yigenga isaba kugenzura birambuye, turangiza tukareba ibice bya buri cyifuzo. Sisitemu zimwe zishobora kohereza amakuru arambuye mugihe izindi zishobora kohereza igice gusa cyangwa kohereza hanze.
Kugira ngo iki kibazo gikemuke, uburyo bwo gukwirakwiza imiterere ya OpenTelemetry bwohereza ibendera ry'icyitegererezo hamwe na `trace_id` /` span_id`. Ibi byemeza ko niba serivisi yambere yakiriye icyifuzo cyabakoresha ihitamo ko icyifuzo kigomba gukurikiranwa muburyo burambuye, izindi sisitemu zose zizakurikiza. Bitabaye ibyo, sisitemu zose zigomba igice cyangwa ntizisohore ibimenyetso byo kubungabunga umutungo. Ubu buryo bwitwa "Head Sampling" - icyemezo cyafashwe mugitangira cyo gutunganya ibyifuzo, bitunguranye cyangwa bishingiye kubiranga bimwe byinjira.
Uretse ibyo, OpenTelemetry ishyigikira "Umurizo Sampling", aho porogaramu zose zihora zohereza ibimenyetso byose muburyo burambuye, ariko buffer yo hagati irahari. Nyuma yo gukusanya amakuru yose, iyi buffer ihitamo niba igumana amakuru yuzuye cyangwa ikabika icyitegererezo gusa. Ubu buryo butuma abantu benshi bahagarariye icyitegererezo cya buri cyiciro (cyatsinze / kirekire / ikosa) ariko gisaba gushyiraho ibikorwa remezo byiyongera.
Uburyo bwa Baggage butuma urufunguzo-agaciro rudasanzwe rwandikirwa hamwe na trace_id
/ span_id
, ihita inyura hagati ya microservices yose mugihe cyo gutunganya ibyifuzo. Ibi ni ingirakamaro mu kohereza amakuru yinyongera akenewe munzira isaba-nkamakuru yumukoresha cyangwa igenamiterere ryibidukikije.
Urugero rwumutwe wo kohereza imizigo ukurikije igipimo cya W3C: tracestate: rojo=00f067aa0ba902b7,congo=t61rcWkgMzE,userId=1c30032v5
Dore zimwe mu ngero zikoreshwa mu mizigo:
Gutambutsa Imiterere yubucuruzi Amakuru userId
, productId
, cyangwa deviceId
birashobora kunyuzwa muri microservices zose. Porogaramu irashobora guhita yandika aya makuru, ikemerera gushakisha amakuru ukoresheje imiterere yabakoresha kubisabwa byambere.
Ibipimo byihariye Iboneza Igenamiterere rya SDKs cyangwa ibikorwa remezo.
Ibendera rya Route Ibendera rifasha kwipakurura kuringaniza gufata ibyemezo. Mugihe cyo kugerageza, ibyifuzo bimwe bishobora gukenera guhindurwa kugirango usebye inyuma. Kubera ko imizigo yoherezwa mu buryo bwikora binyuze muri serivisi zose, nta mpamvu yo gukora protocole y'inyongera-shiraho gusa amategeko ku buringanire.
Menya ko mugihe imikorere yimitwaro ari ntoya, gukoresha cyane birashobora kongera cyane imiyoboro hamwe numurimo wa serivisi. Witonze hitamo amakuru ukeneye kunyura muri Baggage kugirango wirinde ibibazo byimikorere.
Gushyira mubikorwa OpenTelemetry kurwego rwibikorwa remezo bikubiyemo kwinjiza inyuma ya OpenTelemetry inyuma yububiko bwa porogaramu no kugena ibikorwa remezo byo gukusanya amakuru.
Inzira igizwe n'ibyiciro bine:
Kwishyira hamwe kwa Porogaramu Mu cyiciro cya mbere, OpenTelemetry SDKs yinjijwe mu buryo butaziguye muri porogaramu zo gukusanya ibipimo, ibiti, hamwe n’ibisobanuro, byemeza ko amakuru agenda akurikirana ku bijyanye na buri kintu kigizwe na sisitemu.
Kugena abohereza ibicuruzwa hanze Ikusanyamakuru ryakuwe mubisabwa binyuze mubohereza ibicuruzwa hanze muri sisitemu yo hanze kugirango birusheho gutunganywa, nko gutema ibiti, kugenzura, gukurikirana, cyangwa sisitemu yo gusesengura, ukurikije ibyo ukeneye.
Guteranya no Kubika Iki cyiciro gishobora kuba gikubiyemo guhuza amakuru, kuyitunganyiriza hamwe nandi makuru, no guhuza amakuru aturuka ahantu hatandukanye kugirango habeho icyerekezo kimwe cya sisitemu.
Kwerekana Data Amaherezo, amakuru yatunganijwe yerekanwa nkibibaho muri sisitemu nka Grafana (kuri metrics na traces) cyangwa Kibana (kubiti). Ibi bituma amatsinda asuzuma byihuse ubuzima bwa sisitemu, akamenya ibibazo n'ibigenda, kandi agashyiraho imenyesha rishingiye ku bimenyetso byatanzwe.
Kugirango uhuze na porogaramu, ugomba guhuza OpenTelemetry ikwiye SDK y'ururimi rwa porogaramu ikoreshwa cyangwa ugakoresha amasomero hamwe nuburyo bushyigikira OpenTelemetry. GufunguraTelemetrie akenshi ishyira mubikorwa intera ikoreshwa mubitabo bizwi, byemerera gusimburwa. Kurugero, isomero rya Micrometer rikoreshwa muburyo bwo gukusanya ibipimo muri Java ecosystem. OpenTelemetry SDK itanga ishyirwa mubikorwa rya interineti ya Micrometero, ituma ibicuruzwa byoherezwa hanze bidahinduye kode nyamukuru yo gusaba. Byongeye kandi, OpenTelemetry itanga ishyirwa mubikorwa rya kera rya OpenTracing na OpenCensus, byorohereza kwimuka neza kuri OpenTelemetry.
Muri sisitemu ya IT, OpenTelemetry irashobora kuba urufunguzo rw'ejo hazaza hizewe kandi neza. Iki gikoresho cyoroshya gukemura no kugenzura kandi binatanga amahirwe yo gusobanukirwa byimbitse imikorere yimikorere no gutezimbere kurwego rushya. Injira mumuryango wa OpenTelemetry kugirango ufashe gushiraho ejo hazaza aho iterambere ryinyuma ryoroshye kandi ryiza!