Search in sources :

Example 1 with Annotation

use of org.apache.accumulo.tracer.thrift.Annotation in project accumulo by apache.

the class TracesResource method addTraceInformation.

private static TraceInformation addTraceInformation(int level, RemoteSpan node, long finalStart) {
    boolean hasData = node.data != null && !node.data.isEmpty();
    boolean hasAnnotations = node.annotations != null && !node.annotations.isEmpty();
    AddlInformation addlData = new AddlInformation();
    if (hasData || hasAnnotations) {
        if (hasData) {
            for (Entry<String, String> entry : node.data.entrySet()) {
                DataInformation data = new DataInformation(entry.getKey(), entry.getValue());
                addlData.addData(data);
            }
        }
        if (hasAnnotations) {
            for (Annotation entry : node.annotations) {
                AnnotationInformation annotations = new AnnotationInformation(entry.getMsg(), entry.getTime() - finalStart);
                addlData.addAnnotations(annotations);
            }
        }
    }
    return new TraceInformation(level, node.stop - node.start, node.start - finalStart, node.spanId, node.svc + "@" + node.sender, node.description, addlData);
}
Also used : Annotation(org.apache.accumulo.tracer.thrift.Annotation)

Example 2 with Annotation

use of org.apache.accumulo.tracer.thrift.Annotation in project accumulo by apache.

the class AsyncSpanReceiver method receiveSpan.

@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();
    }
}
Also used : RemoteSpan(org.apache.accumulo.tracer.thrift.RemoteSpan) TimelineAnnotation(org.apache.htrace.TimelineAnnotation) Annotation(org.apache.accumulo.tracer.thrift.Annotation)

Example 3 with Annotation

use of org.apache.accumulo.tracer.thrift.Annotation in project accumulo by apache.

the class TraceFormatter method next.

@Override
public String next() {
    Entry<Key, Value> next = scanner.next();
    if (next.getKey().getColumnFamily().equals(SPAN_CF)) {
        StringBuilder result = new StringBuilder();
        SimpleDateFormat dateFormatter = new SimpleDateFormat(DATE_FORMAT);
        RemoteSpan span = getRemoteSpan(next);
        result.append("----------------------\n");
        result.append(String.format(" %12s:%s%n", "name", span.description));
        result.append(String.format(" %12s:%s%n", "trace", Long.toHexString(span.traceId)));
        result.append(String.format(" %12s:%s%n", "loc", span.svc + "@" + span.sender));
        result.append(String.format(" %12s:%s%n", "span", Long.toHexString(span.spanId)));
        result.append(String.format(" %12s:%s%n", "parent", Long.toHexString(span.parentId)));
        result.append(String.format(" %12s:%s%n", "start", dateFormatter.format(span.start)));
        result.append(String.format(" %12s:%s%n", "ms", span.stop - span.start));
        if (span.data != null) {
            for (Entry<String, String> entry : span.data.entrySet()) {
                result.append(String.format(" %12s:%s%n", entry.getKey(), entry.getValue()));
            }
        }
        if (span.annotations != null) {
            for (Annotation annotation : span.annotations) {
                result.append(String.format(" %12s:%s:%s%n", "annotation", annotation.getMsg(), dateFormatter.format(annotation.getTime())));
            }
        }
        if (config.willPrintTimestamps()) {
            result.append(String.format(" %-12s:%d%n", "timestamp", next.getKey().getTimestamp()));
        }
        return result.toString();
    }
    return DefaultFormatter.formatEntry(next, config.willPrintTimestamps());
}
Also used : RemoteSpan(org.apache.accumulo.tracer.thrift.RemoteSpan) Value(org.apache.accumulo.core.data.Value) SimpleDateFormat(java.text.SimpleDateFormat) Key(org.apache.accumulo.core.data.Key) Annotation(org.apache.accumulo.tracer.thrift.Annotation)

Aggregations

Annotation (org.apache.accumulo.tracer.thrift.Annotation)3 RemoteSpan (org.apache.accumulo.tracer.thrift.RemoteSpan)2 SimpleDateFormat (java.text.SimpleDateFormat)1 Key (org.apache.accumulo.core.data.Key)1 Value (org.apache.accumulo.core.data.Value)1 TimelineAnnotation (org.apache.htrace.TimelineAnnotation)1