Skip to content

Telemetry: GEMINI_CLI_WORKFLOW_NAME is null in metric events #492

@cocosheng-g

Description

@cocosheng-g

Problem

The GEMINI_CLI_WORKFLOW_NAME (or github_workflow_name) is consistently appearing as null in metric events for customer-triggered runs of the run-gemini-cli action.

Findings

During investigation of the telemetry flow, we found two reasons why this field is missing:

  1. Missing from Collector Config (Action Repo): In action.yml and scripts/collector-gcp.yaml.template, we explicitly inject repository, run ID, PR number, and issue number into the telemetry data using sed replacements. However, there is no entry for the workflow name in this list, so it doesn't get added by the collector.
  2. Missing from CLI's Common Attributes (CLI Repo): The CLI's OpenTelemetry SDK initialization in sdk.ts (and getCommonAttributes in telemetryAttributes.ts) does not include the workflow name in the resource attributes. It only includes session ID, installation ID, and interactive mode.

Proposed Solutions

  • Option A: Update collector-gcp.yaml.template and action.yml in the action repo to inject the workflow name as a resource attribute (e.g., github.workflow). This is preferred as it doesn't require a CLI release.
  • Option B: Modify the CLI codebase (sdk.ts) to read GH_WORKFLOW_NAME from the environment and add it to the OpenTelemetry resource attributes.

Metadata

Metadata

Assignees

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions