W3Cschool
恭喜您成為首批注冊(cè)用戶
獲得88經(jīng)驗(yàn)值獎(jiǎng)勵(lì)
您可以使用Tracer
手動(dòng)創(chuàng)建spans,如以下示例所示:
// Start a span. If there was a span present in this thread it will become // the `newSpan`'s parent. Span newSpan = this.tracer.nextSpan().name("calculateTax"); try (Tracer.SpanInScope ws = this.tracer.withSpanInScope(newSpan.start())) { // ... // You can tag a span newSpan.tag("taxValue", taxValue); // ... // You can log an event on a span newSpan.annotate("taxCalculated"); } finally { // Once done remember to finish the span. This will allow collecting // the span to send it to Zipkin newSpan.finish(); }
在前面的示例中,我們可以看到如何創(chuàng)建跨度的新實(shí)例。如果此線程中已經(jīng)有一個(gè)跨度,它將成為新跨度的父級(jí)。
創(chuàng)建跨度后,請(qǐng)始終保持清潔。另外,請(qǐng)務(wù)必完成要發(fā)送到Zipkin的所有跨度。
如果您的跨度包含的名稱大于50個(gè)字符,則該名稱將被截?cái)酁?0個(gè)字符。您的名字必須明確明確。知名人士會(huì)導(dǎo)致延遲問(wèn)題,有時(shí)甚至?xí)l(fā)例外情況。
Copyright©2021 w3cschool編程獅|閩ICP備15016281號(hào)-3|閩公網(wǎng)安備35020302033924號(hào)
違法和不良信息舉報(bào)電話:173-0602-2364|舉報(bào)郵箱:jubao@eeedong.com
掃描二維碼
下載編程獅App
編程獅公眾號(hào)
聯(lián)系方式:
更多建議: