summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 2eacfe6)
raw | patch | inline | side by side (parent: 2eacfe6)
author | Sebastian Harl <sh@tokkee.org> | |
Thu, 14 May 2015 10:50:08 +0000 (12:50 +0200) | ||
committer | Sebastian Harl <sh@tokkee.org> | |
Thu, 14 May 2015 10:50:08 +0000 (12:50 +0200) |
Else, we'll just see, for example, a lot of different lines labeled "value"
when querying collectd metrics.
when querying collectd metrics.
graph/graph.go | patch | blob | history |
diff --git a/graph/graph.go b/graph/graph.go
index 7985dc47f0daba74ff952c48d50cf830b1445c8f..56e7053cf6cf2058ea79e6bedfe3f8834ce9a3f4 100644 (file)
--- a/graph/graph.go
+++ b/graph/graph.go
ts int // Index of the current time-series.
}
-func (p *pl) addTimeseries(c *client.Client, metric Metric, start, end time.Time) error {
+func (p *pl) addTimeseries(c *client.Client, metric Metric, start, end time.Time, verbose bool) error {
q, err := client.QueryString("TIMESERIES %s.%s START %s END %s",
metric.Hostname, metric.Identifier, start, end)
if err != nil {
l.LineStyle.Color = plotutil.DarkColors[p.ts%len(plotutil.DarkColors)]
p.Add(l)
- p.Legend.Add(name, l)
+ if verbose {
+ p.Legend.Add(fmt.Sprintf("%s %s %s", metric.Hostname, metric.Identifier, name), l)
+ } else {
+ p.Legend.Add(name, l)
+ }
p.ts++
}
return nil
p.X.Tick.Marker = dateTicks{}
for _, m := range g.Metrics {
- if err := p.addTimeseries(c, m, g.Start, g.End); err != nil {
+ if err := p.addTimeseries(c, m, g.Start, g.End, len(g.Metrics) > 1); err != nil {
return nil, err
}
}