Metrics Reports
GitLab provides a lot of great reporting tools for things like merge requests - Unit test reports, code quality, and performance tests. While JUnit is a great open framework for tests that “pass” or “fail”, it is also important to see other types of metrics from a given change.
You can configure your job to use custom Metrics Reports, and GitLab displays a report on the merge request so that it’s easier and faster to identify changes without having to check the entire log.
Consider the following examples of data that can use Metrics Reports:
Metrics for a branch are read from the latest metrics report artifact (default filename: For an MR, the values of these metrics from the feature branch are compared to the values from the target branch. Then they are displayed in the MR widget in this order:
Add a job that creates a metrics report (default filename: An advanced example of an OpenMetrics text file (from the )
renders in the merge request widget as:
You can see Use cases
How it works
metrics.txt
) as string values.
How to set it up
metrics.txt
). The file should conform to the For example:
metrics:
script:
- echo 'metric_name metric_value' > metrics.txt
artifacts:
reports:
metrics: metrics.txt
Advanced Example
Troubleshooting
Metrics reports did not change
Metrics reports did not change
when trying to view metrics reports in merge requests. Reasons for this are: