本文整理了Java中brave.propagation.TraceContext.traceIdHigh()
方法的一些代码示例,展示了TraceContext.traceIdHigh()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。TraceContext.traceIdHigh()
方法的具体详情如下:
包路径:brave.propagation.TraceContext
类名称:TraceContext
方法名:traceIdHigh
[英]When non-zero, the trace containing this span uses 128-bit trace identifiers.
[中]非零时,包含此跨度的跟踪使用128位跟踪标识符。
代码示例来源:origin: openzipkin/brave
RealKey(TraceContext context, ReferenceQueue<TraceContext> 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
/** 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: 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
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
context.traceIdHigh(),
context.traceId(),
代码示例来源:origin: openzipkin/brave
traceIdHigh = implicitParent.traceIdHigh();
traceId = implicitParent.traceId();
localRootId = implicitParent.localRootId();
代码示例来源:origin: io.zipkin.brave/brave
RealKey(TraceContext context, ReferenceQueue<TraceContext> 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
/** 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: io.zipkin.brave/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: io.zipkin.brave/brave-instrumentation-grpc
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: io.zipkin.brave/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: io.zipkin.brave/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: io.zipkin.brave/brave-propagation-aws
/** Writes 35 characters representing the input trace ID to the buffer at the given offset */
static void writeRoot(TraceContext context, char[] result, int offset) {
result[offset] = '1'; // version
result[offset + 1] = '-'; // delimiter
long high = context.traceIdHigh();
writeHexByte(result, offset + 2, (byte) ((high >>> 56L) & 0xff));
writeHexByte(result, offset + 4, (byte) ((high >>> 48L) & 0xff));
writeHexByte(result, offset + 6, (byte) ((high >>> 40L) & 0xff));
writeHexByte(result, offset + 8, (byte) ((high >>> 32L) & 0xff));
result[offset + 10] = '-';
writeHexByte(result, offset + 11, (byte) ((high >>> 24L) & 0xff));
writeHexByte(result, offset + 13, (byte) ((high >>> 16L) & 0xff));
writeHexByte(result, offset + 15, (byte) ((high >>> 8L) & 0xff));
writeHexByte(result, offset + 17, (byte) (high & 0xff));
writeHexLong(result, offset + 19, context.traceId());
}
代码示例来源: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: io.zipkin.brave/brave
context.traceIdHigh(),
context.traceId(),
代码示例来源:origin: io.zipkin.brave/brave
traceIdHigh = implicitParent.traceIdHigh();
traceId = implicitParent.traceId();
localRootId = implicitParent.localRootId();
内容来源于网络,如有侵权,请联系作者删除!