Dynamic variable (thread-local) which allows metrics to be recorded for the current thread.
Dynamic variable (thread-local) which allows metrics to be recorded for the current thread. Note that this will be set to None if metrics have not been initialized for the current thread, so callers should deal with this appropriately (normally by avoiding recording any metrics or propagating the recorder to other threads).
Generates a new sequence ID for operations that we wish to appear in sequence
Starts recording metrics for this thread.
Starts recording metrics for this thread. Any previously-recorded metrics for this thread will be cleared. This method must always be called before recording metrics.
Returns true
if metrics are being recorded for the current thread, or false
otherwise
Prints the metrics recorded by this instance to the specified PrintWriter, using the specified SparkMetrics to print details of any Spark operations that have occurred.
Stops recording metrics for the current thread.
Stops recording metrics for the current thread. This avoids the (slight) overhead of recording metrics
if they are not going to be used. Calling the print
method after calling this one will result in an
IllegalStateException.
Manages recording of metrics in an application. Metrics collection is turned on for a particular thread by calling the
initialize
method. Afterinitialize
is called the Metrics.Recorder field is set, and the application can use that to record metrics. To print metrics, call theprint
method, and to stop recording metrics for a particular thread, call thestopRecording
method.If an application does not want to record metrics, it can simply avoid calling the
initialize
method (or can call thestopRecording
method if there is a chance thatinitialize
has been called on that thread previously). Attempting to record metrics when the initialize method has not been called will not produce an error, and incurs very little overhead. However, attempting to call the print method to print the metrics will produce an error.