use of com.uber.jaeger.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;
}
use of com.uber.jaeger.LogData in project jaeger-client-java by jaegertracing.
the class ThriftSpanConverter method buildAnnotations.
private static List<Annotation> buildAnnotations(Span span, Endpoint host) {
List<Annotation> annotations = new ArrayList<Annotation>();
if (isRpc(span)) {
String startLabel = zipkincoreConstants.SERVER_RECV;
String endLabel = zipkincoreConstants.SERVER_SEND;
if (isRpcClient(span)) {
startLabel = zipkincoreConstants.CLIENT_SEND;
endLabel = zipkincoreConstants.CLIENT_RECV;
}
annotations.add(new Annotation(span.getStart(), startLabel).setHost(host));
annotations.add(new Annotation(span.getStart() + span.getDuration(), endLabel).setHost(host));
}
List<LogData> logs = span.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;
}
Aggregations