use of io.opentelemetry.exporter.internal.otlp.StringAnyValueMarshaler in project opentelemetry-java by open-telemetry.
the class LogMarshaler method create.
// name field to be removed
@SuppressWarnings("deprecation")
static LogMarshaler create(io.opentelemetry.sdk.logs.data.LogData logData) {
KeyValueMarshaler[] attributeMarshalers = KeyValueMarshaler.createRepeated(logData.getAttributes());
// For now, map all the bodies to String AnyValue.
StringAnyValueMarshaler anyValueMarshaler = new StringAnyValueMarshaler(MarshalerUtil.toBytes(logData.getBody().asString()));
SpanContext spanContext = logData.getSpanContext();
return new LogMarshaler(logData.getEpochNanos(), toProtoSeverityNumber(logData.getSeverity()), MarshalerUtil.toBytes(logData.getSeverityText()), MarshalerUtil.toBytes(logData.getName()), anyValueMarshaler, attributeMarshalers, // TODO (trask) implement droppedAttributesCount in LogRecord
0, spanContext.getTraceFlags(), spanContext.getTraceId().equals(INVALID_TRACE_ID) ? null : spanContext.getTraceId(), spanContext.getSpanId().equals(INVALID_SPAN_ID) ? null : spanContext.getSpanId());
}
Aggregations