SpringCloud 連續(xù)跨度

2023-12-01 16:11 更新

如果要將標(biāo)記和注釋添加到現(xiàn)有范圍,則可以使用@ContinueSpan注釋,如以下示例所示:

// method declaration
@ContinueSpan(log = "testMethod11")
void testMethod11(@SpanTag("testTag11") String param);

// method execution
this.testBean.testMethod11("test");
this.testBean.testMethod13();

(請(qǐng)注意,與@NewSpan注釋相反,您還可以使用log參數(shù)添加日志。)

這樣,跨度將繼續(xù),并且:

  • 創(chuàng)建名為testMethod11.beforetestMethod11.after的日志條目。
  • 如果引發(fā)異常,還將創(chuàng)建名為testMethod11.afterFailure的日志條目。
  • 將創(chuàng)建一個(gè)標(biāo)簽,標(biāo)簽為testTag11,值為test。
以上內(nèi)容是否對(duì)您有幫助:
在線筆記
App下載
App下載

掃描二維碼

下載編程獅App

公眾號(hào)
微信公眾號(hào)

編程獅公眾號(hào)