|
| 1 | +--- |
| 2 | +title: Lines of Code metrics |
| 3 | +shortTitle: Copilot LoC metrics |
| 4 | +intro: Understand how Lines of Code metrics measure {% data variables.product.prodname_copilot_short %}’s output and what factors affect their coverage and accuracy. |
| 5 | +permissions: Enterprise owners and billing managers |
| 6 | +versions: |
| 7 | + feature: copilot |
| 8 | +redirect_from: |
| 9 | + - /early-access/copilot-metrics/LoC |
| 10 | + - /early-access/copilot-metrics/LoC/about-the-copilot-metrics-LoC |
| 11 | +topics: |
| 12 | + - Copilot |
| 13 | +contentType: reference |
| 14 | +allowTitleToDifferFromFilename: true |
| 15 | +--- |
| 16 | + |
| 17 | +{% data reusables.copilot.usage-metrics-preview %} |
| 18 | + |
| 19 | +Lines of Code (LoC) metrics offer a directional way to measure {% data variables.product.prodname_copilot_short %}’s tangible output. These metrics quantify how many lines {% data variables.product.prodname_copilot_short %} suggested, added, or deleted in the editor—helping enterprise administrators understand {% data variables.product.prodname_copilot_short %}’s contribution to the codebase over time. |
| 20 | + |
| 21 | +LoC metrics may vary across IDEs and versions. Keep the following considerations in mind: |
| 22 | + |
| 23 | +* **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. |
| 24 | +* **Stability:** As {% data variables.product.prodname_copilot_short %} evolves, telemetry definitions may change. Expect small shifts in data as accuracy improves over time. |
| 25 | + |
| 26 | +## Version requirements |
| 27 | + |
| 28 | +LoC metrics require specific minimum versions of IDEs and {% data variables.product.prodname_copilot_short %} plugins to function. Users on older versions will not contribute LoC data, which may lead to underreporting until they upgrade. |
| 29 | + |
| 30 | +| IDE | Feature | Minimum IDE version | Minimum {% data variables.copilot.copilot_chat_short %} extension version | |
| 31 | +|:--|:--|:--|:--| |
| 32 | +| Eclipse | <ul><li>`code_completion`</li></ul> | 4.31 | 0.9.3.202507240902 | |
| 33 | +| | <ul><li>`chat_panel` (Ask, Edit, Agent)</li></ul> | 4.31 | 0.11.0.202508291001 | |
| 34 | +| | <ul><li>`agent_edit`</li></ul> | 4.31 | 0.10.0.202508110512 | |
| 35 | +| IntelliJ/JetBrains | <ul><li>`code_completion`</li><li>`chat_panel` (Ask, Edit, Agent)</li><li>`chat_inline`</li><li>`agent_edit`</li></ul> | 2024.2.6 | 1.5.52-241 | |
| 36 | +| {% data variables.product.prodname_vs %} | <ul><li>`code_completion`</li><li>`chat_panel` (Ask, Edit, Agent)</li></ul> | 17.14.13 | 18.0.471.29466 | |
| 37 | +| | <ul><li>`chat_inline`</li><li>`agent_edit`</li></ul> | 17.14.14 | 18.0.471.29466 | |
| 38 | +| {% data variables.product.prodname_vscode_shortname %} | <ul><li>`code_completion`</li></ul> | 1.104.0 | 0.31.0 | |
| 39 | +| | <ul><li>`chat_panel` (Ask, Edit, Agent)</li></ul> | 1.102.0 | 0.29.0 | |
| 40 | +| | <ul><li>`chat_inline`</li></ul> | 1.103.2 | 0.30.3 | |
| 41 | +| | <ul><li>`agent_edit`</li></ul> | 1.103.0 | 0.30.0 | |
| 42 | +| XCode | <ul><li>`code_completion`</li></ul> | 14.3.1 | 0.40.0 | |
| 43 | +| | <ul><li>`chat_panel` (Ask, Edit, Agent)</li></ul> | 15.0 | 0.43.0 | |
| 44 | +| | <ul><li>`agent_edit`</li></ul> | 15.2 | 0.41.0 | |
| 45 | + |
| 46 | +## Available LoC metrics |
| 47 | + |
| 48 | +LoC metrics **are** included in: |
| 49 | + |
| 50 | +* The {% data variables.product.prodname_copilot_short %} user-level report |
| 51 | +* The {% data variables.product.prodname_copilot_short %} usage metrics API |
| 52 | + |
| 53 | +They are **not** included in the {% data variables.product.prodname_copilot_short %} usage metrics dashboard. |
| 54 | + |
| 55 | +LoC metrics measure {% data variables.product.prodname_copilot_short %}’s activity across completions, chat, and agent features. For detailed field descriptions and definitions, see [AUTOTITLE](/copilot/reference/copilot-usage-metrics/copilot-usage-metrics#api-and-export-fields). |
| 56 | + |
| 57 | +## How agent mode affects LoC metrics |
| 58 | + |
| 59 | +Unlike completions or chat, {% data variables.copilot.copilot_agent_short %} 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. |
| 60 | + |
| 61 | +| Behavior | How it’s reflected in LoC metrics | |
| 62 | +|:--|:--| |
| 63 | +| Agent code suggestions | Counted as `loc_suggested_to_add_sum` when visible code blocks are shown in the chat panel. | |
| 64 | +| Agent edits in files | Counted as `loc_added_sum` and `loc_deleted_sum` under the `agent_edit` feature bucket. These edits are not included in suggested metrics. | |
| 65 | +| Multi-file operations | Each file edit contributes to total added and deleted lines, even if triggered by one prompt. | |
| 66 | + |
| 67 | +Example output for agent-related LoC activity: |
| 68 | + |
| 69 | +```json |
| 70 | +"totals_by_language_feature": [ |
| 71 | + { |
| 72 | + "language": "unknown", |
| 73 | + "feature": "chat_panel_agent_mode", |
| 74 | + "code_generation_activity_count": 12, |
| 75 | + "code_acceptance_activity_count": 0, |
| 76 | + "loc_suggested_to_add_sum": 86, // code block suggestions in chat panel in agent mode |
| 77 | + "loc_suggested_to_delete_sum": 0, |
| 78 | + "loc_added_sum": 5, // only includes code block copy or apply in chat panel, not agent edits |
| 79 | + "loc_deleted_sum": 0 |
| 80 | + }, |
| 81 | + { |
| 82 | + "language": "unknown", |
| 83 | + "feature": "agent_edit", |
| 84 | + "code_generation_activity_count": 345, |
| 85 | + "code_acceptance_activity_count": 0, |
| 86 | + "loc_suggested_to_add_sum": 0, |
| 87 | + "loc_suggested_to_delete_sum": 0, |
| 88 | + "loc_added_sum": 2342, // agent and edit mode edits in files |
| 89 | + "loc_deleted_sum": 947 |
| 90 | + } |
| 91 | +] |
| 92 | +``` |
| 93 | + |
| 94 | +For a single agent edit, you may see metrics such as: |
| 95 | + |
| 96 | +```json |
| 97 | +"user_initiated_interaction_count": 0, |
| 98 | +"code_generation_activity_count": 1, |
| 99 | +"code_acceptance_activity_count": 0 |
| 100 | +``` |
0 commit comments