Commit 9bd08093 authored by Peter Leitzen's avatar Peter Leitzen

Merge branch...

Merge branch '320754-adjust-rails-custom-metrics-generator-to-prefix-filename-with-timestamp' into 'master'

Adjust rails custom metrics generator to prefix filename with timestamp

See merge request gitlab-org/gitlab!53619
parents 7d06e7d7 d592b3b0
......@@ -67,6 +67,8 @@ tier: ['free', 'starter', 'premium', 'ultimate', 'bronze', 'silver', 'gold']
The GitLab codebase provides a dedicated [generator](https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/generators/gitlab/usage_metric_definition_generator.rb) to create new metric definitions.
For uniqueness, the generated file includes a timestamp prefix, in ISO 8601 format.
The generator takes the key path argument and 2 options and creates the metric YAML definition in corresponding location:
- `--ee`, `--no-ee` Indicates if metric is for EE.
......
......@@ -67,8 +67,11 @@ module Gitlab
options[:dir]
end
# Example of file name
#
# 20210201124931_g_project_management_issue_title_changed_weekly.yml
def file_name
key_path.split('.').last
"#{Time.now.utc.strftime("%Y%m%d%H%M%S")}_#{key_path.split('.').last}"
end
def directory
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment