use of org.apache.skywalking.apm.agent.core.context.ids.DistributedTraceId in project incubator-skywalking by apache.
the class TraceSegment method transform.
/**
* This is a high CPU cost method, only called when sending to collector or test cases.
*
* @return the segment as GRPC service parameter
*/
public UpstreamSegment transform() {
UpstreamSegment.Builder upstreamBuilder = UpstreamSegment.newBuilder();
for (DistributedTraceId distributedTraceId : getRelatedGlobalTraces()) {
upstreamBuilder = upstreamBuilder.addGlobalTraceIds(distributedTraceId.toUniqueId());
}
TraceSegmentObject.Builder traceSegmentBuilder = TraceSegmentObject.newBuilder();
/**
* Trace Segment
*/
traceSegmentBuilder.setTraceSegmentId(this.traceSegmentId.transform());
// SpanObject
for (AbstractTracingSpan span : this.spans) {
traceSegmentBuilder.addSpans(span.transform());
}
traceSegmentBuilder.setApplicationId(RemoteDownstreamConfig.Agent.APPLICATION_ID);
traceSegmentBuilder.setApplicationInstanceId(RemoteDownstreamConfig.Agent.APPLICATION_INSTANCE_ID);
traceSegmentBuilder.setIsSizeLimited(this.isSizeLimited);
upstreamBuilder.setSegment(traceSegmentBuilder.build().toByteString());
return upstreamBuilder.build();
}
Aggregations