File tree Expand file tree Collapse file tree 5 files changed +4
-14
lines changed Expand file tree Collapse file tree 5 files changed +4
-14
lines changed Original file line number Diff line number Diff line change @@ -48,7 +48,7 @@ func bytesToString(byteArray []byte) string {
4848
4949var metricNameRegex = regexp .MustCompile (`_*[^0-9A-Za-z_]+_*` )
5050
51- // Sanitize the given metric name by replacing invalid characters by underscores.
51+ // SanitizeMetricName sanitize the given metric name by replacing invalid characters by underscores.
5252//
5353// OpenMetrics and the Prometheus exposition format require the metric name
5454// to consist only of alphanumericals and "_", ":" and they must not start
Original file line number Diff line number Diff line change @@ -49,7 +49,7 @@ func (c *lnstatCollector) Update(ch chan<- prometheus.Metric) error {
4949
5050 netStats , err := fs .NetStat ()
5151 if err != nil {
52- return fmt .Errorf ("Lnstat error: %s" , err )
52+ return fmt .Errorf ("lnstat error: %s" , err )
5353 }
5454
5555 for _ , netStatFile := range netStats {
Original file line number Diff line number Diff line change @@ -50,7 +50,7 @@ func perfTracepointFlagToTracepoints(tracepointsFlag []string) ([]*perfTracepoin
5050 for i , tracepoint := range tracepointsFlag {
5151 split := strings .Split (tracepoint , ":" )
5252 if len (split ) != 2 {
53- return nil , fmt .Errorf ("Invalid tracepoint config %v" , tracepoint )
53+ return nil , fmt .Errorf ("invalid tracepoint config %v" , tracepoint )
5454 }
5555 tracepoints [i ] = & perfTracepoint {
5656 subsystem : split [0 ],
@@ -598,9 +598,6 @@ func (c *perfCollector) updateHardwareStats(ch chan<- prometheus.Metric) error {
598598 if err := (* profiler ).Profile (hwProfile ); err != nil {
599599 return err
600600 }
601- if hwProfile == nil {
602- continue
603- }
604601
605602 cpuid := strconv .Itoa (c .hwProfilerCPUMap [profiler ])
606603
@@ -670,9 +667,6 @@ func (c *perfCollector) updateSoftwareStats(ch chan<- prometheus.Metric) error {
670667 if err := (* profiler ).Profile (swProfile ); err != nil {
671668 return err
672669 }
673- if swProfile == nil {
674- continue
675- }
676670
677671 cpuid := strconv .Itoa (c .swProfilerCPUMap [profiler ])
678672
@@ -726,9 +720,6 @@ func (c *perfCollector) updateCacheStats(ch chan<- prometheus.Metric) error {
726720 if err := (* profiler ).Profile (cacheProfile ); err != nil {
727721 return err
728722 }
729- if cacheProfile == nil {
730- continue
731- }
732723
733724 cpuid := strconv .Itoa (c .cacheProfilerCPUMap [profiler ])
734725
Original file line number Diff line number Diff line change @@ -74,7 +74,6 @@ type systemdCollector struct {
7474 socketCurrentConnectionsDesc * prometheus.Desc
7575 socketRefusedConnectionsDesc * prometheus.Desc
7676 systemdVersionDesc * prometheus.Desc
77- systemdVersion float64
7877 unitIncludePattern * regexp.Regexp
7978 unitExcludePattern * regexp.Regexp
8079 logger log.Logger
Original file line number Diff line number Diff line change 1414package collector
1515
1616import (
17- "github.com/go-kit/log"
1817 "regexp"
1918 "testing"
2019
2120 "github.com/coreos/go-systemd/dbus"
21+ "github.com/go-kit/log"
2222)
2323
2424// Creates mock UnitLists
You can’t perform that action at this time.
0 commit comments