热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

brave.propagation.TraceContext.spanId()方法的使用及代码示例

本文整理了Java中brave.propagation.TraceContext.spanId()方法的一些代码示例,展示了TraceContext.spa

本文整理了Java中brave.propagation.TraceContext.spanId()方法的一些代码示例,展示了TraceContext.spanId()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。TraceContext.spanId()方法的具体详情如下:
包路径:brave.propagation.TraceContext
类名称:TraceContext
方法名:spanId

TraceContext.spanId介绍

[英]Unique 8-byte identifier of this span within a trace.

A span is uniquely identified in storage by ( #traceId, #spanId).
[中]跟踪中此跨度的唯一8字节标识符。
span在存储器中由(#traceId,#spanId)唯一标识。

代码示例

代码示例来源:origin: openzipkin/brave

RealKey(TraceContext context, ReferenceQueue queue) {
super(context, queue);
hashCode = context.hashCode();
traceIdHigh = context.traceIdHigh();
traceId = context.traceId();
localRootId = context.localRootId();
spanId = context.spanId();
sampled = Boolean.TRUE.equals(context.sampled());
}

代码示例来源:origin: openzipkin/brave

void noticesDifferentSpanId(Scope scope) {
TraceContext differentSpanId = context.toBuilder().spanId(context.spanId() + 1L).build();
try (Scope scope2 = currentTraceContext.maybeScope(differentSpanId)) {
assertThat(scope2).isNotEqualTo(Scope.NOOP);
assertThat(currentTraceContext.get())
.isEqualTo(differentSpanId);
verifyImplicitContext(differentSpanId);
} finally {
scope.close();
}
}

代码示例来源:origin: openzipkin/brave

/** Resolves hash code collisions */
@Override public boolean equals(Object other) {
RealKey that = (RealKey) other;
TraceContext thatCOntext= that.get();
if (thatCOntext== null) return false;
return (traceIdHigh == thatContext.traceIdHigh())
&& (traceId == thatContext.traceId())
&& (spanId == thatContext.spanId())
&& shared == thatContext.shared();
}
}

代码示例来源:origin: openzipkin/brave

void set(TraceContext context) {
set(context.traceIdHigh(), context.traceId(), context.spanId(), context.shared());
}

代码示例来源:origin: openzipkin/brave

/** Trace contexts are equal only on trace ID and span ID. try to get the parent's clock */
@Nullable TickClock getClockFromParent(TraceContext context) {
long parentId = context.parentIdAsLong();
// NOTE: we still look for lookup key even on root span, as a client span can be root, and a
// server can share the same ID. Essentially, a shared span is similar to a child.
PendingSpan parent = null;
if (context.shared() || parentId != 0L) {
long spanId = parentId != 0L ? parentId : context.spanId();
parent = delegate.get(InternalPropagation.instance.newTraceContext(
0,
context.traceIdHigh(),
context.traceId(),
0,
0,
spanId,
Collections.emptyList()
));
}
return parent != null ? parent.clock : null;
}

代码示例来源:origin: openzipkin/brave

static byte[] toBytes(TraceContext traceContext) {
checkNotNull(traceContext, "traceContext");
byte[] bytes = new byte[FORMAT_LENGTH];
bytes[0] = VERSION;
bytes[1] = TRACE_ID_FIELD_ID;
writeLong(bytes, 2, traceContext.traceIdHigh());
writeLong(bytes, 10, traceContext.traceId());
bytes[18] = SPAN_ID_FIELD_ID;
writeLong(bytes, 19, traceContext.spanId());
bytes[27] = TRACE_OPTION_FIELD_ID;
if (traceContext.sampled() != null && traceContext.sampled()) {
bytes[28] = 1;
}
return bytes;
}

代码示例来源:origin: spring-cloud/spring-cloud-sleuth

replace("parentId", parentId);
replace(LEGACY_PARENT_ID_NAME, parentId);
String spanId = HexCodec.toLowerHex(currentSpan.spanId());
MDC.put("spanId", spanId);
MDC.put(LEGACY_SPAN_ID_NAME, spanId);

代码示例来源:origin: openzipkin/brave

public final TraceContext decorate(TraceContext context) {
long traceId = context.traceId(), spanId = context.spanId();
Class type = type();

代码示例来源:origin: spring-cloud/spring-cloud-sleuth

replace("parentId", parentId);
replace(LEGACY_PARENT_ID_NAME, parentId);
String spanId = HexCodec.toLowerHex(currentSpan.spanId());
MDC.put("spanId", spanId);
MDC.put(LEGACY_SPAN_ID_NAME, spanId);

代码示例来源:origin: openzipkin/brave

/**
* Called by methods which can accept externally supplied parent trace contexts: Ex. {@link
* #newChild(TraceContext)} and {@link #startScopedSpanWithParent(String, TraceContext)}. This
* implies the {@link TraceContext#localRootId()} could be zero, if the context was manually
* created.
*/
TraceContext nextContext(TraceContext parent) {
return nextContext(
InternalPropagation.instance.flags(parent),
parent.traceIdHigh(),
parent.traceId(),
parent.localRootId(),
parent.spanId(),
parent.extra()
);
}

代码示例来源:origin: openzipkin/brave

context.traceIdHigh(),
context.traceId(),
context.spanId(), // local root
context.parentIdAsLong(),
context.spanId(),
context.extra()
);

代码示例来源:origin: openzipkin/brave

static int writeB3SingleFormat(TraceContext context, long parentId, char[] result) {
int pos = 0;
long traceIdHigh = context.traceIdHigh();
if (traceIdHigh != 0L) {
writeHexLong(result, pos, traceIdHigh);
pos += 16;
}
writeHexLong(result, pos, context.traceId());
pos += 16;
result[pos++] = '-';
writeHexLong(result, pos, context.spanId());
pos += 16;
Boolean sampled = context.sampled();
if (sampled != null) {
result[pos++] = '-';
result[pos++] = context.debug() ? 'd' : sampled ? '1' : '0';
}
if (parentId != 0L) {
result[pos++] = '-';
writeHexLong(result, pos, parentId);
pos += 16;
}
return pos;
}

代码示例来源:origin: openzipkin/brave

traceId = implicitParent.traceId();
localRootId = implicitParent.localRootId();
spanId = implicitParent.spanId();
extra = concatImmutableLists(extra, implicitParent.extra());
} else {

代码示例来源:origin: io.zipkin.brave/brave

RealKey(TraceContext context, ReferenceQueue queue) {
super(context, queue);
hashCode = context.hashCode();
traceIdHigh = context.traceIdHigh();
traceId = context.traceId();
localRootId = context.localRootId();
spanId = context.spanId();
sampled = Boolean.TRUE.equals(context.sampled());
}

代码示例来源:origin: io.zipkin.brave/brave-tests

void noticesDifferentSpanId(Scope scope) {
TraceContext differentSpanId = context.toBuilder().spanId(context.spanId() + 1L).build();
try (Scope scope2 = currentTraceContext.maybeScope(differentSpanId)) {
assertThat(scope2).isNotEqualTo(Scope.NOOP);
assertThat(currentTraceContext.get())
.isEqualTo(differentSpanId);
verifyImplicitContext(differentSpanId);
} finally {
scope.close();
}
}

代码示例来源:origin: io.zipkin.brave/brave

/** Resolves hash code collisions */
@Override public boolean equals(Object other) {
RealKey that = (RealKey) other;
TraceContext thatCOntext= that.get();
if (thatCOntext== null) return false;
return (traceIdHigh == thatContext.traceIdHigh())
&& (traceId == thatContext.traceId())
&& (spanId == thatContext.spanId())
&& shared == thatContext.shared();
}
}

