Skip to content

Add Internal Events Tracking to Insights charts

What does this MR do and why?

Tracks click events on Insights charts' items using Internal Events Tracking.

Currently, the only charts that support drilling down are "Bugs created per month by Priority" and "Bugs created per month by Severity" on the first report of the Insights page (for more context, see #372215 (closed)), both of whose data source types are issue, and are thus considered of type issue_chart. To start, the following chart-specific event/metric definition has been created:

  • insights_issue_chart_item_clicked
    • Distinct user counts for the 7d 28d time periods
    • Total counts for the 28d time period

In addition, to sum up the above metric and all others that are created in the future once more chart types support drilling down, it creates the following event/metric definitions to track when any Insights chart item is clicked:

  • insights_chart_item_clicked
    • Distinct user counts for the 7d 28d time periods
    • Total counts for the 28d time period

Screenshots or screen recordings

No visual changes.

How to set up and validate locally

  1. Make sure you have a GitLab Ultimate license
  2. Seed Insights data: NEW_PROJECT=1 bin/rake gitlab:seed:insights:issues
  3. Visit the Issues Dashboard on the Insights page for the new group/project returned in the output by the seeder above: http://{LOCAL_INSTANCE}/groups/{GROUP_PATH}/-/insights/#/issues or http://{LOCAL_INSTANCE}/{GROUP_PATH}/{PROJECT_PATH}/insights/#/issues
  4. Start the Internal Events monitor in the terminal (for more details, see the docs)
  5. Scroll down to the last two charts ("Bugs created per month by Priority" and "Bugs created per month by Severity"), click on any of their chart items and verify that each click event triggers the tracking events listed in the description above in the Internal Events monitor.

Internal Events Monitor

rails runner scripts/internal_events/monitor.rb insights_chart_item_clicked insights_issue_chart_item_clicked

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #429055 (closed)

Edited by Rudy Crespo

Merge request reports