feat: add GitHub Action usage metrics for telemetry#475
Open
cocosheng-g wants to merge 10 commits intomainfrom
Open
feat: add GitHub Action usage metrics for telemetry#475cocosheng-g wants to merge 10 commits intomainfrom
cocosheng-g wants to merge 10 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. |
905f30f to
6303b92
Compare
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. |
489ea8d to
1093e33
Compare
…emetry tracking across different workflows
…correct P0 telemetry
…kflows to improve clarity
…puts for strongly-typed telemetry
d31934f to
31ce6ef
Compare
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-cliGitHub 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:
github_item_numberwith two specific inputs:github_pr_numberandgithub_issue_number.github_issue_numbersupports both single issue numbers and comma-separated lists for batch tracking. This ensures that Pull Requests and Issues are logged to distinct fields, providing maximum accuracy for downstream analytics.GH_WORKFLOW_NAME,GH_PR_NUMBER, andGH_ISSUE_NUMBERto theInstall Gemini CLIstep to ensure extension installations are properly tracked.scripts/collector-gcp.yaml.templateto include specific resource attributes forgithub.pr.numberandgithub.issue.number.Example Telemetry Scenarios
Because the CLI appends these context fields to the
baseMetadataof 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-reviewworkflow, 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-triageworkflow, 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": 174, "value": "101,102,103" } // GH_ISSUE_NUMBER ] ] }Analysts can split the
gh_issue_numberstring by commas to count exactly 3 unique issues processed during a scheduled invocation.Related Issues