代码示例来源:origin: io.zipkin.brave/brave

void set(TraceContext context) {
set(context.traceIdHigh(), context.traceId(), context.spanId(), context.shared());
}

代码示例来源:origin: com.github.gitssie/play-transport

public void propagationTraceInfo(HttpUriRequest request, Span span) {
TraceContext currentSpan = span.context();
request.addHeader("X-B3-TraceId",currentSpan.traceIdString());
request.addHeader("X-B3-SpanId", HexCodec.toLowerHex(currentSpan.spanId()));
if(currentSpan.parentId() != null) {
request.addHeader("X-B3-ParentSpanId", HexCodec.toLowerHex(currentSpan.parentId()));
}
request.addHeader("X-B3-Sampled",String.valueOf(currentSpan.sampled()));
}

代码示例来源:origin: io.zipkin.brave/brave-core

static SpanId toSpanId(TraceContext context) {
return SpanId.builder()
.traceIdHigh(context.traceIdHigh())
.traceId(context.traceId())
.parentId(context.parentId())
.spanId(context.spanId())
.debug(context.debug())
.sampled(context.sampled()).build();
}
}

代码示例来源:origin: xjdr/xio

Tracing.Builder tracingBuilder(Sampler sampler) {
return Tracing.newBuilder()
.spanReporter(
s -> {
// make sure the context was cleared prior to finish.. no leaks!
TraceContext current = httpTracing.tracing().currentTraceContext().get();
if (current != null) {
Assert.assertNotEquals(current.spanId(), s.id());
}
spans.add(s);
})
.currentTraceContext(currentTraceContext)
.sampler(sampler);
}

