github.com/dims/containerd@v0.2.5/supervisor/metrics.go (about)

     1  package supervisor
     2  
     3  import "github.com/rcrowley/go-metrics"
     4  
     5  var (
     6  	// ContainerCreateTimer holds the metrics timer associated with container creation
     7  	ContainerCreateTimer = metrics.NewTimer()
     8  	// ContainerDeleteTimer holds the metrics timer associated with container deletion
     9  	ContainerDeleteTimer = metrics.NewTimer()
    10  	// ContainerStartTimer holds the metrics timer associated with container start duration
    11  	ContainerStartTimer = metrics.NewTimer()
    12  	// ContainerStatsTimer holds the metrics timer associated with container stats generation
    13  	ContainerStatsTimer = metrics.NewTimer()
    14  	// ContainersCounter keeps track of the number of active containers
    15  	ContainersCounter = metrics.NewCounter()
    16  	// EventSubscriberCounter keeps track of the number of active event subscribers
    17  	EventSubscriberCounter = metrics.NewCounter()
    18  	// TasksCounter keeps track of the number of active supervisor tasks
    19  	TasksCounter = metrics.NewCounter()
    20  	// ExecProcessTimer holds the metrics timer associated with container exec
    21  	ExecProcessTimer = metrics.NewTimer()
    22  	// ExitProcessTimer holds the metrics timer associated with reporting container exit status
    23  	ExitProcessTimer = metrics.NewTimer()
    24  	// EpollFdCounter keeps trac of how many process are being monitored
    25  	EpollFdCounter = metrics.NewCounter()
    26  )
    27  
    28  // Metrics return the list of all available metrics
    29  func Metrics() map[string]interface{} {
    30  	return map[string]interface{}{
    31  		"container-create-time": ContainerCreateTimer,
    32  		"container-delete-time": ContainerDeleteTimer,
    33  		"container-start-time":  ContainerStartTimer,
    34  		"container-stats-time":  ContainerStatsTimer,
    35  		"containers":            ContainersCounter,
    36  		"event-subscribers":     EventSubscriberCounter,
    37  		"tasks":                 TasksCounter,
    38  		"exec-process-time":     ExecProcessTimer,
    39  		"exit-process-time":     ExitProcessTimer,
    40  		"epoll-fds":             EpollFdCounter,
    41  	}
    42  }