Skip to content

Commit 4cd1270

Browse files
committed
chore: Rename Copilot metrics Cli identifiers to CLI
Go initialism convention requires acronyms to be all caps. Rename the Go identifiers introduced for the Copilot metrics download helpers so that "CLI" is written as an initialism: - `CopilotMetricsCli` -> `CopilotMetricsCLI` - `CopilotMetricsCliVersion` -> `CopilotMetricsCLIVersion` - `CopilotMetricsCliTokenUsage` -> `CopilotMetricsCLITokenUsage` - `CliVersion`, `LastKnownCliVersion`, `DailyActiveCliUsers`, `TotalsByCli`, and `UsedCli` field renames accordingly JSON tags on the wire (`cli_version`, `used_cli`, `totals_by_cli`, `last_known_cli_version`, `daily_active_cli_users`) are left unchanged so the decoder still matches the GitHub API payload. Also add `"CLI"` to the `structfield` linter's initialism list so the rule catches future regressions. Accessors are regenerated.
1 parent 4d3d757 commit 4cd1270

5 files changed

Lines changed: 104 additions & 104 deletions

File tree

github/copilot.go

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -931,34 +931,34 @@ type CopilotMetricsModelFeature struct {
931931
LocDeletedSum int `json:"loc_deleted_sum"`
932932
}
933933

