Commit Graph

18 Commits

Author SHA1 Message Date
GitLab Bot 1f1bdf54e1 Add latest changes from gitlab-org/gitlab@master 2019-10-04 09:06:35 +00:00
GitLab Bot 80f61b4035 Add latest changes from gitlab-org/gitlab@master 2019-09-18 14:02:45 +00:00
GitLab Bot b7dfe2ae40 Add latest changes from gitlab-org/gitlab@master 2019-09-13 13:26:31 +00:00
Sarah Yasonik caa361b703 Support query parameters in metrics embeds
https://gitlab.com/gitlab-org/gitlab-ce/issues/62971

Adds support for embedding specific charts from the
metrics dashboard. Expected parameters are dashboard,
title, group, and y_label.
2019-08-15 21:38:29 +00:00
Sarah Yasonik bf918b68f6 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.
2019-08-07 16:17:35 +00:00
Sarah Yasonik dfe13131d7 Move BaseService to Services directory
In preparation for embedding specific metrics in issues
https://gitlab.com/gitlab-org/gitlab-ce/issues/62971,
this commit moves the BaseService for metrics dashboards
to a new services subdirectory. This is purely for the sake
of organization and maintainability.
2019-07-29 23:03:59 +00:00
Sarah Yasonik 7d393bd852 Expose metrics element for FE consumption
Adds GFM Pipline filters to insert a placeholder in the generated
HTML from GFM based on the presence of a metrics dashboard link.

The front end should look for the class 'js-render-metrics' to
determine if it should replace the element with metrics charts.
The data element 'data-dashboard-url' should be the endpoint
the front end should hit in order to obtain a dashboard layout
in order to appropriately render the charts.
2019-07-10 11:27:25 +00:00
Sarah Yasonik 9c50cf03f5 Add permission check to dashboards
Adds permission checks to the metrics_dashboard endpoint. Users
with role of Reporter or above should have access to view the
metrics for a given project.
2019-06-27 10:54:29 +00:00
Sarah Yasonik f49dd76a44 Add embedding flag and filter to CPU/Mem
This commits adds support for metrics dashboards
for embedding. If the flag 'embedded' is provided
to the environments/id/metrics_dashboard endpoint,
the response will be suitable for embedding in
issues or other content.

This is a precursor for support for embedding
metrics in GFM.
2019-06-20 14:06:18 +00:00
Sarah Yasonik 1b7464ed84 Specify a dropdown name for dashboards 2019-06-14 15:55:08 +00:00
Sarah Yasonik 15c8d29bd6 Refactor for cleaner caching in dashboards
Opts to cache a full list of cached dashboards
to better manage removing items from the cache.
This also allows dashboards to be stored in the
cache that don't necessarily correspond to a
single dashboard yml.
2019-06-13 16:45:36 +00:00
syasonik ecdc50b198 Switch errors to inherit from a base class
Error classes associated with individual stages of
dashboard processing tend to have very long names.
As dashboard post-processing includes more steps,
we will likely need to handle more error cases.
Refactoring to have all errors inherit from a specific
base class will help accommodate this and keep the code
more readable.
2019-06-06 23:05:19 +01:00
syasonik cd94500a42 Address rubocop errors 2019-06-06 11:43:50 +01:00
syasonik 54dd44030b Expose prometheus endpoint per metric in dashboard
Adds a new stage to dashboard processesing step for the
EnvironmentsController::metrics_dashboard endpoint.

Allows the front end to avoid generating the endpoint
unitutive string mutations.
2019-06-06 11:43:50 +01:00
Sarah Yasonik 552a3d2fd9 Update metrics dashboard API to load yml from repo
Updates the EnvironmentController#metrics_dashboard endpoint
to support a "dashboard" param, which can be used to specify
the filepath of a dashboard configuration from a project
repository. Dashboard configurations are expected to be
stored in .gitlab/dashboards/.

Updates dashboard post-processing steps to exclude custom
metrics, which should only display on the system dashboard.
2019-05-01 10:16:03 +00:00
syasonik 0e093940e1 Move dashboard param to initialize method 2019-04-25 14:13:43 +08:00
syasonik 8926b37d5b Prefer safe_load and deep_symbolize_keys 2019-04-25 14:00:51 +08:00
syasonik 4a5c48c47c Move MetricsDashboard to Metrics::Dashboard 2019-04-25 13:35:05 +08:00