- java.lang.Object
-
- de.codecamp.tracer.impl.NoOpTraceContext
-
- All Implemented Interfaces:
TraceContext,AutoCloseable
public class NoOpTraceContext extends Object implements TraceContext
-
-
Field Summary
Fields Modifier and Type Field Description static TraceContextINSTANCE
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Closes this trace context.ActiveTracegetActiveTrace()Returns the deepest currently active trace of the current context or a no-op dummy if none is available.UUIDgetId()booleanisRootContext()Trace contexts can be nested.voidsetExitThrowable(Throwable exitThrowable)Setting a throwable indicates that the trace context hasn't exited regularly.ActiveTracestartTrace(String label, Object... labelFormatArgs)Starts a new sub-trace within this trace context.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface de.codecamp.tracer.TraceContext
startTrace
-
-
-
-
Field Detail
-
INSTANCE
public static final TraceContext INSTANCE
-
-
Method Detail
-
getId
public UUID getId()
- Specified by:
getIdin interfaceTraceContext
-
isRootContext
public boolean isRootContext()
Description copied from interface:TraceContextTrace contexts can be nested. This method returns whether this is the root context.- Specified by:
isRootContextin interfaceTraceContext- Returns:
- whether this is the root context
-
setExitThrowable
public void setExitThrowable(Throwable exitThrowable)
Description copied from interface:TraceContextSetting a throwable indicates that the trace context hasn't exited regularly. As a consequence, durations can't necessarily be compared to other traces.- Specified by:
setExitThrowablein interfaceTraceContext- Parameters:
exitThrowable- the throwable that exited the trace
-
startTrace
public ActiveTrace startTrace(String label, Object... labelFormatArgs)
Description copied from interface:TraceContextStarts a new sub-trace within this trace context. Ends the currently active trace of this trace context, if there is one.v *
- Specified by:
startTracein interfaceTraceContext- Parameters:
label- the label to use for this trace; may contain placeholderslabelFormatArgs- the format arguments for the placeholders in the label- Returns:
- an
ActiveTracethat can be used in a try-with-resource
-
getActiveTrace
public ActiveTrace getActiveTrace()
Description copied from interface:TraceContextReturns the deepest currently active trace of the current context or a no-op dummy if none is available.- Specified by:
getActiveTracein interfaceTraceContext- Returns:
- the deepest currently active trace of the current context or a no-op dummy if none is available.
-
close
public void close()
Description copied from interface:TraceContextCloses this trace context. Closing a trace context is the responsibility of the one opening it.Overridden from
AutoCloseable.close()to remove thrownException.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceTraceContext
-
-