推荐阅读
  • Spring特性实现接口多类的动态调用详解
    本文详细介绍了如何使用Spring特性实现接口多类的动态调用。通过对Spring IoC容器的基础类BeanFactory和ApplicationContext的介绍,以及getBeansOfType方法的应用,解决了在实际工作中遇到的接口及多个实现类的问题。同时,文章还提到了SPI使用的不便之处,并介绍了借助ApplicationContext实现需求的方法。阅读本文,你将了解到Spring特性的实现原理和实际应用方式。 ... [详细]
  • 个人学习使用:谨慎参考1Client类importcom.thoughtworks.gauge.Step;importcom.thoughtworks.gauge.T ... [详细]
  • JDK源码学习之HashTable(附带面试题)的学习笔记
    本文介绍了JDK源码学习之HashTable(附带面试题)的学习笔记,包括HashTable的定义、数据类型、与HashMap的关系和区别。文章提供了干货,并附带了其他相关主题的学习笔记。 ... [详细]
  • CEPH LIO iSCSI Gateway及其使用参考文档
    本文介绍了CEPH LIO iSCSI Gateway以及使用该网关的参考文档,包括Ceph Block Device、CEPH ISCSI GATEWAY、USING AN ISCSI GATEWAY等。同时提供了多个参考链接,详细介绍了CEPH LIO iSCSI Gateway的配置和使用方法。 ... [详细]
  • 图像因存在错误而无法显示 ... [详细]
  • 本文整理了Java面试中常见的问题及相关概念的解析,包括HashMap中为什么重写equals还要重写hashcode、map的分类和常见情况、final关键字的用法、Synchronized和lock的区别、volatile的介绍、Syncronized锁的作用、构造函数和构造函数重载的概念、方法覆盖和方法重载的区别、反射获取和设置对象私有字段的值的方法、通过反射创建对象的方式以及内部类的详解。 ... [详细]
  • 如何自行分析定位SAP BSP错误
    The“BSPtag”Imentionedintheblogtitlemeansforexamplethetagchtmlb:configCelleratorbelowwhichi ... [详细]
  • Java太阳系小游戏分析和源码详解
    本文介绍了一个基于Java的太阳系小游戏的分析和源码详解。通过对面向对象的知识的学习和实践,作者实现了太阳系各行星绕太阳转的效果。文章详细介绍了游戏的设计思路和源码结构,包括工具类、常量、图片加载、面板等。通过这个小游戏的制作,读者可以巩固和应用所学的知识,如类的继承、方法的重载与重写、多态和封装等。 ... [详细]
  • 阿,里,云,物,联网,net,core,客户端,czgl,aliiotclient, ... [详细]
  • 本文介绍了Web学习历程记录中关于Tomcat的基本概念和配置。首先解释了Web静态Web资源和动态Web资源的概念,以及C/S架构和B/S架构的区别。然后介绍了常见的Web服务器,包括Weblogic、WebSphere和Tomcat。接着详细讲解了Tomcat的虚拟主机、web应用和虚拟路径映射的概念和配置过程。最后简要介绍了http协议的作用。本文内容详实,适合初学者了解Tomcat的基础知识。 ... [详细]
  • Oracle seg,V$TEMPSEG_USAGE与Oracle排序的关系及使用方法
    本文介绍了Oracle seg,V$TEMPSEG_USAGE与Oracle排序之间的关系,V$TEMPSEG_USAGE是V_$SORT_USAGE的同义词,通过查询dba_objects和dba_synonyms视图可以了解到它们的详细信息。同时,还探讨了V$TEMPSEG_USAGE的使用方法。 ... [详细]
  • 本文介绍了OpenStack的逻辑概念以及其构成简介,包括了软件开源项目、基础设施资源管理平台、三大核心组件等内容。同时还介绍了Horizon(UI模块)等相关信息。 ... [详细]
  • 模板引擎StringTemplate的使用方法和特点
    本文介绍了模板引擎StringTemplate的使用方法和特点,包括强制Model和View的分离、Lazy-Evaluation、Recursive enable等。同时,还介绍了StringTemplate语法中的属性和普通字符的使用方法,并提供了向模板填充属性的示例代码。 ... [详细]
  • Whatsthedifferencebetweento_aandto_ary?to_a和to_ary有什么区别? ... [详细]
  • 本文讨论了在VMWARE5.1的虚拟服务器Windows Server 2008R2上安装oracle 10g客户端时出现的问题,并提供了解决方法。错误日志显示了异常访问违例,通过分析日志中的问题帧,找到了解决问题的线索。文章详细介绍了解决方法,帮助读者顺利安装oracle 10g客户端。 ... [详细]
author-avatar
闺蜜好我会明白
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有