use of org.apache.skywalking.apm.collector.analysis.segment.parser.define.decorator.SegmentDecorator in project incubator-skywalking by apache.
the class SegmentParse method parse.
@GraphComputingMetric(name = "/segment/parse")
public boolean parse(UpstreamSegment segment, ISegmentParseService.Source source) {
createSpanListeners();
try {
List<UniqueId> traceIds = segment.getGlobalTraceIdsList();
TraceSegmentObject segmentObject = TraceSegmentObject.parseFrom(segment.getSegment());
SegmentDecorator segmentDecorator = new SegmentDecorator(segmentObject);
if (!preBuild(traceIds, segmentDecorator)) {
logger.debug("This segment id exchange not success, write to buffer file, id: {}", segmentId);
if (source.equals(ISegmentParseService.Source.Agent)) {
writeToBufferFile(segmentId, segment);
}
return false;
} else {
logger.debug("This segment id exchange success, id: {}", segmentId);
notifyListenerToBuild();
buildSegment(segmentId, segmentDecorator.toByteArray());
return true;
}
} catch (InvalidProtocolBufferException e) {
logger.error(e.getMessage(), e);
}
return false;
}
Aggregations