934-
// CopilotMetricsCliVersion represents the last known Copilot CLI version seen in a metrics report.
935-
type CopilotMetricsCliVersion struct {
934+
// CopilotMetricsCLIVersion represents the last known Copilot CLI version seen in a metrics report.
935+
type CopilotMetricsCLIVersion struct {
936936
SampledAt *Timestamp `json:"sampled_at,omitempty"`
937-
CliVersion string `json:"cli_version"`
937+
CLIVersion string `json:"cli_version"`
938938
}
939939

940-
// CopilotMetricsCliTokenUsage represents Copilot CLI token totals in a metrics report.
941-
type CopilotMetricsCliTokenUsage struct {
940+
// CopilotMetricsCLITokenUsage represents Copilot CLI token totals in a metrics report.
941+
type CopilotMetricsCLITokenUsage struct {
942942
AvgTokensPerRequest float64 `json:"avg_tokens_per_request"`
943943
OutputTokensSum int `json:"output_tokens_sum"`
944944
PromptTokensSum int `json:"prompt_tokens_sum"`
945945
}
946946

947-
// CopilotMetricsCli represents Copilot CLI totals in a metrics report.
948-
type CopilotMetricsCli struct {
947+
// CopilotMetricsCLI represents Copilot CLI totals in a metrics report.
948+
type CopilotMetricsCLI struct {
949949
SessionCount int `json:"session_count"`
950950
RequestCount int `json:"request_count"`
951951
PromptCount int `json:"prompt_count"`
952-
TokenUsage *CopilotMetricsCliTokenUsage `json:"token_usage,omitempty"`
953-
LastKnownCliVersion *CopilotMetricsCliVersion `json:"last_known_cli_version,omitempty"`
952+
TokenUsage *CopilotMetricsCLITokenUsage `json:"token_usage,omitempty"`
953+
LastKnownCLIVersion *CopilotMetricsCLIVersion `json:"last_known_cli_version,omitempty"`
954954
}
955955

956956
// CopilotDailyMetrics represents the payload downloaded from a 1-day Copilot usage metrics report.
957957
type CopilotDailyMetrics struct {
958958
Day string `json:"day"`
959959
OrganizationID string `json:"organization_id"`
960960
EnterpriseID string `json:"enterprise_id"`
961-
DailyActiveCliUsers int `json:"daily_active_cli_users"`
961+
DailyActiveCLIUsers int `json:"daily_active_cli_users"`
962962
DailyActiveUsers int `json:"daily_active_users"`
963963
DailyActiveCopilotCloudAgentUsers int `json:"daily_active_copilot_cloud_agent_users"`
964964
WeeklyActiveUsers int `json:"weekly_active_users"`
@@ -975,7 +975,7 @@ type CopilotDailyMetrics struct {
975975
TotalsByLanguageFeature []*CopilotMetricsLanguageFeature `json:"totals_by_language_feature,omitempty"`
976976
TotalsByLanguageModel []*CopilotMetricsLanguageModel `json:"totals_by_language_model,omitempty"`
977977
TotalsByModelFeature []*CopilotMetricsModelFeature `json:"totals_by_model_feature,omitempty"`
978-
TotalsByCli *CopilotMetricsCli `json:"totals_by_cli,omitempty"`
978+
TotalsByCLI *CopilotMetricsCLI `json:"totals_by_cli,omitempty"`
979979
LocSuggestedToAddSum int `json:"loc_suggested_to_add_sum"`
980980
LocSuggestedToDeleteSum int `json:"loc_suggested_to_delete_sum"`
981981
LocAddedSum int `json:"loc_added_sum"`
@@ -1039,10 +1039,10 @@ type CopilotUserDailyMetrics struct {
10391039
TotalsByLanguageFeature []*CopilotMetricsLanguageFeature `json:"totals_by_language_feature,omitempty"`
10401040
TotalsByLanguageModel []*CopilotMetricsLanguageModel `json:"totals_by_language_model,omitempty"`
10411041
TotalsByModelFeature []*CopilotMetricsModelFeature `json:"totals_by_model_feature,omitempty"`
1042-
TotalsByCli *CopilotMetricsCli `json:"totals_by_cli,omitempty"`
1042+
TotalsByCLI *CopilotMetricsCLI `json:"totals_by_cli,omitempty"`
10431043
UsedAgent bool `json:"used_agent"`
10441044
UsedChat bool `json:"used_chat"`
1045-
UsedCli bool `json:"used_cli"`
1045+
UsedCLI bool `json:"used_cli"`
10461046
UsedCopilotCodeReviewActive bool `json:"used_copilot_code_review_active"`
10471047
UsedCopilotCodeReviewPassive bool `json:"used_copilot_code_review_passive"`
10481048
UsedCopilotCodingAgent bool `json:"used_copilot_coding_agent"`
@@ -1071,10 +1071,10 @@ type CopilotUserPeriodicMetrics struct {
10711071
TotalsByLanguageFeature []*CopilotMetricsLanguageFeature `json:"totals_by_language_feature,omitempty"`
10721072
TotalsByLanguageModel []*CopilotMetricsLanguageModel `json:"totals_by_language_model,omitempty"`
10731073
TotalsByModelFeature []*CopilotMetricsModelFeature `json:"totals_by_model_feature,omitempty"`
1074-
TotalsByCli *CopilotMetricsCli `json:"totals_by_cli,omitempty"`
1074+
TotalsByCLI *CopilotMetricsCLI `json:"totals_by_cli,omitempty"`
10751075
UsedAgent bool `json:"used_agent"`
10761076
UsedChat bool `json:"used_chat"`
1077-
UsedCli bool `json:"used_cli"`
1077+
UsedCLI bool `json:"used_cli"`
10781078
UsedCopilotCodeReviewActive bool `json:"used_copilot_code_review_active"`
10791079
UsedCopilotCodeReviewPassive bool `json:"used_copilot_code_review_passive"`
10801080
UsedCopilotCodingAgent bool `json:"used_copilot_coding_agent"`

github/copilot_test.go

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2977,7 +2977,7 @@ func TestCopilotService_DownloadDailyMetrics(t *testing.T) {
29772977
want := &CopilotDailyMetrics{
29782978
Day: "2026-04-01",
29792979
OrganizationID: "123",
2980-
DailyActiveCliUsers: 2,
2980+
DailyActiveCLIUsers: 2,
29812981
DailyActiveUsers: 10,
29822982
WeeklyActiveUsers: 20,
29832983
MonthlyActiveUsers: 30,
@@ -2996,11 +2996,11 @@ func TestCopilotService_DownloadDailyMetrics(t *testing.T) {
29962996
TotalsByModelFeature: []*CopilotMetricsModelFeature{
29972997
{Model: "m1", Feature: "completion", UserInitiatedInteractionCount: 5},
29982998
},
2999-
TotalsByCli: &CopilotMetricsCli{
2999+
TotalsByCLI: &CopilotMetricsCLI{
30003000
SessionCount: 3,
30013001
RequestCount: 4,
30023002
PromptCount: 2,
3003-
TokenUsage: &CopilotMetricsCliTokenUsage{
3003+
TokenUsage: &CopilotMetricsCLITokenUsage{
30043004
AvgTokensPerRequest: 4123.5,
30053005
OutputTokensSum: 7000,
30063006
PromptTokensSum: 9494,
@@ -3098,13 +3098,13 @@ func TestCopilotService_DownloadPeriodicMetrics(t *testing.T) {
30983098
DayTotals: []*CopilotDailyMetrics{
30993099
{
31003100
Day: "2026-03-05",
3101-
DailyActiveCliUsers: 2,
3101+
DailyActiveCLIUsers: 2,
31023102
DailyActiveUsers: 5,
3103-
TotalsByCli: &CopilotMetricsCli{
3103+
TotalsByCLI: &CopilotMetricsCLI{
31043104
SessionCount: 1,
31053105
RequestCount: 2,
31063106
PromptCount: 1,
3107-
TokenUsage: &CopilotMetricsCliTokenUsage{
3107+
TokenUsage: &CopilotMetricsCLITokenUsage{
31083108
AvgTokensPerRequest: 4000.0,
31093109
OutputTokensSum: 5000,
31103110
PromptTokensSum: 3000,
@@ -3175,15 +3175,15 @@ func TestCopilotService_DownloadUserDailyMetrics(t *testing.T) {
31753175
Day: "2026-04-01",
31763176
UserInitiatedInteractionCount: 5,
31773177
UsedChat: true,
3178-
UsedCli: true,
3178+
UsedCLI: true,
31793179
UsedCopilotCodeReviewActive: true,
3180-
TotalsByCli: &CopilotMetricsCli{
3180+
TotalsByCLI: &CopilotMetricsCLI{
31813181
SessionCount: 2,
31823182
RequestCount: 2,
31833183
PromptCount: 1,
3184-
LastKnownCliVersion: &CopilotMetricsCliVersion{
3184+
LastKnownCLIVersion: &CopilotMetricsCLIVersion{
31853185
SampledAt: &Timestamp{time.Date(2026, 4, 1, 12, 30, 0, 0, time.UTC)},
3186-
CliVersion: "1.0.8",
3186+
CLIVersion: "1.0.8",
31873187
},
31883188
},
31893189
TotalsByIDE: []*CopilotUserMetricsIDE{
@@ -3288,14 +3288,14 @@ func TestCopilotService_DownloadUserPeriodicMetrics(t *testing.T) {
32883288
Day: "2026-03-06",
32893289
UserID: 1,
32903290
UserLogin: "alice",
3291-
UsedCli: true,
3291+
UsedCLI: true,
32923292
UsedCopilotCodeReviewPassive: true,
32933293
UsedCopilotCodingAgent: true,
3294-
TotalsByCli: &CopilotMetricsCli{
3294+
TotalsByCLI: &CopilotMetricsCLI{
32953295
SessionCount: 1,
32963296
RequestCount: 3,
32973297
PromptCount: 2,
3298-
TokenUsage: &CopilotMetricsCliTokenUsage{
3298+
TokenUsage: &CopilotMetricsCLITokenUsage{
32993299
AvgTokensPerRequest: 1200.5,
33003300
OutputTokensSum: 2400,
33013301
PromptTokensSum: 1201,

github/github-accessors.go

Lines changed: 32 additions & 32 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)