public final class BuckTracing extends Object
Modifier and Type | Class and Description |
---|---|
class |
BuckTracing.TraceSection
An
AutoCloseable that can be used in a try-with-resources block to ensure a trace
section is ended properly when exited. |
Modifier and Type | Method and Description |
---|---|
void |
begin(String eventName)
Records the beginning of a traced section.
|
void |
begin(String eventName,
Map<String,String> args)
Records the beginning of a traced section.
|
static void |
clearCurrentThreadTracingInterfaceFromJsr199Javac()
Used by Buck to disconnect this class from its tracing mechanism.
|
void |
end()
Records the end of the traced section started by the most recent call to
begin(String,
Map) , on any BuckTracing object, on the current thread. |
void |
end(Map<String,String> args)
Records the end of the traced section started by the most recent call to
begin(String,
Map) , on any BuckTracing object, on the current thread. |
static BuckTracing |
getInstance(String pluginName)
Gets an instance of
BuckTracing for tracing in the given plugin. |
static void |
setCurrentThreadTracingInterfaceFromJsr199Javac(BuckTracingInterface buckTracingInterface)
Used by Buck to connect this class to its tracing mechanism.
|
BuckTracing.TraceSection |
traceSection(String eventName) |
BuckTracing.TraceSection |
traceSection(String eventName,
Map<String,String> args)
Records the beginning of a traced section, and returns an object that can be used within a
try-with-resources block to automatically end the section.
|
public static BuckTracing getInstance(String pluginName)
BuckTracing
for tracing in the given plugin. All BuckTracing
instances are backed by the same trace buffer, so begin(String, Map)
and
end(Map)
} calls on a given thread must nest across all instances.public BuckTracing.TraceSection traceSection(String eventName)
public BuckTracing.TraceSection traceSection(String eventName, Map<String,String> args)
public void begin(String eventName)
For best results, this call should be immediately before a try block, and a corresponding
call to end(Map)
should be in the finally block. Consider using traceSection(String)
in a try-with-resources block instead.
public void begin(String eventName, Map<String,String> args)
For best results, this call should be immediately before a try block, and a corresponding
call to end(Map)
should be in the finally block. Consider using traceSection(String, Map)
in a try-with-resources block instead.
public void end()
begin(String,
Map)
, on any BuckTracing
object, on the current thread.
For best results, this call should be in a finally block, with the corresponding begin(String, Map)
call immediately before the try.
public void end(Map<String,String> args)
begin(String,
Map)
, on any BuckTracing
object, on the current thread. Arguments supplied
here will be added to those supplied to begin(String, Map)
; conflicting entries will
be overwritten.
For best results, this call should be in a finally block, with the corresponding begin(String, Map)
call immediately before the try.
public static void setCurrentThreadTracingInterfaceFromJsr199Javac(BuckTracingInterface buckTracingInterface)
public static void clearCurrentThreadTracingInterfaceFromJsr199Javac()