Metrics Reports
Introduced in GitLab Premium 11.10. Requires GitLab Runner 11.10 and above.
概要
GitLab provides a lot of great reporting tools for merge requests - JUnit reports, code quality, performance tests, etc. 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 will display 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 utilize Metrics Reports:
- Memory usage
- Load testing results
- Code complexity
- Code coverage stats
どのように動作するか
Metrics are read from the metrics report (default: metrics.txt
). They are parsed and displayed in the MR widget.
All values are considered strings and string compare is used to find differences between the latest available metrics
artifact from:
master
- The feature branch
設定方法
Add a job that creates a metrics report (default filename: metrics.txt
). The file should conform to the OpenMetrics format.
使用例
metrics:
script:
- echo 'metric_name metric_value' > metrics.txt
artifacts:
reports:
metrics: metrics.txt
Advanced Example
An advanced example of an OpenMetrics text file (from the Prometheus documentation) renders in the merge request widget as: