feat: add GitHub Action usage metrics for telemetry#475
Open
cocosheng-g wants to merge 9 commits intomainfrom
Open
feat: add GitHub Action usage metrics for telemetry#475cocosheng-g wants to merge 9 commits intomainfrom
cocosheng-g wants to merge 9 commits intomainfrom
Conversation
Contributor
|
🤖 Hi @cocosheng-g, I've received your request, and I'm working on it now! You can track my progress in the logs for more details. |
…emetry tracking across different workflows
…correct P0 telemetry
905f30f to
6303b92
Compare
…kflows to improve clarity
…puts for strongly-typed telemetry
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR implements the necessary infrastructure in the `run-gemini-cli` GitHub Action to support the Gemini CLI usage metrics (P0 requirements).
It aligns with the core CLI telemetry changes introduced in google-gemini/gemini-cli#21129.
Changes Made:
Example Telemetry Scenarios
Because the CLI appends these context fields to the `baseMetadata` of all events (API Request, Response, Error), downstream analytics can perfectly distinguish and count unique issues vs. PRs based on the specific fields.
Scenario A: Automated PR Review
When PR 42 triggers the `gemini-review` workflow, the CLI logs:
{ \"event_name\": \"api_request\", \"event_metadata\": [ [ { \"gemini_cli_key\": 130, \"value\": \"gemini-review\" }, { \"gemini_cli_key\": 172, \"value\": \"pull_request\" }, { \"gemini_cli_key\": 173, \"value\": \"42\" } // GH_PR_NUMBER ] ] }Analysts can count `DISTINCT gh_pr_number WHERE gh_workflow_name LIKE '%review%'` to satisfy the P0 PR metric.
Scenario B: Automated Issue Triage
When Issue 88 triggers the `gemini-triage` workflow, the CLI logs:
{ \"event_name\": \"api_request\", \"event_metadata\": [ [ { \"gemini_cli_key\": 130, \"value\": \"gemini-triage\" }, { \"gemini_cli_key\": 172, \"value\": \"issues\" }, { \"gemini_cli_key\": 174, \"value\": \"88\" } // GH_ISSUE_NUMBER ] ] }Analysts can count `DISTINCT gh_issue_number WHERE gh_workflow_name LIKE '%triage%' AND gh_event_name = 'issues'` to satisfy the P0 Automated Issue metric.
Scenario C: Scheduled Batch Triage
When a cron job runs and triages 3 issues (IDs 101, 102, 103) in a single CLI invocation, the CLI logs:
{ \"event_name\": \"api_request\", \"event_metadata\": [ [ { \"gemini_cli_key\": 130, \"value\": \"gemini-scheduled-triage\" }, { \"gemini_cli_key\": 172, \"value\": \"schedule\" }, { \"gemini_cli_key\": 175, \"value\": \"101,102,103\" } // GH_CUSTOM_TRACKING_ID ] ] }Analysts can split the `gh_custom_tracking_id` string by commas to count exactly 3 unique issues processed during a scheduled invocation.
Related Issues