Skip to content

Code Insights: Move from string based keys for insight pings to enum values

Created by: vovakulikov

Context

At the moment we use string as a key for the ping calls. For example, this is a ping for the dashboard page views

useEffect(() => {
    telemetryService.logViewEvent('Insights')
}, [telemetryService, dashboardID])

With that implementation, it's easy to forget about update this key in some other place, or which is worst it's easy to use some other key on this page (and on other pages too) some key that doesn't have support on our BE and Looker charts.

To avoid this we could use one object keymap or enum to store all Code Insights Ping keys

enum CodeInsightsPings {
 DashboardPageViews = 'Insights'
 AddMoreInsightClick = 'addmoreclickInsight',
 
 ...
 ...
}