Documentation ¶
Overview ¶
Package metrics provides a way to record metrics.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // Downloads metrics Downloads struct { // InitTime is the time taken to initiate a download. InitTime metric.Float64Histogram // CompletionTime is the time taken to complete a download. CompletionTime metric.Float64Histogram // Errors is the number of errors during downloads. Errors metric.Int64Counter // Runs is the number of downloads. Runs metric.Int64Counter } // Concat metrics Concat struct { // CompletionTime is the time taken to complete a concat. CompletionTime metric.Float64Histogram // Errors is the accumulated failed runs of concats. Errors metric.Int64Counter // Runs is the number of concats. Runs metric.Int64Counter } // PostProcessing metrics PostProcessing struct { // CompletionTime is the time taken to complete a post process. CompletionTime metric.Float64Histogram // Errors is the accumulated failed runs of post processes. Errors metric.Int64Counter // Runs is the number of post processes. Runs metric.Int64Counter } // Watcher metrics Watcher struct { // State is the current state of the watcher. State metric.Int64Gauge } // Cleaner metrics Cleaner struct { // FilesRemoved is the number of files removed. FilesRemoved metric.Int64Counter // Errors is the number of errors during cleaning. Errors metric.Int64Counter // Runs is the number of cleaning runs. Runs metric.Int64Counter // CleanTime is the time taken to clean. CleanTime metric.Float64Histogram } )
Functions ¶
func TimeEndRecording ¶
func TimeEndRecording( ctx context.Context, m metric.Float64Histogram, id string, opts ...metric.RecordOption, )
TimeEndRecording records the elapsed time since the corresponding call to TimeStartRecordingDeferred.
func TimeStartRecording ¶
func TimeStartRecording( ctx context.Context, m metric.Float64Histogram, unit time.Duration, opts ...metric.RecordOption, ) func()
TimeStartRecording starts a timer and returns a function that records the elapsed time to the given histogram metric when called.
func TimeStartRecordingDeferred ¶
func TimeStartRecordingDeferred(id string)
TimeStartRecordingDeferred starts a timer and stores the start time in a map. The caller is responsible for calling TimeEndRecording with the same id to record the elapsed time.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.