![Search icon](https://hackernoon.imgix.net/search-new.png?w=19&h=19)
Kare, pataitaura nezve backend, taiwanzoreva kune imwe hombe application ine imwechete, hombe dhatabhesi, uye kutema miti kwaikwana kuongororwa. Ikozvino, nekuda kwehunyanzvi hwekuita seKubernetes , microservices dzave chiyero. Zvikumbiro zvawanda uye zvakagoverwa, uye matanda echinyakare haachakwane pakugadzirisa uye kuongorora matambudziko mumashandisirwo edu.
Mhinduro yakanakisa yekuronga yekutarisa ndeye OpenTelemetry - yemazuva ano turusititi inogona kushandiswa kugadzirisa uye kuongororwa kwekuita kwemasisitimu akagoverwa.
Ichi chinyorwa chakagadzirirwa vadzidzisi veIT vari kutsvaga kuwedzera ruzivo rwavo mu backend optimization. Pazasi, isu tinotsanangura kuti OpenTelemetry chii, pfungwa dzayo dzakakosha, uye matambudziko anobatsira kugadzirisa. Kana iwe uchifarira kuti OpenTelemetry inogona sei kushandura maitiro ako ekutarisa uye kugadzirisa backend masisitimu, kuwedzera kuvimbika kwavo uye kushanda nesimba - verenga enderera.
Makambani makuru etekinoroji akatanga kutarisana nedambudziko rekugovaniswa kwematanda uye kutsvaga mukupera kwema2000s. Muna 2010, Google yakaburitsa bepa,
Muna 2014, Kubernetes yakabuda, ichirerutsa zvakanyanya kuvandudza kwema microservices uye mamwe masystem-akaparadzirwa makore. Izvi zvakakonzera kuti makambani mazhinji asangane nenyaya nekugovaniswa kwematanda uye kutsvaga mumamicroservices. Kumisa kuteera kwakagoverwa, chiyero cheOpenTracing, chakagamuchirwa neCNCF, uye chirongwa cheGoogle cheOpenCensus chakagadzirwa.
Muna 2019, mapurojekiti eOpenTracing uye OpenCensus akazivisa kubatanidzwa pasi pezita reOpenTelemetry. Iyi puratifomu inosanganisa maitiro akanakisa akaunganidzwa mumakore mazhinji, achibvumira kusanganisa kusanganisa kwekutevera, kutema miti, uye metrics mune chero system, zvisinei nekuoma kwavo.
Nhasi, OpenTelemetry haisi chirongwa chete; ndiyo chiyero cheindasitiri chekuunganidza uye kutumira telemetry data. Inogadzirwa uye inotsigirwa nenharaunda yenyanzvi uye makambani anotungamira pamusika seGoogle neMicrosoft. Iyo purojekiti inoramba ichishanduka, ichiwana hunyanzvi hutsva hwekurerutsa kusanganisa uye kushandisa maitiro.
OpenTelemetry ndeye yakazara seti yemaitiro uye maturusi anotsanangura kuti zvii zviratidzo zvinogona kuburitswa neapplication kuti idyidzane nenyika yekunze, uye kuti masaini aya anogona kuunganidzwa uye kuoneswa kuti atarise mamiriro ekushandisa uye system yese. Iwo matatu makuru marudzi emasaini ari kuronda, kutema matanda , uye metrics kuunganidza .
**Ngatitarisei zvakanyanya chikamu chimwe nechimwe:\
OpenTelemetry inosvitsa pfungwa yemamiriro ekushanda. Chirevo chechirevo chinonyanyo sanganisira zvinhu zvakaita `trace_id`
(chiziviso chekushanda kwazvino) uye `span_id`
(chiziviso chechikumbiro chidiki, nekuyedzwa kwega kwega kwechikumbiro chidiki chine `span_id`
yakasiyana).
Pamusoro pezvo, mamiriro ezvinhu anogona kuve neruzivo rwakamira, senge zita renode uko kushandiswa kunoiswa kana zita renzvimbo (prod/qa). Aya minda, anozivikanwa sezviwanikwa muOpenTelemetry terminology, akasungirirwa kune yega yega log, metric, kana kuteedzera kuti iite nyore kutsvaga. Mamiriro ezvinhu anogonawo kusanganisira data rine simba, sechiratidzo chemagumo ekupedzisira ( `http_path: "GET /user/:id/info"`
), inogona kusungirirwa kumapoka ematanda, metrics, kana traces.
OpenTelemetry mamiriro anogona kupfuudzwa pakati pezvishandiso zvakasiyana uchishandisa mamiriro ekuparadzira mapuroteni. Aya maprotocol ane seti yemusoro inowedzerwa kune yega yega HTTP kana gRPC chikumbiro kana misoro yemameseji emitsara. Izvi zvinobvumira zvikumbiro zvepasi kuti zvigadzirise mamiriro ekushanda kubva kune iyi misoro.
Heino mimwe mienzaniso yekuparadzira mamiriro ezvinhu:
B3-Propagation Iyi seti yemisoro ( x-b3-*
) yakatanga kugadzirirwa Zipkin tracing system. Yakagadziridzwa kuita OpenTracing uye yakashandiswa nemidziyo yakawanda nemaraibhurari. B3-Propagation inotakura trace_id
/ span_id
uye mureza unoratidza kana sampling ichidikanwa.
W3C Trace Context Yakagadzirwa neboka rinoshanda reW3C, chiyero ichi chinobatanidza nzira dzakasiyana dzekuparadzira mamiriro kuita chiyero chimwe uye ndiyo yakasarudzika muOpenTelemetry. Muenzaniso wakanaka wekushandisa aya mazinga ndeyekutevera kuitiswa kwechikumbiro ichipfuura nemamicroservices anoitwa neakasiyana matekinoroji pasina kukanganisa kutarisa uye kugadzirisa.
Kutsvaga ndiyo maitiro ekurekodha uye wozoona nguva yenzira yekukumbira kuburikidza nemamicroservices akawanda.
Mukuona, bhaa yega yega inonzi "span" uye ine yakasarudzika "span_id" . Root span inodaidzwa se "trace" uye ine "trace_id" , iyo inoshanda sechiratidzo chechikumbiro chese.
Iyi mhando yekuona inokubvumira kuti:
trace_id
uye span_id
yekushandisa mune mamwe masaini.
Pasinei nekureruka kwaro kuri pachena, kutema miti kunoramba kuri chimwe chezvishandiso zvine simba zvekuongorora matambudziko. OpenTelemetry inosimudzira matanda echinyakare nekuwedzera ruzivo rwemamiriro ezvinhu. Kunyanya, kana mucherechedzo uripo, `trace_id` uye `span_id` mavara anongowedzerwa kulog, achiabatanidza neawa yakatarwa. Zvakare, hunhu hwemalog hunogona kusanganisira static ruzivo kubva kuOpenTelemetry mamiriro, senge node identifier, pamwe neruzivo rwesimba, seyazvino HTTP endpoint identifier (`http_path: "GET /user/:id"`).
Uchishandisa iyo `trace_id`, unogona kuwana matanda kubva kune ese mamicroservices ane chekuita nechikumbiro chazvino, nepo `span_id` ichikubvumidza kusiyanisa pakati pezvikumbiro diki. Semuyenzaniso, kana iri nyaya yekuedzazve, matanda kubva mukuedza kwakasiyana achave akasiyana `span_id`s. Kushandisa zviziviso izvi kunogonesa kuongororwa nekukurumidza kwemaitiro ehurongwa hwese munguva chaiyo, kukurumidza kuongororwa dambudziko uye kuwedzera kugadzikana uye kuvimbika.
Metrics kuunganidzwa inopa huwandu hwe data pakuita kwesystem, senge latency, mhosho, mashandisiro ezviwanikwa, nezvimwe. Chaiyo-nguva yekutarisa metrics inobvumidza iwe kuti upindure nekukurumidza kuchinja kwekuita, kudzivirira kutadza uye kupera kwezviwanikwa, uye kuve nechokwadi chekuwanikwa kwepamusoro uye kuvimbika kwechishandiso chevashandisi.
Kubatanidzwa ne metric kuchengetedza uye kuona masisitimu sePrometheus neGrafana kunoita kuti zvive nyore kuona iyi data, zvakanyanya kurerutsa kutarisa.
OpenTelemetry metric vateresi inoenderana nePrometheus uye OpenMetrics zviyero, zvichigonesa shanduko iri nyore kune OpenTelemetry mhinduro pasina shanduko yakakosha. Iyo OpenTelemetry SDK inobvumira trace_id mienzaniso kuendeswa kunze kwenyika pamwe chete nemametrics, zvichiita kuti zvikwanise kubatanidza metrics nemienzaniso yelogi uye zviteshi.
Pamwe chete, matanda, metrics, uye kutsvaga zvinogadzira maonero akazara emamiriro ehurongwa:
Pamusoro pezvinhu zvitatu zvakakosha, OpenTelemetry inosanganisira pfungwa dzeSampling, Baggage, uye mashandiro emamiriro ekugadzirisa.
Mune yakakwirira-mutoro masisitimu, huwandu hwematanda uye zviteshi zvinova zvakakura, zvinoda zvakakura zviwanikwa zvezvivakwa uye kuchengetedza data. Kugadzirisa nyaya iyi, OpenTelemetry zviyero zvinosanganisira chiratidzo sampling - kugona kutumira kunze chete chikamu chemateki uye matanda. Semuenzaniso, unogona kutumira masaini akadzama kubva muzana yezvikumbiro, zvikumbiro zvenguva refu, kana zvikumbiro zvekukanganisa. Iyi nzira inobvumira sampling yakakwana yekuvaka manhamba uchichengetedza zvakakosha zviwanikwa.
Nekudaro, kana sisitimu yega yega ikasarudza yakazvimiririra kuti ndechipi chikumbiro chekutarisa zvakadzama, tinopedzisira tave nekupatsanurwa maonero echikumbiro chega chega. Mamwe masisitimu anogona kutumira data rakadzama nepo mamwe achingoendesa kunze kana kusaendesa kunze zvachose.
Kugadzirisa dambudziko iri, mashandiro eOpenTelemetry ekushambadza mamiriro ezvinhu anofambisa mureza wesampling pamwe ne `trace_id`/`span_id`. Izvi zvinova nechokwadi chekuti kana sevhisi yekutanga inogamuchira chikumbiro chemushandisi ikafunga kuti chikumbiro chinofanirwa kutariswa zvakadzama, mamwe masisitimu anozotevera. Zvikasadaro, masisitimu ese anofanirwa kuita zvishoma kana kusatumira masaini kuchengetedza zviwanikwa. Iyi nzira inodaidzwa kuti "Musoro Sampling" - sarudzo yakaitwa pakutanga kwekukumbira kugadzirisa, zvingave zvisina tsarukano kana zvichibva pane mamwe maitiro ekuisa.
Kunze kwezvo, OpenTelemetry inotsigira "Tail Sampling," uko maapplication ese anogara achiendesa masaini ese zvakadzama, asi yepakati buffer iripo. Mushure mekuunganidza data rese, iyi buffer inosarudza kuchengetedza iyo yakazara data kana kungochengeta chikamu chikamu. Iyi nzira inobvumira imwe inomiririra sampuli yechikamu chega chega chekukumbira (yakabudirira / kureba / kukanganisa) asi inoda kumwe kumisikidzwa kwezvivakwa.
Iyo Baggage michina inobvumira kupokana kiyi-value pairi kuti ifambiswe pamwe chete trace_id
/ span_id
, ichipfuura otomatiki pakati peese mamicroservices panguva yekukumbira. Izvi zvinobatsira kuendesa rumwe ruzivo rwunodiwa munzira yese yekukumbira-senge ruzivo rwemushandisi kana runtime nharaunda marongero.
Muenzaniso wemusoro wekutumira mikwende zvinoenderana nechiyero cheW3C: tracestate: rojo=00f067aa0ba902b7,congo=t61rcWkgMzE,userId=1c30032v5
Heino mimwe mienzaniso yekushandiswa kweBaggage:
Kupfuura Bhizinesi Context Ruzivo senge userId
, productId
, kana deviceId
inogona kupfuudzwa kuburikidza nese microservices. Zvishandiso zvinokwanisa kurodha ruzivo urwu, zvichibvumira kutsvaga kwelogi nemushandisi wechikumbiro chepakutanga.
Yakanyanya Configuration Parameters Zvirongwa zveSDKs kana zvivakwa.
Routing Mireza Mireza inobatsira kurodha mabharanzi kuita sarudzo dzekufambisa. Panguva yekuyedzwa, zvimwe zvikumbiro zvingangoda kuendeswa kunoseka backends. Sezvo mukwende uchifambiswa otomatiki kuburikidza nesevhisi yese, hapana chikonzero chekugadzira mamwe maprotocol-ingoisa mutemo pane inotakura mitoro.
Ziva kuti kunyangwe kuita kweBaggage kuri kushoma, kushandisa zvakanyanya kunogona kuwedzera zvakanyanya network uye sevhisi mutoro. Nekuchenjera sarudza kuti ndeipi data yaunoda chaizvo kupfuura nepaBaggage kudzivirira nyaya dzekuita.
Kuita OpenTelemetry padanho rezvivakwa kunosanganisira kubatanidza OpenTelemetry backends muchimiro chekushandisa uye kugadzirisa zvivakwa zvekuunganidza data.
Iyo nzira ine matanho mana:
Kubatanidzwa Kwechikumbiro Muchikamu chekutanga, OpenTelemetry SDKs dzakabatanidzwa zvakananga mumashandisirwo ekuunganidza metrics, matanda, uye zviteshi, kuve nechokwadi chekuenderera kuyerera kwedata nezve mashandiro echikamu chega chega.
Kugadzirisa Vatengesi Vekunze Yakaunganidzwa data inofambiswa kubva kumashandisirwo kuburikidza nevanotumira kunze kune ekunze masisitimu kuti iwedzere kugadziriswa, senge kutema matanda, kutarisa, kutsvaga, kana analytics masisitimu, zvichienderana nezvaunoda.
Aggregation uye Kuchengeta Iyi nhanho inogona kusanganisira yakajairika data, kuipfumisa nerumwe ruzivo, uye kubatanidza data kubva kwakasiyana masosi kugadzira maonero akabatana emamiriro ehurongwa.
Kutariswa Kwedata Pakupedzisira, data rakagadziridzwa rinounzwa semadhibhodhi mumasisitimu akaita seGrafana (yemetrics uye trace) kana Kibana (yematanda). Izvi zvinobvumira zvikwata kukurumidza kuongorora hutano hwehurongwa, kuona nyaya uye mafambiro, uye kumisikidza zviziviso zvichibva pamasaini anogadzirwa.
Kuti ubatanidze nechishandiso, unofanirwa kubatanidza iyo yakakodzera OpenTelemetry SDK yemutauro wechirongwa uri kushandiswa kana kushandisa maraibhurari nemafuremu anotsigira zvakananga OpenTelemetry. OpenTelemetry inowanzo shandisa nzvimbo dzinoshandiswa zvakanyanya kubva kumaraibhurari anozivikanwa, ichibvumira kudonhedza-in kutsiva. Semuenzaniso, raibhurari yeMicrometer inowanzoshandiswa kuunganidza metrics muJava ecosystem. Iyo OpenTelemetry SDK inopa mashandisirwo ayo eMicrometer interfaces, ichigonesa metric kutumira kunze kwekuchinja iyo huru yekushandisa kodhi. Zvakare, OpenTelemetry inopa mashandisirwo ekare OpenTracing uye OpenCensus interfaces, kufambisa kutama kwakanaka kuenda kuOpenTelemetry.
MuIT masisitimu, OpenTelemetry inogona kuve kiyi kune ramangwana reakavimbika uye anoshanda backends. Ichi chishandiso chinorerutsa kugadzirisa uye kutarisa uye zvakare chinovhura mikana yekunzwisisa kwakadzama kwekuita kweapp uye optimization pane imwe nhanho. Joinha nharaunda yeOpenTelemetry kuti ubatsire kuumba ramangwana uko kusimudzira kumashure kuri nyore uye kunoshanda zvakanyanya!