fix: changed label name, added documentation

Signed-off-by: paologallinaharbur <paologallina1992@gmail.com>
This commit is contained in:
paologallinaharbur 2020-05-29 11:14:23 +02:00
parent a4f815b5fd
commit dd6bfbe963
1 changed files with 4 additions and 4 deletions

View File

@ -45,7 +45,7 @@ func NewserviceCollector() (Collector, error) {
Information: prometheus.NewDesc( Information: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "info"), prometheus.BuildFQName(Namespace, subsystem, "info"),
"A metric with a constant '1' value labeled with service information", "A metric with a constant '1' value labeled with service information",
[]string{"name", "display_name", "process_id", "start_name"}, []string{"name", "display_name", "process_id", "run_as"},
nil, nil,
), ),
State: prometheus.NewDesc( State: prometheus.NewDesc(
@ -135,9 +135,9 @@ func (c *serviceCollector) collect(ch chan<- prometheus.Metric) (*prometheus.Des
for _, service := range dst { for _, service := range dst {
pid := strconv.FormatUint(uint64(service.ProcessId), 10) pid := strconv.FormatUint(uint64(service.ProcessId), 10)
startName := "" runAs := ""
if service.StartName != nil { if service.StartName != nil {
startName = *service.StartName runAs = *service.StartName
} }
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.Information, c.Information,
@ -146,7 +146,7 @@ func (c *serviceCollector) collect(ch chan<- prometheus.Metric) (*prometheus.Des
strings.ToLower(service.Name), strings.ToLower(service.Name),
service.DisplayName, service.DisplayName,
pid, pid,
startName, runAs,
) )
for _, state := range allStates { for _, state := range allStates {