Search in sources :

Example 1 with LongExemplarData

use of io.opentelemetry.sdk.metrics.data.LongExemplarData in project opentelemetry-java by open-telemetry.

the class ExemplarMarshaler method create.

private static ExemplarMarshaler create(ExemplarData exemplar) {
    KeyValueMarshaler[] attributeMarshalers = KeyValueMarshaler.createRepeated(exemplar.getFilteredAttributes());
    ProtoFieldInfo valueField;
    if (exemplar instanceof LongExemplarData) {
        valueField = io.opentelemetry.proto.metrics.v1.internal.Exemplar.AS_INT;
    } else {
        assert exemplar instanceof DoubleExemplarData;
        valueField = io.opentelemetry.proto.metrics.v1.internal.Exemplar.AS_DOUBLE;
    }
    return new ExemplarMarshaler(exemplar.getEpochNanos(), exemplar, valueField, exemplar.getSpanContext(), attributeMarshalers);
}
Also used : DoubleExemplarData(io.opentelemetry.sdk.metrics.data.DoubleExemplarData) LongExemplarData(io.opentelemetry.sdk.metrics.data.LongExemplarData) KeyValueMarshaler(io.opentelemetry.exporter.internal.otlp.KeyValueMarshaler) ProtoFieldInfo(io.opentelemetry.exporter.internal.marshal.ProtoFieldInfo)

Aggregations

ProtoFieldInfo (io.opentelemetry.exporter.internal.marshal.ProtoFieldInfo)1 KeyValueMarshaler (io.opentelemetry.exporter.internal.otlp.KeyValueMarshaler)1 DoubleExemplarData (io.opentelemetry.sdk.metrics.data.DoubleExemplarData)1 LongExemplarData (io.opentelemetry.sdk.metrics.data.LongExemplarData)1