github.com/xmidt-org/webpa-common@v1.11.9/device/rehasher/metrics.go (about)

     1  package rehasher
     2  
     3  import (
     4  	"github.com/xmidt-org/webpa-common/service"
     5  	"github.com/xmidt-org/webpa-common/xmetrics"
     6  )
     7  
     8  const (
     9  	RehashKeepDevice           = "rehash_keep_device"
    10  	RehashDisconnectDevice     = "rehash_disconnect_device"
    11  	RehashDisconnectAllCounter = "rehash_disconnect_all_count"
    12  	RehashTimestamp            = "rehash_timestamp"
    13  	RehashDurationMilliseconds = "rehash_duration_ms"
    14  
    15  	ReasonLabel = "reason"
    16  
    17  	DisconnectAllServiceDiscoveryError       = "sd_error"
    18  	DisconnectAllServiceDiscoveryStopped     = "sd_stopped"
    19  	DisconnectAllServiceDiscoveryNoInstances = "sd_no_instances"
    20  )
    21  
    22  // Metrics is the device module function that adds default device metrics
    23  func Metrics() []xmetrics.Metric {
    24  	return []xmetrics.Metric{
    25  		{
    26  			Name:       RehashKeepDevice,
    27  			Type:       "gauge",
    28  			LabelNames: []string{service.ServiceLabel},
    29  		},
    30  		{
    31  			Name:       RehashDisconnectDevice,
    32  			Type:       "gauge",
    33  			LabelNames: []string{service.ServiceLabel},
    34  		},
    35  		{
    36  			Name:       RehashDisconnectAllCounter,
    37  			Type:       "counter",
    38  			LabelNames: []string{service.ServiceLabel, ReasonLabel},
    39  		},
    40  		{
    41  			Name:       RehashTimestamp,
    42  			Type:       "gauge",
    43  			LabelNames: []string{service.ServiceLabel},
    44  		},
    45  		{
    46  			Name:       RehashDurationMilliseconds,
    47  			Type:       "gauge",
    48  			LabelNames: []string{service.ServiceLabel},
    49  		},
    50  	}
    51  }