@Override public void receiveSpan(Span s) { if (s.getStopTimeMillis() - s.getStartTimeMillis() < minSpanSize) { return; } Map<String,String> data = convertToStrings(s.getKVAnnotations()); SpanKey dest = getSpanKey(data); if (dest != null) { List<Annotation> annotations = convertToAnnotations(s.getTimelineAnnotations()); if (sendQueueSize.get() > maxQueueSize) { long now = System.currentTimeMillis(); if (now - lastNotificationOfDroppedSpans > 60 * 1000) { log.warn("Tracing spans are being dropped because there are already" + " {} spans queued for delivery.\n" + "This does not affect performance, security or data integrity," + " but distributed tracing information is being lost.", maxQueueSize); lastNotificationOfDroppedSpans = now; } return; } sendQueue.add(new RemoteSpan(host, service == null ? s.getProcessId() : service, s.getTraceId(), s.getSpanId(), s.getParentId(), s.getStartTimeMillis(), s.getStopTimeMillis(), s.getDescription(), data, annotations)); sendQueueSize.incrementAndGet(); } }
public List<Span> find(String processId) { List<Span> spans = new ArrayList<Span>(); Span span = new MilliSpan("", Long.MIN_VALUE, Long.MIN_VALUE, Long.MIN_VALUE, processId); while (true) { span = treeSet.higher(span); if (span == null) { break; } if (span.getProcessId().equals(processId)) { break; } spans.add(span); } return spans; }
@Override public int compare(Span a, Span b) { int cmp = a.getProcessId().compareTo(b.getProcessId()); if (cmp != 0) { return cmp; } else if (a.getSpanId() < b.getSpanId()) { return -1; } else if (a.getSpanId() > b.getSpanId()) { return 1; } else { return 0; } } };
@Override public void receiveSpan(Span s) { if (s.getStopTimeMillis() - s.getStartTimeMillis() < minSpanSize) { return; } Map<String,String> data = convertToStrings(s.getKVAnnotations()); SpanKey dest = getSpanKey(data); if (dest != null) { List<Annotation> annotations = convertToAnnotations(s.getTimelineAnnotations()); if (sendQueueSize.get() > maxQueueSize) { long now = System.currentTimeMillis(); if (now - lastNotificationOfDroppedSpans > 60 * 1000) { log.warn("Tracing spans are being dropped because there are already " + maxQueueSize + " spans queued for delivery.\n" + "This does not affect performance, security or data integrity," + " but distributed tracing information is being lost."); lastNotificationOfDroppedSpans = now; } return; } sendQueue.add(new RemoteSpan(host, service == null ? s.getProcessId() : service, s.getTraceId(), s.getSpanId(), s.getParentId(), s.getStartTimeMillis(), s.getStopTimeMillis(), s.getDescription(), data, annotations)); sendQueueSize.incrementAndGet(); } }
jgen.writeNumberField("e", span.getStopTimeMillis()); jgen.writeStringField("d", span.getDescription()); jgen.writeStringField("r", span.getProcessId()); jgen.writeArrayFieldStart("p"); if (span.getParentId() != ROOT_SPAN_ID) {