All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.quarkiverse.reactive.messaging.nats.jetstream.tracing.JetStreamTraceTextMapGetter Maven / Gradle / Ivy

There is a newer version: 3.17.0
Show newest version
package io.quarkiverse.reactive.messaging.nats.jetstream.tracing;

import java.util.Collections;

import jakarta.annotation.Nullable;

import io.opentelemetry.context.propagation.TextMapGetter;

public enum JetStreamTraceTextMapGetter implements TextMapGetter {
    INSTANCE;

    @Override
    public Iterable keys(JetStreamTrace carrier) {
        final var headers = carrier.headers();
        if (headers != null) {
            return headers.keySet();
        }
        return Collections.emptyList();
    }

    @Override
    public String get(@Nullable JetStreamTrace carrier, String key) {
        if (carrier != null) {
            final var headers = carrier.headers();
            if (headers != null) {
                final var value = headers.get(key);
                if (value != null) {
                    return String.join(",", value);
                }
            }
        }
        return null;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy