本文整理汇总了Java中org.springframework.cloud.sleuth.Span.getSpanId方法的典型用法代码示例。如果您正苦于以下问题:Java Span.getSpanId方法的具体用法?Java Span.getSpanId怎么用?Java Span.getSpanId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.springframework.cloud.sleuth.Span
的用法示例。
在下文中一共展示了Span.getSpanId方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: inject
import org.springframework.cloud.sleuth.Span; //导入方法依赖的package包/类
@Override
public void inject(Span span, RpcContext carrier) {
Map<String, String> attachments = carrier.getAttachments();
if (span.getTraceId() != 0) {
attachments.put(Span.TRACE_ID_NAME, Span.idToHex(span.getTraceId()));
}
if (span.getSpanId() != 0) {
attachments.put(Span.SPAN_ID_NAME, Span.idToHex(span.getSpanId()));
}
attachments.put(Span.SAMPLED_NAME, span.isExportable() ? Span.SPAN_SAMPLED : Span.SPAN_NOT_SAMPLED);
attachments.put(Span.SPAN_NAME_NAME, span.getName());
Long parentId = getParentId(span);
if (parentId != null && parentId != 0) {
attachments.put(Span.PARENT_ID_NAME, Span.idToHex(parentId));
}
attachments.put(Span.PROCESS_ID_NAME, span.getProcessId());
}
示例2: onAfterConnectionClose
import org.springframework.cloud.sleuth.Span; //导入方法依赖的package包/类
@Override
public void onAfterConnectionClose(ConnectionInformation connectionInformation, SQLException e) {
Span connectionSpan = connectionSpans.remove(connectionInformation);
if (e != null) {
connectionSpan.tag(Span.SPAN_ERROR_TAG_NAME, ExceptionUtils.getExceptionMessage(e));
}
Span currentSpan = tracer.getCurrentSpan();
// result set and statement were not closed but connection was, closing result set span as well
if (currentSpan.getSpanId() != connectionSpan.getSpanId()
&& currentSpan.getName().contains(SleuthListenerAutoConfiguration.SPAN_FETCH_POSTFIX)) {
tracer.close(currentSpan);
}
tracer.close(connectionSpan);
}
开发者ID:gavlyukovskiy,项目名称:spring-boot-data-source-decorator,代码行数:15,代码来源:TracingJdbcEventListener.java