diff options
author | Sarah Yasonik <syasonik@gitlab.com> | 2019-08-07 19:17:35 +0300 |
---|---|---|
committer | Sean McGivern <sean@gitlab.com> | 2019-08-07 19:17:35 +0300 |
commit | bf918b68f643266e91a9308cbc64a8304c647f17 (patch) | |
tree | ddface6092de44fafe2e0929158fc65d92766f47 /spec/models | |
parent | d8966abd20c860d2f30141f3647f2b81f70b683d (diff) |
Support dashboard params for metrics dashboard
https://gitlab.com/gitlab-org/gitlab-ce/issues/62971
Adds support to EnvironmentsController#metrics_dashboard
for the following params: group, title, y_label
These params are used to uniquely identify a panel on
the metrics dashboard.
Metrics are stored in several places, so this adds
utilities to find a specific panel from the database
or filesystem depending on the metric specified.
Also moves some shared utilities into separate classes,
notably default values and errors.
Diffstat (limited to 'spec/models')
-rw-r--r-- | spec/models/prometheus_metric_spec.rb | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/spec/models/prometheus_metric_spec.rb b/spec/models/prometheus_metric_spec.rb index 3610408c138..a123ff5a2a6 100644 --- a/spec/models/prometheus_metric_spec.rb +++ b/spec/models/prometheus_metric_spec.rb @@ -150,4 +150,17 @@ describe PrometheusMetric do expect(subject.to_query_metric.queries).to eq(queries) end end + + describe '#to_metric_hash' do + it 'returns a hash suitable for inclusion on a metrics dashboard' do + expected_output = { + query_range: subject.query, + unit: subject.unit, + label: subject.legend, + metric_id: subject.id + } + + expect(subject.to_metric_hash).to eq(expected_output) + end + end end |