From b110b512d7fa9b0caf2fa16868c3ee8529b3d468 Mon Sep 17 00:00:00 2001 From: Julius Volz Date: Wed, 18 Mar 2015 17:02:35 +0100 Subject: [PATCH 1/3] Group imports by stdlib/external packages. --- main.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/main.go b/main.go index 82d7128..cde4374 100644 --- a/main.go +++ b/main.go @@ -4,13 +4,14 @@ import ( "encoding/json" "flag" "fmt" - "github.com/antonlindstrom/mesos_stats" - "github.com/golang/glog" - "github.com/prometheus/client_golang/prometheus" "io/ioutil" "net/http" "os" "time" + + "github.com/antonlindstrom/mesos_stats" + "github.com/golang/glog" + "github.com/prometheus/client_golang/prometheus" ) var ( From 4cc889c75be9d8935568f83416e5e0cec4e44468 Mon Sep 17 00:00:00 2001 From: Julius Volz Date: Wed, 18 Mar 2015 17:03:09 +0100 Subject: [PATCH 2/3] Separate var blocks for flags and metrics. --- main.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/main.go b/main.go index cde4374..20340d5 100644 --- a/main.go +++ b/main.go @@ -17,6 +17,9 @@ import ( var ( configFile = flag.String("config.file", "", "Path to config file.") metricsPath = flag.String("web.telemetry-path", "/metrics", "Path under which to expose metrics.") +) + +var ( cpuLimitVal = prometheus.NewGaugeVec( prometheus.GaugeOpts{ Namespace: "mesos_task", From f3c0ceee4a6931ca6d165ab7a0968579e85caeda Mon Sep 17 00:00:00 2001 From: Julius Volz Date: Wed, 18 Mar 2015 21:20:28 +0100 Subject: [PATCH 3/3] Change metric definitions a bit. --- main.go | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/main.go b/main.go index 20340d5..0a670e2 100644 --- a/main.go +++ b/main.go @@ -23,42 +23,42 @@ var ( cpuLimitVal = prometheus.NewGaugeVec( prometheus.GaugeOpts{ Namespace: "mesos_task", - Name: "cpus_limit", - Help: "CPU share limit.", + Name: "cpu_limit", + Help: "Fractional CPU limit.", }, - []string{"service", "mesos_slave", "framework_id"}, + []string{"task", "mesos_slave", "framework_id"}, ) cpuSysVal = prometheus.NewGaugeVec( prometheus.GaugeOpts{ Namespace: "mesos_task", - Name: "cpus_system_time_secs", - Help: "CPU system time for task.", + Name: "cpu_system_seconds_total", + Help: "Cumulative system CPU time in seconds.", }, - []string{"service", "mesos_slave", "framework_id"}, + []string{"task", "mesos_slave", "framework_id"}, ) cpuUsrVal = prometheus.NewGaugeVec( prometheus.GaugeOpts{ Namespace: "mesos_task", - Name: "cpus_user_time_secs", - Help: "CPU system time for task.", + Name: "cpu_user_seconds_total", + Help: "Cumulative user CPU time in seconds.", }, - []string{"service", "mesos_slave", "framework_id"}, + []string{"task", "mesos_slave", "framework_id"}, ) memLimitVal = prometheus.NewGaugeVec( prometheus.GaugeOpts{ Namespace: "mesos_task", - Name: "mem_limit_bytes", + Name: "memory_limit_bytes", Help: "Task memory limit in bytes.", }, - []string{"service", "mesos_slave", "framework_id"}, + []string{"task", "mesos_slave", "framework_id"}, ) memRssVal = prometheus.NewGaugeVec( prometheus.GaugeOpts{ Namespace: "mesos_task", - Name: "mem_rss_bytes", + Name: "memory_rss_bytes", Help: "Task memory RSS usage in bytes.", }, - []string{"service", "mesos_slave", "framework_id"}, + []string{"task", "mesos_slave", "framework_id"}, ) )