From da9365d80f9e3e58b097f7b4eba50b029f306f39 Mon Sep 17 00:00:00 2001 From: Ivan Chernetsky Date: Mon, 1 Oct 2018 17:35:50 -0700 Subject: [PATCH] Push StasD counters as gauges (#6580) JIRA issues: DCOS-42671 --- docs/docs/metrics.md | 5 ++++- .../metrics/current/reporters/DataDogAPIReporter.scala | 2 +- .../metrics/current/reporters/DataDogUDPReporter.scala | 2 +- .../marathon/metrics/current/reporters/StatsDReporter.scala | 2 +- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/docs/docs/metrics.md b/docs/docs/metrics.md index 981019109e3..fcf64092fec 100644 --- a/docs/docs/metrics.md +++ b/docs/docs/metrics.md @@ -71,6 +71,8 @@ The StatsD reporter can be enabled with `--metrics_statsd` command-line flag. It sends metrics over UDP to the host and port specified with `--metrics_statsd_host` and `--metrics_statsd_port` respectively. +Counters are forwarded as gauges. + ## DataDog reporter The DataDog reporter can be enabled with `--metrics_datadog` @@ -84,7 +86,8 @@ the DataDog cloud over HTTP. It is specified using and `api`. If `api` is chosen, your DataDog API key can be supplied with `--metrics_datadog_api_key`. -Dashes in metric names are replaced with underscores. +Dashes in metric names are replaced with underscores. Counters are +forwarded as gauges. ## Important metrics diff --git a/src/main/scala/mesosphere/marathon/metrics/current/reporters/DataDogAPIReporter.scala b/src/main/scala/mesosphere/marathon/metrics/current/reporters/DataDogAPIReporter.scala index fc9f036d46a..ae27eb1ab48 100644 --- a/src/main/scala/mesosphere/marathon/metrics/current/reporters/DataDogAPIReporter.scala +++ b/src/main/scala/mesosphere/marathon/metrics/current/reporters/DataDogAPIReporter.scala @@ -87,7 +87,7 @@ class DataDogAPIReporter(metricsConf: MetricsConf, registry: MetricRegistry) ext } private def reportCounter(buffer: StringBuilder, name: String, counter: Counter, timestamp: Long): Unit = - reportMetric(buffer, name, counter.getCount.toString, timestamp, "count") + reportMetric(buffer, name, counter.getCount.toString, timestamp, "gauge") private val histogramSnapshotSuffixes = Seq("min", "average", "median", "75percentile", "95percentile", "98percentile", diff --git a/src/main/scala/mesosphere/marathon/metrics/current/reporters/DataDogUDPReporter.scala b/src/main/scala/mesosphere/marathon/metrics/current/reporters/DataDogUDPReporter.scala index ddec1398ffd..a9e6d30c02c 100644 --- a/src/main/scala/mesosphere/marathon/metrics/current/reporters/DataDogUDPReporter.scala +++ b/src/main/scala/mesosphere/marathon/metrics/current/reporters/DataDogUDPReporter.scala @@ -81,7 +81,7 @@ class DataDogUDPReporter(metricsConf: MetricsConf, registry: MetricRegistry) ext } private def reportCounter(socket: ActorRef, name: String, counter: Counter): Unit = - maybeSendAndAppend(socket, s"$name:${counter.getCount}|c\n") + maybeSendAndAppend(socket, s"$name:${counter.getCount}|g\n") private val histogramSnapshotSuffixes = Seq("min", "average", "median", "75percentile", "95percentile", "98percentile", diff --git a/src/main/scala/mesosphere/marathon/metrics/current/reporters/StatsDReporter.scala b/src/main/scala/mesosphere/marathon/metrics/current/reporters/StatsDReporter.scala index 25b9ce21583..7a19583d18f 100644 --- a/src/main/scala/mesosphere/marathon/metrics/current/reporters/StatsDReporter.scala +++ b/src/main/scala/mesosphere/marathon/metrics/current/reporters/StatsDReporter.scala @@ -78,7 +78,7 @@ class StatsDReporter(metricsConf: MetricsConf, registry: MetricRegistry) extends } private def reportCounter(socket: ActorRef, name: String, counter: Counter): Unit = - maybeSendAndAppend(socket, s"$name:${counter.getCount}|c\n") + maybeSendAndAppend(socket, s"$name:${counter.getCount}|g\n") private val histogramSnapshotSuffixes = Seq("min", "mean", "p50", "p75", "p95", "p98", "p99", "p999", "max", "stddev")