From 141f017835dd03021afd775426ff98ae15fee0c1 Mon Sep 17 00:00:00 2001 From: Bernd Ahlers Date: Thu, 4 Dec 2014 08:08:18 +0100 Subject: [PATCH] Add COUNTER metric type. Fixes Graylog2/graylog2-server#795. --- app/assets/stylesheets/graylog2.less | 4 ++++ app/views/partials/metrics/counter.scala.html | 6 ++++++ app/views/system/metrics/of_node.scala.html | 4 ++++ app/views/system/metrics/partials/metric.scala.html | 5 +++++ 4 files changed, 19 insertions(+) create mode 100644 app/views/partials/metrics/counter.scala.html diff --git a/app/assets/stylesheets/graylog2.less b/app/assets/stylesheets/graylog2.less index 74c3083b9..bd94c9f41 100644 --- a/app/assets/stylesheets/graylog2.less +++ b/app/assets/stylesheets/graylog2.less @@ -1298,6 +1298,10 @@ dl.metric-gauge dd { margin-left: 80px; } +dl.metric-counter dd { + margin-left: 80px; +} + dl.metric-histogram dd { margin-left: 125px; } diff --git a/app/views/partials/metrics/counter.scala.html b/app/views/partials/metrics/counter.scala.html new file mode 100644 index 000000000..a460bddae --- /dev/null +++ b/app/views/partials/metrics/counter.scala.html @@ -0,0 +1,6 @@ +@(counter: org.graylog2.restclient.lib.metrics.Counter) + +
+
Value:
+
@counter.getCount
+
\ No newline at end of file diff --git a/app/views/system/metrics/of_node.scala.html b/app/views/system/metrics/of_node.scala.html index f4f9252aa..486af9435 100644 --- a/app/views/system/metrics/of_node.scala.html +++ b/app/views/system/metrics/of_node.scala.html @@ -40,6 +40,10 @@

} + @if(metric.getType.equals(Metric.MetricType.COUNTER)) { + + } + @name.substring(0,"org.graylog2.".length)@name.substring("org.graylog2.".length) diff --git a/app/views/system/metrics/partials/metric.scala.html b/app/views/system/metrics/partials/metric.scala.html index dd10c37ed..f5ab16d9e 100644 --- a/app/views/system/metrics/partials/metric.scala.html +++ b/app/views/system/metrics/partials/metric.scala.html @@ -15,6 +15,11 @@

Gauge


@views.html.partials.metrics.gauge(metric.asInstanceOf[Gauge]) } +@if(metric.getType.equals(Metric.MetricType.COUNTER)) { +

Counter


+ @views.html.partials.metrics.counter(metric.asInstanceOf[Counter]) +} + @if(metric.getType.equals(Metric.MetricType.HISTOGRAM)) {

Histogram


@views.html.partials.metrics.histogram(metric.asInstanceOf[Histogram])