Skip to content

Commit

Permalink
Merge pull request #3559 from hashicorp/b-metrics
Browse files Browse the repository at this point in the history
Don't emit metrics for non-running tasks
  • Loading branch information
dadgar authored Nov 17, 2017
2 parents 96f56ce + 85b2762 commit ea0eba6
Show file tree
Hide file tree
Showing 5 changed files with 107 additions and 24 deletions.
8 changes: 8 additions & 0 deletions client/task_runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -1891,6 +1891,14 @@ func (r *TaskRunner) emitStats(ru *cstructs.TaskResourceUsage) {
return
}

// If the task is not running don't emit anything
r.runningLock.Lock()
running := r.running
r.runningLock.Unlock()
if !running {
return
}

if ru.ResourceUsage.MemoryStats != nil {
r.setGaugeForMemory(ru)
}
Expand Down
3 changes: 3 additions & 0 deletions command/agent/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -545,6 +545,9 @@ func DevConfig() *Config {
conf.Client.GCDiskUsageThreshold = 99
conf.Client.GCInodeUsageThreshold = 99
conf.Client.GCMaxAllocs = 50
conf.Telemetry.PrometheusMetrics = true
conf.Telemetry.PublishAllocationMetrics = true
conf.Telemetry.PublishNodeMetrics = true

return conf
}
Expand Down
4 changes: 2 additions & 2 deletions vendor/github.com/armon/go-metrics/inmem.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

96 changes: 84 additions & 12 deletions vendor/github.com/armon/go-metrics/prometheus/prometheus.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 10 additions & 10 deletions vendor/vendor.json
Original file line number Diff line number Diff line change
Expand Up @@ -88,28 +88,28 @@
"revision": "bbbad097214e2918d8543d5201d12bfd7bca254d"
},
{
"checksumSHA1": "0et4hA6AYqZCgYiY+c6Z17t3k3k=",
"checksumSHA1": "xp/2s4XclLL17DThGBI7jXZ4Crs=",
"path": "github.com/armon/go-metrics",
"revision": "023a4bbe4bb9bfb23ee7e1afc8d0abad217641f3",
"revisionTime": "2017-08-09T01:16:44Z"
"revision": "6c3acc97c61d04290a8ba2e54640151f54c1546a",
"revisionTime": "2017-11-16T18:41:20Z"
},
{
"checksumSHA1": "xCsGGM9TKBogZDfSN536KtQdLko=",
"path": "github.com/armon/go-metrics/circonus",
"revision": "023a4bbe4bb9bfb23ee7e1afc8d0abad217641f3",
"revisionTime": "2017-08-09T01:16:44Z"
"revision": "6c3acc97c61d04290a8ba2e54640151f54c1546a",
"revisionTime": "2017-11-16T18:41:20Z"
},
{
"checksumSHA1": "Dt0n1sSivvvdZQdzc4Hu/yOG+T0=",
"path": "github.com/armon/go-metrics/datadog",
"revision": "023a4bbe4bb9bfb23ee7e1afc8d0abad217641f3",
"revisionTime": "2017-08-09T01:16:44Z"
"revision": "6c3acc97c61d04290a8ba2e54640151f54c1546a",
"revisionTime": "2017-11-16T18:41:20Z"
},
{
"checksumSHA1": "NER1U5W8xgC+tAxVUuEckTffFsE=",
"checksumSHA1": "XfPPXw55zKziOWnZbkEGEJ96O9c=",
"path": "github.com/armon/go-metrics/prometheus",
"revision": "0a12dc6f6b9da6da644031a1b9b5a85478c5ee27",
"revisionTime": "2017-09-13T18:48:37Z"
"revision": "6c3acc97c61d04290a8ba2e54640151f54c1546a",
"revisionTime": "2017-11-16T18:41:20Z"
},
{
"checksumSHA1": "gNO0JNpLzYOdInGeq7HqMZUzx9M=",
Expand Down

0 comments on commit ea0eba6

Please sign in to comment.