Skip to main content

代码行指标

了解代码行数指标如何衡量 Copilot 的输出,以及哪些因素影响其覆盖范围和准确性。

谁可以使用此功能?

企业所有者、计费经理和具有“查看企业 Copilot 指标”权限的企业自定义角色的人员

注意

GitHub Copilot usage metrics are currently in public preview with data protection and subject to change.

Lines of Code (LoC) metrics provide a directional measure of Copilot’s output by quantifying the lines it suggested, added, or deleted across completions, chat, and agent features.

Where LoC metrics appear

You may encounter LoC metrics in:

This article covers how LoC is measured and what affects its accuracy and coverage. For detailed definitions, refer to the reference article above.

Considerations for LoC metrics

LoC metrics may vary across IDEs and versions. Keep the following considerations in mind:

  • Coverage: Not all IDEs and users will emit LoC telemetry until they upgrade to the required versions. Reports include the last_known_ide_version and last_known_plugin_version fields so you can monitor coverage across your enterprise.
  • Stability: As Copilot evolves, telemetry definitions may change. Expect small shifts in data as accuracy improves over time.

Version requirements

LoC metrics require specific minimum versions of IDEs and Copilot plugins to function. Users on older versions will not contribute LoC data, which may lead to underreporting until they upgrade.

IDEFeatureMinimum IDE versionMinimum Copilot Chat extension version
Eclipse
  • code_completion
4.310.9.3.202507240902
  • chat_panel (Ask, Edit, Agent)
4.310.11.0.202508291001
  • agent_edit
4.310.10.0.202508110512
IntelliJ/JetBrains
  • code_completion
  • chat_panel (Ask, Edit, Agent)
  • chat_inline
  • agent_edit
2024.2.61.5.52-241
Visual Studio
  • code_completion
  • chat_panel (Ask, Edit, Agent)
17.14.1318.0.471.29466
  • chat_inline
  • agent_edit
17.14.1418.0.471.29466
VS Code
  • code_completion
1.104.00.31.0
  • chat_panel (Ask, Edit, Agent)
1.102.00.29.0
  • chat_inline
1.103.20.30.3
  • agent_edit
1.103.00.30.0
XCode
  • code_completion
14.3.10.40.0
  • chat_panel (Ask, Edit, Agent)
15.00.43.0
  • agent_edit
15.20.41.0

How agent mode affects LoC metrics

Unlike completions or chat, Copilot agent does not follow a “suggest then accept” flow. Agents plan and execute multi-step tasks, often editing multiple files iteratively without explicit acceptance by the user. Because of this, LoC metrics for agent activity are measured differently.

BehaviorHow it’s reflected in LoC metrics
Agent code suggestionsCounted as loc_suggested_to_add_sum when visible code blocks are shown in the chat panel.
Agent edits in filesCounted as loc_added_sum and loc_deleted_sum under the agent_edit feature bucket. These edits are not included in suggested metrics.
Multi-file operationsEach file edit contributes to total added and deleted lines, even if triggered by one prompt.

Example output for agent-related LoC activity:

"totals_by_language_feature": [
  {
    "language": "unknown",
    "feature": "chat_panel_agent_mode",
    "code_generation_activity_count": 12,
    "code_acceptance_activity_count": 0,
    "loc_suggested_to_add_sum": 86, // code block suggestions in chat panel in agent mode
    "loc_suggested_to_delete_sum": 0,
    "loc_added_sum": 5, // only includes code block copy or apply in chat panel, not agent edits
    "loc_deleted_sum": 0
  },
  {
    "language": "unknown",
    "feature": "agent_edit",
    "code_generation_activity_count": 345,
    "code_acceptance_activity_count": 0,
    "loc_suggested_to_add_sum": 0,
    "loc_suggested_to_delete_sum": 0,
    "loc_added_sum": 2342, // agent and edit mode edits in files
    "loc_deleted_sum": 947
  }
]

For a single agent edit, you may see metrics such as:

"user_initiated_interaction_count": 0,
"code_generation_activity_count": 1,
"code_acceptance_activity_count": 0