Skip to content
Snippets Groups Projects
Commit c714c2fe authored by Matthias Rampke's avatar Matthias Rampke
Browse files

Use per-type label names

avoid the generic "name" label. Breaks all time series.
parent 65d9e1b7
Branches
No related tags found
No related merge requests found
......@@ -31,6 +31,7 @@ func (a *action) toPoints() []*point {
Type: counter,
Value: a.Processed,
Description: "messages processed",
LabelName: "action",
LabelValue: a.Name,
}
......@@ -39,6 +40,7 @@ func (a *action) toPoints() []*point {
Type: counter,
Value: a.Failed,
Description: "messages failed",
LabelName: "action",
LabelValue: a.Name,
}
......@@ -47,6 +49,7 @@ func (a *action) toPoints() []*point {
Type: counter,
Value: a.Suspended,
Description: "times suspended",
LabelName: "action",
LabelValue: a.Name,
}
......@@ -55,6 +58,7 @@ func (a *action) toPoints() []*point {
Type: counter,
Value: a.SuspendedDuration,
Description: "time spent suspended",
LabelName: "action",
LabelValue: a.Name,
}
......@@ -63,6 +67,7 @@ func (a *action) toPoints() []*point {
Type: counter,
Value: a.Resumed,
Description: "times resumed",
LabelName: "action",
LabelValue: a.Name,
}
......
......@@ -27,6 +27,7 @@ func (i *input) toPoints() []*point {
Type: counter,
Value: i.Submitted,
Description: "messages submitted",
LabelName: "input",
LabelValue: i.Name,
}
......
......@@ -24,6 +24,7 @@ type point struct {
Description string
Type pointType
Value int64
LabelName string
LabelValue string
}
......@@ -31,7 +32,7 @@ func (p *point) promDescription() *prometheus.Desc {
return prometheus.NewDesc(
prometheus.BuildFQName("", "rsyslog", p.Name),
p.Description,
[]string{"name"},
[]string{p.promLabelName()},
nil,
)
}
......@@ -51,6 +52,10 @@ func (p *point) promLabelValue() string {
return p.LabelValue
}
func (p *point) promLabelName() string {
return p.LabelName
}
func (p *point) key() string {
return fmt.Sprintf("%s.%s", p.Name, p.LabelValue)
}
......@@ -32,6 +32,7 @@ func (q *queue) toPoints() []*point {
Type: gauge,
Value: q.Size,
Description: "messages currently in queue",
LabelName: "queue",
LabelValue: q.Name,
}
......@@ -40,6 +41,7 @@ func (q *queue) toPoints() []*point {
Type: counter,
Value: q.Enqueued,
Description: "total messages enqueued",
LabelName: "queue",
LabelValue: q.Name,
}
......@@ -48,6 +50,7 @@ func (q *queue) toPoints() []*point {
Type: counter,
Value: q.Full,
Description: "times queue was full",
LabelName: "queue",
LabelValue: q.Name,
}
......@@ -56,6 +59,7 @@ func (q *queue) toPoints() []*point {
Type: counter,
Value: q.DiscardedFull,
Description: "messages discarded due to queue being full",
LabelName: "queue",
LabelValue: q.Name,
}
......@@ -64,6 +68,7 @@ func (q *queue) toPoints() []*point {
Type: counter,
Value: q.DiscardedNf,
Description: "messages discarded when queue not full",
LabelName: "queue",
LabelValue: q.Name,
}
......@@ -72,6 +77,7 @@ func (q *queue) toPoints() []*point {
Type: gauge,
Value: q.MaxQsize,
Description: "maximum size queue has reached",
LabelName: "queue",
LabelValue: q.Name,
}
......
......@@ -35,6 +35,7 @@ func (r *resource) toPoints() []*point {
Type: counter,
Value: r.Utime,
Description: "user time used in microseconds",
LabelName: "resource",
LabelValue: r.Name,
}
......@@ -43,6 +44,7 @@ func (r *resource) toPoints() []*point {
Type: counter,
Value: r.Stime,
Description: "system time used in microsends",
LabelName: "resource",
LabelValue: r.Name,
}
......@@ -51,6 +53,7 @@ func (r *resource) toPoints() []*point {
Type: gauge,
Value: r.Maxrss,
Description: "maximum resident set size",
LabelName: "resource",
LabelValue: r.Name,
}
......@@ -59,6 +62,7 @@ func (r *resource) toPoints() []*point {
Type: counter,
Value: r.Minflt,
Description: "total minor faults",
LabelName: "resource",
LabelValue: r.Name,
}
......@@ -67,6 +71,7 @@ func (r *resource) toPoints() []*point {
Type: counter,
Value: r.Majflt,
Description: "total major faults",
LabelName: "resource",
LabelValue: r.Name,
}
......@@ -75,6 +80,7 @@ func (r *resource) toPoints() []*point {
Type: counter,
Value: r.Inblock,
Description: "filesystem input operations",
LabelName: "resource",
LabelValue: r.Name,
}
......@@ -83,6 +89,7 @@ func (r *resource) toPoints() []*point {
Type: counter,
Value: r.Outblock,
Description: "filesystem output operations",
LabelName: "resource",
LabelValue: r.Name,
}
......@@ -91,6 +98,7 @@ func (r *resource) toPoints() []*point {
Type: counter,
Value: r.Nvcsw,
Description: "voluntary context switches",
LabelName: "resource",
LabelValue: r.Name,
}
......@@ -99,6 +107,7 @@ func (r *resource) toPoints() []*point {
Type: counter,
Value: r.Nivcsw,
Description: "involuntary context switches",
LabelName: "resource",
LabelValue: r.Name,
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment