summaryrefslogtreecommitdiffstats
path: root/widgets/metrics.go
diff options
context:
space:
mode:
Diffstat (limited to 'widgets/metrics.go')
-rw-r--r--widgets/metrics.go19
1 files changed, 19 insertions, 0 deletions
diff --git a/widgets/metrics.go b/widgets/metrics.go
new file mode 100644
index 0000000..683b196
--- /dev/null
+++ b/widgets/metrics.go
@@ -0,0 +1,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, "_")
+}