Map<byte[], byte[]> annotations = span.getKVAnnotations(); for (Map.Entry<byte[], byte[]> annotation : annotations.entrySet()) { Pair<String, String> val =
@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(); } }
/** * @param spans * @param trace */ private void validateTrace(List<Span> spans, TraceHolder trace) { // drop each span into a sorted list so we get the expected ordering Iterator<SpanInfo> spanIter = trace.spans.iterator(); for (Span span : spans) { SpanInfo spanInfo = spanIter.next(); LOG.info("Checking span:\n" + spanInfo); long parentId = span.getParentId(); if(parentId == Span.ROOT_SPAN_ID) { assertNull("Got a parent, but it was a root span!", spanInfo.parent); } else { assertEquals("Got an unexpected parent span id", parentId, spanInfo.parent.id); } assertEquals("Got an unexpected start time", span.getStartTimeMillis(), spanInfo.start); assertEquals("Got an unexpected end time", span.getStopTimeMillis(), spanInfo.end); int annotationCount = 0; for(Map.Entry<byte[], byte[]> entry : span.getKVAnnotations().entrySet()) { int count = annotationCount++; assertEquals("Didn't get expected annotation", count + " - " + Bytes.toString(entry.getValue()), spanInfo.annotations.get(count)); } assertEquals("Didn't get expected number of annotations", annotationCount, spanInfo.annotationCount); } }
@Override public Map<String,String> getData() { Map<byte[],byte[]> data = span.getKVAnnotations(); HashMap<String,String> stringData = new HashMap<>(); for (Entry<byte[],byte[]> d : data.entrySet()) { stringData.put(new String(d.getKey(), UTF_8), new String(d.getValue(), UTF_8)); } return stringData; } }
Map<byte[], byte[]> annotations = span.getKVAnnotations(); for (Map.Entry<byte[], byte[]> annotation : annotations.entrySet()) { Pair<String, String> val =
Map<byte[], byte[]> annotations = span.getKVAnnotations(); for (Map.Entry<byte[], byte[]> annotation : annotations.entrySet()) { Pair<String, String> val =
@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(); } }
Map<byte[], byte[]> traceInfoMap = span.getKVAnnotations(); if (!traceInfoMap.isEmpty()) { jgen.writeObjectFieldStart("n");