CLI generator should support instrumentation for AI usage tracking events and metrics (in-product analytics)
Overview
We want development teams to use the CLI generator as their primary starting point for instrumentation. This approach ensures teams receive accurate guidance on instrumentation best practices while significantly simplifying the instrumentation process for developers.
Current Challenge
Teams implementing AI usage tracking must currently follow separate documentation (https://docs.gitlab.com/development/ai_features/usage_tracking/) to ensure their AI usage events and metrics appear correctly in in-product analytics. This fragmented approach forces teams to navigate multiple resources and documentation sources.
Desired outcome
Use CLI generator to simplify instrumentation for this new use case. Whether teams are implementing instrumentation for internal reporting or customer-facing analytics (AI usage tracking) , the process should be unified, straightforward, and accessible through a single tool.
Potential Solution
Support AI tracking in usage examples for AI tracking events. (we should be able to detect AI tracking events from the event_name selected)
First iteration
- The CLI should ask for classification (Implemented in !208383 (merged))
- If
classification: duo
, show a link to https://docs.gitlab.com/development/ai_features/usage_tracking/#adding-new-event-for-tracking at the end of the flow along with a short suggesting that the user might want to add AI tracking as well.
Next iteration
- Add code examples for registering event with AI tracking in
Gitlab::Tracking::AiTracking
(with metadata and without meta data examples) (Docs for registering an event for AiTracking: https://docs.gitlab.com/development/ai_features/usage_tracking/#adding-new-event-for-tracking) - Add event code examples for triggering event using
InternalEvents.track_event
- Add AI code examples for rspec