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

org.zalando.riptide.opentracing.ExplicitSpanLifecycle Maven / Gradle / Ivy

package org.zalando.riptide.opentracing;

import io.opentracing.Span;
import io.opentracing.Tracer;
import lombok.AllArgsConstructor;
import org.apiguardian.api.API;
import org.zalando.riptide.RequestArguments;

import java.util.Optional;

import static org.apiguardian.api.API.Status.EXPERIMENTAL;

/**
 * @see OpenTracingPlugin#SPAN
 */
@API(status = EXPERIMENTAL)
@AllArgsConstructor
public final class ExplicitSpanLifecycle implements Lifecycle {

    @Override
    public Optional start(final Tracer tracer, final RequestArguments arguments) {
        return arguments.getAttribute(OpenTracingPlugin.SPAN)
                // we don't want to finish an explicitly passed span
                .map(NonFinishingSpan::new);
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy