Add trendlines to the AI Impact analytics dashboard
What does this MR do and why?
For the AI impact analytics dashboard, adds a new column containing sparkline charts for the past 6-month period.
MR acceptance checklist
Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Screenshots or screen recordings
Before | After |
---|---|
How to set up and validate locally
Access the AI Impact analytics dashboard
- Ensure that you are using GitLab Ultimate
- Configure your GDK to use ClickHouse
# enable clickhouse
Feature.enable(:clickhouse_data_collection)
Feature.enable(:event_sync_worker_for_click_house)
# enable the worker to sync code suggestions events to clickhouse
Feature.enable(:code_suggestion_events_in_click_house)
- Create a new group
- Navigate to the Analytics dashboard page for the new group (ex. http://gdk.test:3000/groups/flightjs/-/analytics/dashboards)
- Select the
AI impact analytics
dashboard
Add mock dashboard data
- Determine the ID of a project in your test group
- Enter the rails console:
rails c
- Create reference to your test project:
project = Project.find(ID)
- Run any of the necessary data mocks below:
DORA metrics
[
[1.month.ago, 5, 1, 5, 2],
[2.month.ago, 10, 3, 3, 3],
[3.month.ago, 8, 5, 7, 1],
[4.month.ago, 5, 1, 5, 2],
[5.month.ago, 10, 3, 3, 3],
[6.month.ago, 8, 5, 7, 1]
].each do |date, deploys, lead_time_for_changes, time_to_restore_service, incidents_count|
Dora::DailyMetrics.create!(
deployment_frequency: deploys,
lead_time_for_changes_in_seconds: lead_time_for_changes * 1.day.to_i,
time_to_restore_service_in_seconds: time_to_restore_service * 1.day.to_i,
incidents_count: incidents_count,
environment: project.default_environment,
date: date
)
end
Flow metrics
[
[1.month.ago.beginning_of_month + 2.days, 2, 10],
[2.month.ago.beginning_of_month + 2.days, 4, 20],
[3.month.ago.beginning_of_month + 2.days, 3, 15],
[4.month.ago.beginning_of_month + 2.days, 2, 10],
[5.month.ago.beginning_of_month + 2.days, 4, 20],
[6.month.ago.beginning_of_month + 2.days, 3, 15]
].each do |created_at, lead_time, count|
count.times do
Issue.create!(
project: project,
author: project.users.first,
title: "create_mock_flow_metrics #{SecureRandom.hex}",
created_at: created_at,
closed_at: created_at + lead_time.days
).metrics.update!(first_mentioned_in_commit_at: created_at + 1.day)
end
end
Analytics::CycleAnalytics::DataLoaderService.new(group: project.group, model: Issue).execute
Vulnerabilities metrics
[
[1.month.ago.end_of_month, 3, 2],
[2.month.ago.end_of_month, 5, 4],
[3.month.ago.end_of_month, 2, 3],
[4.month.ago.end_of_month, 3, 2],
[5.month.ago.end_of_month, 5, 4],
[6.month.ago.end_of_month, 2, 3]
].each do |date, critical, high|
Vulnerabilities::HistoricalStatistic.create!(
date: date,
high: high,
critical: critical,
total: critical + high,
letter_grade: 'a',
project: project
)
end
Related to #464692 (closed)
Edited by Alex Pennells