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

network.oxalis.ng.commons.tracing.SpanManager Maven / Gradle / Ivy

Go to download

Holds the stuff which is common for both inbound and outbound messages and should be shared between them.

There is a newer version: 1.0.0
Show newest version
package network.oxalis.ng.commons.tracing;

import io.opentelemetry.api.trace.Span;
import network.oxalis.ng.commons.util.ClosableSpan;

import java.util.function.Consumer;
import java.util.function.Function;
import java.util.function.Supplier;

public interface SpanManager {

     T runWithinSpan(String spanName, Function function);

    default  T runWithinSpan(String spanName, Supplier function) {
        return runWithinSpan(spanName, span -> {
            return function.get();
        });
    }

    default void runWithinSpan(String spanName, Consumer function) {
        runWithinSpan(spanName, span -> {
            function.accept(span);
            return null;
        });
    }

    ClosableSpan startClosableSpan(String spanName);

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy