summaryrefslogtreecommitdiffstats
path: root/widgets/metrics.go
diff options
context:
space:
mode:
authorSean E. Russell <ser@ser1.net>2020-05-12 18:42:45 -0500
committerSean E. Russell <ser@ser1.net>2020-05-12 18:42:45 -0500
commit310a6d084d5ff56ebb26cd667f46f578b39c737a (patch)
treea1b98a9a3736f9c8aa9057623f62b109294dc4f3 /widgets/metrics.go
parentb0e1e9a20ad2c198b65df420aef5821c7be7208c (diff)
Replaces the Prometheus client with VictoriaMetrics/metrics
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, "_")
+}