sourcegraph / sourcegraph-public-snapshot

Code AI platform with Code Search & Cody
https://sourcegraph.com
Other
10.11k stars 1.27k forks source link

Cody metrics #50097

Closed malomarrec closed 1 year ago

malomarrec commented 1 year ago

Cody events

Aggregated pings

Attributes

Site admin attributes:

nathan-downs commented 1 year ago

Recipes used from menu events: CodyVSCodeExtension:recipeGenerateCode:clicked CodyVSCodeExtension:recipeGenerateUnitTest:clicked CodyVSCodeExtension:recipeGenerateDocstring:clicked CodyVSCodeExtension:recipeImproveVariableNames:clicked CodyVSCodeExtension:recipeTranslateToLanguage:clicked CodyVSCodeExtension:recipeGitHistoryt:clicked

Ask Cody right click menu events: CodyVSCodeExtension:codyToggleEnabled:clicked CodyVSCodeExtension:askCodyExplainCode:clicked CodyVSCodeExtension:askCodyExplainCodeHighLevel:clicked CodyVSCodeExtension:askCodyGenerateUnitTest:clicked CodyVSCodeExtension:askCodyGenerateDocstring:clicked CodyVSCodeExtension:askCodyTranslateToLanguage:clicked CodyVSCodeExtension:askCodyGitHistory:clicked CodyVSCodeExtension:askCodyImproveVariableNames:clicked CodyVSCodeExtension:codySetAccessToken:clicked CodyVSCodeExtension:codyDeleteAccessToken:clicked CodyVSCodeExtension:askCodyViewSuggestions:clicked

nathan-downs commented 1 year ago

Per Slack thread with @malomarrec we will use the CodyVSCodeExtension:acceptTerms:clicked event to determine when access has been provisioned to a user.

nathan-downs commented 1 year ago
dadlerj commented 1 year ago

Just FYI, I didn't mean to imply in that thread that we need to go add custom dashboards to the admin analytics page (though the IPA team might want to!). I mostly meant that the admin wouldn't see that Cody user as a DAU, WAU, MAU until we reached stage 2. So without doing anything new, the admin analytics dashboard should start to show higher usage numbers once you get the first bullet on stage 2 complete.

nathan-downs commented 1 year ago

Got it. For stage 2 I was thinking along the lines of having it roll up into the ExtensionUsageStatistics as a separate ExtensionID, though looking at it briefly it doesn't look like much would need to be changed on the backend.

akalia25 commented 1 year ago

@nathan-downs this PR logs the events we want once eventLogger is added to Cody.

nathan-downs commented 1 year ago

This PR is passing CI and is ready to merge if we want logging of these events immediately to the connected Sourcegraph instance only:

CodyVSCodeExtension:codyToggleEnabled:clicked CodyVSCodeExtension:codySetAccessToken:clicked CodyVSCodeExtension:codyDeleteAccessToken:clicked

CodyVSCodeExtension:askCodyExplainCode:clicked CodyVSCodeExtension:askCodyExplainCodeHighLevel:clicked CodyVSCodeExtension:askCodyGenerateUnitTest:clicked CodyVSCodeExtension:askCodyGenerateDocstring:clicked CodyVSCodeExtension:askCodyTranslateToLanguage:clicked CodyVSCodeExtension:askCodyGitHistory:clicked CodyVSCodeExtension:askCodyImproveVariableNames:clicked

We'll have the replicated events sending to the dot-com endpoint later today, which will come into BigQuery in the telligentsourcegraph.dotcom_events.events table from the event source CODY thanks to this change that was merged today. Currently working on the dot-com event firing and the rest of the events now.

nathan-downs commented 1 year ago

https://github.com/sourcegraph/sourcegraph/pull/50144 just needs a stamp from someone on the Cody team before merging but is passing CI and our manual testing. It satisfies stage 1 and 2 of previous comments, but there is still another PR needed for adding the events to pings for private instances (they'll just be logged in the local instance event_logs table) and the events will need to be added to the allowlist for managed instances. As it stands, we'll at least be getting events coming through to the dotcom endpoint. Example, the first screenshot shows the event in the local instance event log (in this case our s2 instance) and the second screenshot shows that same event coming into the dotcom events table in BigQuery as an anonymous event. We're passing the originating endpoint in the public argument, so combined with the anonymous user id we'll be able to aggregate basic statistics from these anonymous events. In cases where users are logged into dotcom in the Cody extension we bypass the anonymous request and are able to pass user id, feature flags, and other metrics available from dotcom. Screenshot 2023-04-01 at 1 23 53 PM Screenshot 2023-04-01 at 1 23 24 PM

nathan-downs commented 1 year ago

Re: the pings addition, I'm imagining something like a CodyUsageStatistics akin to how some our other metrics are gathered (e.g., SearchUsageStatistics).

malomarrec commented 1 year ago

@nathan-downs is there documentation for follow-ups here? Such as getting events through pings on customer instances?

nathan-downs commented 1 year ago

Not yet, I can create a ticket for getting that added to pings, but it won't go out until the next Sourcegraph release (or patch release if we need it out sooner)

malomarrec commented 1 year ago

Yup, I'd just like to get it tracked. @beyang could we get this added to the next patch release? Or is it against release guidelines?