public SpanEntry map()

in geronimo-microprofile-reporter/src/main/java/org/apache/geronimo/microprofile/reporter/storage/plugins/tracing/SpanMapper.java [76:106]


    public SpanEntry map(final Span span) {
        if (!active) {
            return null;
        }
        try {
            final Collection<SpanEntry.LogEntry> logs = ofNullable((Collection<?>) getLogs.invoke(span))
                    .map(it -> it.stream().map(log -> {
                        try {
                            return new SpanEntry.LogEntry(Long.class.cast(logGetTimestampMicros.invoke(log)), Map.class.cast(logGetFields.invoke(log)));
                        } catch (final IllegalAccessException e) {
                            throw new IllegalStateException(e);
                        } catch (final InvocationTargetException e) {
                            throw new IllegalStateException(e.getTargetException());
                        }
                    }).collect(toList()))
                    .orElseGet(Collections::emptyList);
            return new SpanEntry(
                    stringify(getSpanId.invoke(span)),
                    stringify(getTraceId.invoke(span)),
                    stringify(getParentId.invoke(span)),
                    stringify(getName.invoke(span)),
                    Long.class.cast(getTimestamp.invoke(span)),
                    Long.class.cast(getDuration.invoke(span)),
                    stringify(getKind.invoke(span)),
                    Map.class.cast(getTags.invoke(span)), logs);
        } catch (final IllegalAccessException e) {
            throw new IllegalStateException(e);
        } catch (final InvocationTargetException e) {
            throw new IllegalStateException(e.getTargetException());
        }
    }