public void addTraceParent(SpanId id) { if (!id.isValid()) { return; } if (traceParentsUsed == traceParents.length) { int newLength = (traceParents.length == 0) ? 8 : traceParents.length * 2; traceParents = Arrays.copyOf(traceParents, newLength); } traceParents[traceParentsUsed] = id; traceParentsUsed++; }
ThreadContext context = threadContext.get(); if (parentScope != null) { if (parentId.isValid() && (!parentId.equals(parentScope.getSpan().getSpanId()))) { return newScopeImpl(context, description, parentScope, parentId); return newScopeImpl(context, description, parentScope); } else if (parentId.isValid()) { return newScopeImpl(context, description, parentId);
ThreadContext context = threadContext.get(); if (parentScope != null) { if (parentId.isValid() && (!parentId.equals(parentScope.getSpan().getSpanId()))) { return newScopeImpl(context, description, parentScope, parentId); return newScopeImpl(context, description, parentScope); } else if (parentId.isValid()) { return newScopeImpl(context, description, parentId);
ThreadContext context = threadContext.get(); if (parentScope != null) { if (parentId.isValid() && (!parentId.equals(parentScope.getSpan().getSpanId()))) { return newScopeImpl(context, description, parentScope, parentId); return newScopeImpl(context, description, parentScope); } else if (parentId.isValid()) { return newScopeImpl(context, description, parentId);
@Override public void requestShortCircuitShm(String clientName) throws IOException { ShortCircuitShmRequestProto.Builder builder = ShortCircuitShmRequestProto.newBuilder(). setClientName(clientName); SpanId spanId = Tracer.getCurrentSpanId(); if (spanId.isValid()) { builder.setTraceInfo(DataTransferTraceInfoProto.newBuilder(). setTraceId(spanId.getHigh()). setParentId(spanId.getLow())); } ShortCircuitShmRequestProto proto = builder.build(); send(out, Op.REQUEST_SHORT_CIRCUIT_SHM, proto); }
throws IOException { jgen.writeStartObject(); if (span.getSpanId().isValid()) { jgen.writeStringField("a", span.getSpanId().toString());
@Override public void releaseShortCircuitFds(SlotId slotId) throws IOException { ReleaseShortCircuitAccessRequestProto.Builder builder = ReleaseShortCircuitAccessRequestProto.newBuilder(). setSlotId(PBHelperClient.convert(slotId)); SpanId spanId = Tracer.getCurrentSpanId(); if (spanId.isValid()) { builder.setTraceInfo(DataTransferTraceInfoProto.newBuilder(). setTraceId(spanId.getHigh()). setParentId(spanId.getLow())); } ReleaseShortCircuitAccessRequestProto proto = builder.build(); send(out, Op.RELEASE_SHORT_CIRCUIT_FDS, proto); }
throws IOException { jgen.writeStartObject(); if (span.getSpanId().isValid()) { jgen.writeStringField("a", span.getSpanId().toString());
static BaseHeaderProto buildBaseHeader(ExtendedBlock blk, Token<BlockTokenIdentifier> blockToken) { BaseHeaderProto.Builder builder = BaseHeaderProto.newBuilder() .setBlock(PBHelperClient.convert(blk)) .setToken(PBHelperClient.convert(blockToken)); SpanId spanId = Tracer.getCurrentSpanId(); if (spanId.isValid()) { builder.setTraceInfo(DataTransferTraceInfoProto.newBuilder() .setTraceId(spanId.getHigh()) .setParentId(spanId.getLow())); } return builder.build(); }
throws IOException { jgen.writeStartObject(); if (span.getSpanId().isValid()) { jgen.writeStringField("a", span.getSpanId().toString());
@Test(timeout=60000) public void testRootSpansHaveNonZeroSpanId() throws Exception { Tracer tracer = new Tracer.Builder(). name("testRootSpansHaveNonZeroSpanId"). tracerPool(new TracerPool("testRootSpansHaveNonZeroSpanId")). conf(HTraceConfiguration.fromKeyValuePairs( "sampler.classes", "AlwaysSampler")).build(); TraceScope scope = tracer. newScope("myRootSpan", new SpanId(100L, 200L)); Assert.assertNotNull(scope); Assert.assertEquals("myRootSpan", scope.getSpan().getDescription()); Assert.assertTrue(scope.getSpan().getSpanId().isValid()); Assert.assertEquals(100L, scope.getSpan().getSpanId().getHigh()); Assert.assertNotEquals(0L, scope.getSpan().getSpanId().getLow()); scope.close(); } }