summaryrefslogtreecommitdiffstats
path: root/widgets/metrics.go
blob: 683b1964ab550b27efb83bd8938de0e124710fd6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
package widgets

import (
	"fmt"
	"strings"
)

// makeName creates a prometheus metric name in the gotop space
// This function doesn't have to be very efficient because it's only
// called at init time, and only a few dozen times... and it isn't
// (very efficient).
func makeName(parts ...interface{}) string {
	args := make([]string, len(parts)+1)
	args[0] = "gotop"
	for i, v := range parts {
		args[i+1] = fmt.Sprintf("%v", v)
	}
	return strings.Join(args, "_")
}