Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • gitlab-org/build/omnibus-mirror/node_exporter
1 result
Show changes
Commits on Source (2)
Loading
Loading
@@ -59,7 +59,7 @@ func (c *netDevCollector) Update(ch chan<- prometheus.Metric) error {
desc, ok := c.metricDescs[key]
if !ok {
desc = prometheus.NewDesc(
prometheus.BuildFQName(namespace, c.subsystem, key),
prometheus.BuildFQName(namespace, c.subsystem, key + "_total"),
fmt.Sprintf("Network device statistic %s.", key),
[]string{"device"},
nil,
Loading
Loading
@@ -70,7 +70,7 @@ func (c *netDevCollector) Update(ch chan<- prometheus.Metric) error {
if err != nil {
return fmt.Errorf("invalid value %s in netstats: %s", value, err)
}
ch <- prometheus.MustNewConstMetric(desc, prometheus.GaugeValue, v, dev)
ch <- prometheus.MustNewConstMetric(desc, prometheus.CounterValue, v, dev)
}
}
return nil
Loading
Loading
Loading
Loading
@@ -22,6 +22,7 @@ import (
"path/filepath"
"sort"
"strings"
"sync"
"time"
 
"github.com/golang/protobuf/proto"
Loading
Loading
@@ -34,6 +35,7 @@ import (
 
var (
textFileDirectory = kingpin.Flag("collector.textfile.directory", "Directory to read text files with metrics from.").Default("").String()
textFileAddOnce sync.Once
)
 
type textFileCollector struct {
Loading
Loading
@@ -56,10 +58,12 @@ func NewTextFileCollector() (Collector, error) {
// the flag is not passed.
log.Infof("No directory specified, see --collector.textfile.directory")
} else {
prometheus.DefaultGatherer = prometheus.Gatherers{
prometheus.DefaultGatherer,
prometheus.GathererFunc(func() ([]*dto.MetricFamily, error) { return c.parseTextFiles(), nil }),
}
textFileAddOnce.Do(func() {
prometheus.DefaultGatherer = prometheus.Gatherers{
prometheus.DefaultGatherer,
prometheus.GathererFunc(func() ([]*dto.MetricFamily, error) { return c.parseTextFiles(), nil }),
}
})
}
 
return c, nil
Loading
Loading