Migrate pipeline page visits events to InternalEvents
What does this MR do and why?
Related to #421596 (closed)
Migrate CI/CD page visit events to InternalEvents.
Script used to update the files:
class DebugGenerator < Gitlab::Analytics::InternalEventsGenerator
source_root File.expand_path('generator_templates/gitlab_internal_events', __dir__)
def create_metric_file
validate!
template "event_definition.yml",
event_file_path(event),
options.fetch(:event_desc)
end
end
[
['p_analytics_ci_cd_pipelines', 'Project level CI CD Analytics pipelines tab has been visited'],
['p_analytics_ci_cd_deployment_frequency', "Project level CI CD Analytics deployment frequency tab has been visited"],
['p_analytics_ci_cd_lead_time', "Project level CI CD Analytics lead time tab has been visited"]
].each do |event_name, event_desc|
DebugGenerator.new([], {
event: event_name,
event_desc: event_desc,
section: 'dev',
stage: 'manage',
group: 'optimize',
mr: 'https://gitlab.com/gitlab-org/gitlab/-/merge_requests/130854',
unique: 'user.id'
}).invoke_all
['28d', '7d'].each do |days|
files = Dir["config/metrics/counts_#{days}/*\_#{event_name}\_*"]
raise StandardError, "Multiple files found: #{files}" unless files.count == 1
file_name = files.first
text = File.read(file_name)
new_contents = text.gsub(/distribution:/, "events:
- name: #{event_name}
unique: user.id\ndistribution:")
File.open(file_name, "w") {|file| file.puts new_contents }
end
end
Screenshots or screen recordings
Screenshots are required for UI changes, and strongly recommended for all other merge requests.
Before | After |
---|---|
How to set up and validate locally
- Set up snowplow-micro
- Trigger the events migrated here:
- Visit a project's
Analyze
->CI/CD Analytics
->Pipelines
- Visit a project's
Analyze
->CI/CD Analytics
->Deployment frequency
and refresh the page - Visit a project's
Analyze
->CI/CD Analytics
->Lead time
and refresh the page
- Visit a project's
- Make sure that the events have been triggered with content as per their new event definition files [eg. -
category
sent asInternalEventTracking
] on thehttp://localhost:9091/micro/good
snowplow micro endpoint.
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Edited by Michał Wielich