Skip to content

Commit

Permalink
Merge pull request #10 from jforest/fix_panic_inconsistent_label_card…
Browse files Browse the repository at this point in the history
…inality

set the labelValues to an array of one element, stage
  • Loading branch information
discordianfish authored Nov 4, 2016
2 parents af04528 + 6f693c0 commit 1b2a3d1
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions nginx_exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,10 @@ func NewExporter(uri string) *Exporter {
Help: "Number of errors while scraping nginx.",
}),
processedConnections: prometheus.NewDesc(
prometheus.BuildFQName(namespace, "", "connections_processed_total"),
prometheus.BuildFQName(namespace, "", "connections_processed_total"),
"Number of connections processed by nginx",
[]string{"accepted", "handled", "any"},
nil,
[]string{"stage"},
nil,
),
currentConnections: prometheus.NewGaugeVec(prometheus.GaugeOpts{
Namespace: namespace,
Expand Down Expand Up @@ -116,17 +116,17 @@ func (e *Exporter) collect(ch chan<- prometheus.Metric) error {
if err != nil {
return err
}
ch <- prometheus.MustNewConstMetric(e.processedConnections, prometheus.CounterValue, float64(v), "accepted")
ch <- prometheus.MustNewConstMetric(e.processedConnections, prometheus.CounterValue, float64(v), "accepted")
v, err = strconv.Atoi(strings.TrimSpace(parts[1]))
if err != nil {
return err
}
ch <- prometheus.MustNewConstMetric(e.processedConnections, prometheus.CounterValue, float64(v), "handled")
ch <- prometheus.MustNewConstMetric(e.processedConnections, prometheus.CounterValue, float64(v), "handled")
v, err = strconv.Atoi(strings.TrimSpace(parts[2]))
if err != nil {
return err
}
ch <- prometheus.MustNewConstMetric(e.processedConnections, prometheus.CounterValue, float64(v), "any")
ch <- prometheus.MustNewConstMetric(e.processedConnections, prometheus.CounterValue, float64(v), "any")

// current connections
parts = strings.Fields(lines[3])
Expand Down

0 comments on commit 1b2a3d1

Please sign in to comment.