Search in sources :

Example 1 with StringAnyValueMarshaler

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());
}
Also used : SpanContext(io.opentelemetry.api.trace.SpanContext) StringAnyValueMarshaler(io.opentelemetry.exporter.internal.otlp.StringAnyValueMarshaler) KeyValueMarshaler(io.opentelemetry.exporter.internal.otlp.KeyValueMarshaler)

Aggregations

SpanContext (io.opentelemetry.api.trace.SpanContext)1 KeyValueMarshaler (io.opentelemetry.exporter.internal.otlp.KeyValueMarshaler)1 StringAnyValueMarshaler (io.opentelemetry.exporter.internal.otlp.StringAnyValueMarshaler)1