- Select an environment
- Select a dashboard
- Mark a dashboard as favorite
- Manage the metrics dashboard settings
- Chart Context Menu
- Dashboard Annotations
- Add related links to custom dashboards
- Defining custom dashboards per project
- トラブルシューティング
Using the Metrics Dashboard
Select an environment
The Environment dropdown box above the dashboard displays the list of all environments. It enables you to search as you type through all environments and select the one you’re looking for.
Select a dashboard
The dashboard dropdown box above the dashboard displays the list of all dashboards available for the project. It enables you to search as you type through all dashboards and select the one you’re looking for.
Mark a dashboard as favorite
GitLab 13.0から導入されました。
When viewing a dashboard, click the empty Star dashboard button to mark a dashboard as a favorite. Starred dashboards display a solid star button, and appear at the top of the dashboard select list.
To remove dashboard from the favorites list, click the solid Unstar Dashboard button.
Manage the metrics dashboard settings
GitLab 13.2 で導入されました。
To manage the settings for your metrics dashboard:
- Sign in as a user with project Maintainer or Admin permissions.
- Navigate to your dashboard at Operations > Metrics.
-
In the top-right corner of your dashboard, click Metrics Settings:
Chart Context Menu
From each of the panels in the dashboard, you can access the context menu by clicking the More actions dropdown box above the upper right corner of the panel to take actions related to the chart’s data.
The options are:
View and edit the source file of a custom dashboard
GitLab 12.5で導入されました。
When viewing a custom dashboard of a project, you can view the original
.yml
file by clicking on the Edit dashboard button.
Expand panel
GitLab 13.0から導入されました。
To view a larger version of a visualization, expand the panel by clicking the More actions icon and selecting Expand panel.
To return to the metrics dashboard, click the Back button in your browser, or pressing the Esc key.
View Logs
GitLab 12.8で導入されました。
If you have Logs enabled, you can navigate from the charts in the dashboard to view Logs by clicking on the context menu in the upper-right corner.
If you use the Timeline zoom function at the bottom of the chart, logs will narrow down to the time range you selected.
Timeline zoom and URL sharing
GitLab 12.8で導入されました。
You can use the Timeline zoom function at the bottom of a chart to zoom in on a date and time of your choice. When you click and drag the sliders to select a different beginning or end date of data to display, GitLab adds your selected start and end times to the URL, enabling you to share specific timeframes more easily.
Downloading data as CSV
Data from Prometheus charts on the metrics dashboard can be downloaded as CSV.
Dashboard Annotations
-
Introduced in GitLab 12.10 (enabled by feature flag
metrics_dashboard_annotations
). - Feature flag removed in GitLab 13.0.
You can use Metrics Dashboard Annotations to mark any important events on every metrics dashboard by adding annotations to it. While viewing a dashboard, annotation entries assigned to the selected time range will be automatically fetched and displayed on every chart within that dashboard. On mouse hover, each annotation presents additional details, including the exact time of an event and its description.
You can create annotations by making requests to the Metrics dashboard annotations API
Retention policy
Introduced in GitLab 13.01.
To avoid excessive storage space consumption by stale annotations, records attached to time periods older than two weeks are removed daily. This recurring background job runs at 1:00 a.m. local server time.
Add related links to custom dashboards
GitLab 13.1で導入されました。
You can embed links to other dashboards or external services in your custom dashboard by adding Related links to your dashboard’s YAML file. Related links open in the same tab as the dashboard. Related links can be displayed in the following locations on your dashboard:
- At the top of your dashboard as the top level
links
dashboard property. - In charts context menus as the
links
property of a panel.
Related links can contain the following attributes:
-
url
: The full URL to the link. Required. -
title
: A phrase describing the link. Optional. If this attribute is not set, the full URL is used for the link title. -
type
: A string declaring the type of link. Optional. If set tografana
, the dashboard’s time range values are converted to Grafana’s time range format and appended to theurl
.
The dashboard’s time range is appended to the url
as URL parameters.
The following example shows two related links (GitLab.com
and GitLab Documentation
)
added to a dashboard:
Links Syntax
links:
- title: GitLab.com
url: https://gitlab.com
- title: GitLab Documentation
url: https://docs.gitlab.com
- title: Public Grafana playground dashboard
url: https://play.grafana.org/d/000000012/grafana-play-home?orgId=1
type: grafana
Defining custom dashboards per project
Introduced in GitLab 12.1.
By default, all projects include a GitLab-defined Prometheus dashboard, which includes a few key metrics, but you can also define your own custom dashboards.
You may create a new file from scratch or duplicate a GitLab-defined Prometheus dashboard.
Adding a new dashboard to your project
UI option introduced in GitLab 13.2.
You can configure a custom dashboard by adding a new YAML file into your project’s
.gitlab/dashboards/
directory. In order for the dashboards to be displayed on
the project’s Operations > Metrics page, the files must have a .yml
extension and should be present in the project’s default branch.
To create a new dashboard from the GitLab user interface:
- Sign in to GitLab as a user with Maintainer or Owner permissions.
- Navigate to your dashboard at Operations > Metrics.
- In the top-right corner of your dashboard, click the Actions menu,
and select Create new:
- In the modal window, click Open Repository, then follow the instructions for creating a new dashboard from the command line.
To create a new dashboard from the command line:
-
Create
.gitlab/dashboards/prom_alerts.yml
under your repository’s root directory. Each YAML file should define the layout of the dashboard and the Prometheus queries used to populate data. This example dashboard displays a single area chart:dashboard: 'Dashboard Title' panel_groups: - group: 'Group Title' panels: - type: area-chart title: "Chart Title" y_label: "Y-Axis" y_axis: format: number precision: 0 metrics: - id: my_metric_id query_range: 'http_requests_total' label: "Instance: {{instance}}, method: {{method}}" unit: "count"
- Save the file, commit, and push to your repository. The file must be present in your default branch.
- Navigate to your project’s Operations > Metrics and choose the custom dashboard from the dropdown.
.gitlab/dashboards
are not
supported and will not be available in the UI.Duplicating a GitLab-defined dashboard
- GitLab 12.7で導入されました。
- From GitLab 12.8 onwards, custom metrics are also duplicated when you duplicate a dashboard.
You can save a complete copy of a GitLab defined dashboard along with all custom metrics added to it.
Resulting .yml
file can be customized and adapted to your project.
You can decide to save the dashboard .yml
file in the project’s default branch or in a
new branch.
-
Click Duplicate dashboard in the dashboard dropdown or in the actions menu.
Note: You can duplicate only GitLab-defined dashboards. -
Enter the file name and other information, such as the new commit’s message, and click Duplicate.
If you select your default branch, the new dashboard becomes immediately available. If you select another branch, this branch should be merged to your default branch first.
トラブルシューティング
When troubleshooting issues with a managed Prometheus app, it is often useful to view the Prometheus UI.
“No data found” error on Metrics dashboard page
If the “No data found” screen continues to appear, it could be due to:
- No successful deployments have occurred to this environment.
- Prometheus does not have performance data for this environment, or the metrics
are not labeled correctly. To test this, connect to the Prometheus server and
run a query, replacing
$CI_ENVIRONMENT_SLUG
with the name of your environment. - You may need to re-add the GitLab predefined common metrics. This can be done by running the import common metrics Rake task.