Package org.apache.hadoop.hbase.trace
Class TraceUtil
java.lang.Object
org.apache.hadoop.hbase.trace.TraceUtil
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceTraceUtil.ThrowingCallable<R,T extends Throwable> ACallablethat may also throw.static interfaceTraceUtil.ThrowingRunnable<T extends Throwable>ARunnablethat may also throw. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic io.opentelemetry.api.trace.SpancreateClientSpan(String name) Create a span withSpanKind.CLIENT.static io.opentelemetry.api.trace.SpancreateRemoteSpan(String name, io.opentelemetry.context.Context ctx) Create a span which parent is from remote, i.e, passed through rpc.static io.opentelemetry.api.trace.SpancreateSpan(String name) Create aSpanKind.INTERNALspan.private static io.opentelemetry.api.trace.SpancreateSpan(String name, io.opentelemetry.api.trace.SpanKind kind) Create a span with the givenkind.private static voidendSpan(CompletableFuture<?> future, io.opentelemetry.api.trace.Span span) Finish thespanwhen the givenfutureis completed.static io.opentelemetry.api.trace.Tracerstatic voidstatic <R,T extends Throwable>
Rtrace(TraceUtil.ThrowingCallable<R, T> callable, String spanName) static <R,T extends Throwable>
Rtrace(TraceUtil.ThrowingCallable<R, T> callable, Supplier<io.opentelemetry.api.trace.Span> spanSupplier) static <T extends Throwable>
voidtrace(TraceUtil.ThrowingRunnable<T> runnable, String spanName) Trace the execution ofrunnable.static <T extends Throwable>
voidtrace(TraceUtil.ThrowingRunnable<T> runnable, Supplier<io.opentelemetry.api.trace.Span> spanSupplier) Trace the execution ofrunnable.static <T> CompletableFuture<T>tracedFuture(Supplier<CompletableFuture<T>> action, String spanName) Trace an asynchronous operation.static <T> CompletableFuture<T>tracedFuture(Supplier<CompletableFuture<T>> action, Supplier<io.opentelemetry.api.trace.Span> spanSupplier) Trace an asynchronous operation for a table.static <T> List<CompletableFuture<T>>tracedFutures(Supplier<List<CompletableFuture<T>>> action, Supplier<io.opentelemetry.api.trace.Span> spanSupplier) Trace an asynchronous operation, and finish the createSpanwhen all the givenfuturesare completed.static RunnabletracedRunnable(Runnable runnable, String spanName) Wrap the providedrunnablein aRunnablethat is traced.static RunnabletracedRunnable(Runnable runnable, Supplier<io.opentelemetry.api.trace.Span> spanSupplier) Wrap the providedrunnablein aRunnablethat is traced.
-
Constructor Details
-
TraceUtil
private TraceUtil()
-
-
Method Details
-
getGlobalTracer
-
createSpan
Create aSpanKind.INTERNALspan. -
createSpan
private static io.opentelemetry.api.trace.Span createSpan(String name, io.opentelemetry.api.trace.SpanKind kind) Create a span with the givenkind. Notice that, OpenTelemetry only expects oneSpanKind.CLIENTspan and oneSpanKind.SERVERspan for a traced request, so use this with caution when you want to create spans with kind other thanSpanKind.INTERNAL. -
createRemoteSpan
public static io.opentelemetry.api.trace.Span createRemoteSpan(String name, io.opentelemetry.context.Context ctx) Create a span which parent is from remote, i.e, passed through rpc. We will set the kind of the returned span toSpanKind.SERVER, as this should be the top most span at server side. -
createClientSpan
Create a span withSpanKind.CLIENT. -
tracedFuture
public static <T> CompletableFuture<T> tracedFuture(Supplier<CompletableFuture<T>> action, Supplier<io.opentelemetry.api.trace.Span> spanSupplier) Trace an asynchronous operation for a table. -
tracedFuture
public static <T> CompletableFuture<T> tracedFuture(Supplier<CompletableFuture<T>> action, String spanName) Trace an asynchronous operation. -
tracedFutures
public static <T> List<CompletableFuture<T>> tracedFutures(Supplier<List<CompletableFuture<T>>> action, Supplier<io.opentelemetry.api.trace.Span> spanSupplier) Trace an asynchronous operation, and finish the createSpanwhen all the givenfuturesare completed. -
setError
-
endSpan
Finish thespanwhen the givenfutureis completed. -
tracedRunnable
Wrap the providedrunnablein aRunnablethat is traced. -
tracedRunnable
public static Runnable tracedRunnable(Runnable runnable, Supplier<io.opentelemetry.api.trace.Span> spanSupplier) Wrap the providedrunnablein aRunnablethat is traced. -
trace
public static <T extends Throwable> void trace(TraceUtil.ThrowingRunnable<T> runnable, String spanName) throws T Trace the execution ofrunnable.- Throws:
T extends Throwable
-
trace
public static <T extends Throwable> void trace(TraceUtil.ThrowingRunnable<T> runnable, Supplier<io.opentelemetry.api.trace.Span> spanSupplier) throws T Trace the execution ofrunnable.- Throws:
T extends Throwable
-
trace
public static <R,T extends Throwable> R trace(TraceUtil.ThrowingCallable<R, T> callable, String spanName) throws T- Throws:
T extends Throwable
-
trace
public static <R,T extends Throwable> R trace(TraceUtil.ThrowingCallable<R, T> callable, Supplier<io.opentelemetry.api.trace.Span> spanSupplier) throws T- Throws:
T extends Throwable
-