Search in sources :

Example 1 with LogData

use of io.jaegertracing.internal.LogData in project jaeger-client-java by jaegertracing.

the class ThriftSpanConverter method buildAnnotations.

private static List<Annotation> buildAnnotations(JaegerSpan jaegerSpan, Endpoint host) {
    List<Annotation> annotations = new ArrayList<Annotation>();
    if (ConverterUtil.isRpc(jaegerSpan)) {
        String startLabel = zipkincoreConstants.SERVER_RECV;
        String endLabel = zipkincoreConstants.SERVER_SEND;
        if (ConverterUtil.isRpcClient(jaegerSpan)) {
            startLabel = zipkincoreConstants.CLIENT_SEND;
            endLabel = zipkincoreConstants.CLIENT_RECV;
        }
        annotations.add(new Annotation(jaegerSpan.getStart(), startLabel).setHost(host));
        annotations.add(new Annotation(jaegerSpan.getStart() + jaegerSpan.getDuration(), endLabel).setHost(host));
    }
    List<LogData> logs = jaegerSpan.getLogs();
    if (logs != null) {
        for (LogData logData : logs) {
            String logMessage = logData.getMessage();
            Map<String, ?> logFields = logData.getFields();
            if (logMessage != null) {
                annotations.add(new Annotation(logData.getTime(), logMessage));
            } else if (logFields != null) {
                annotations.add(new Annotation(logData.getTime(), gson.toJson(logFields)));
            }
        }
    }
    return annotations;
}
Also used : LogData(io.jaegertracing.internal.LogData) ArrayList(java.util.ArrayList) BinaryAnnotation(com.twitter.zipkin.thriftjava.BinaryAnnotation) Annotation(com.twitter.zipkin.thriftjava.Annotation)

Example 2 with LogData

use of io.jaegertracing.internal.LogData in project jaeger-client-java by jaegertracing.

the class V2SpanConverter method buildAnnotations.

private static void buildAnnotations(JaegerSpan jaegerSpan, zipkin2.Span.Builder builder) {
    List<LogData> logs = jaegerSpan.getLogs();
    if (logs != null) {
        for (LogData logData : logs) {
            String logMessage = logData.getMessage();
            Map<String, ?> logFields = logData.getFields();
            if (logMessage != null) {
                builder.addAnnotation(logData.getTime(), logMessage);
            } else if (logFields != null) {
                builder.addAnnotation(logData.getTime(), gson.toJson(logFields));
            }
        }
    }
}
Also used : LogData(io.jaegertracing.internal.LogData)

Example 3 with LogData

use of io.jaegertracing.internal.LogData in project jaeger-client-java by jaegertracing.

the class JaegerThriftSpanConverter method buildLogs.

static List<Log> buildLogs(List<LogData> logs) {
    List<Log> thriftLogs = new ArrayList<Log>();
    if (logs != null) {
        for (LogData logData : logs) {
            Log thriftLog = new Log();
            thriftLog.setTimestamp(logData.getTime());
            if (logData.getFields() != null) {
                thriftLog.setFields(buildTags(logData.getFields()));
            } else {
                List<Tag> tags = new ArrayList<Tag>();
                if (logData.getMessage() != null) {
                    tags.add(buildTag("event", logData.getMessage()));
                }
                thriftLog.setFields(tags);
            }
            thriftLogs.add(thriftLog);
        }
    }
    return thriftLogs;
}
Also used : LogData(io.jaegertracing.internal.LogData) Log(io.jaegertracing.thriftjava.Log) ArrayList(java.util.ArrayList) Tag(io.jaegertracing.thriftjava.Tag)

Aggregations

LogData (io.jaegertracing.internal.LogData)3 ArrayList (java.util.ArrayList)2 Annotation (com.twitter.zipkin.thriftjava.Annotation)1 BinaryAnnotation (com.twitter.zipkin.thriftjava.BinaryAnnotation)1 Log (io.jaegertracing.thriftjava.Log)1 Tag (io.jaegertracing.thriftjava.Tag)1