GitLabgitlab-org
cli
main
1//go:build !integration
3package main
5import (
6 "bytes"
7 "context"
8 "encoding/json"
9 "errors"
10 "net/http"
11 "net/http/httptest"
12 "os"
13 "path/filepath"
14 "runtime"
15 "slices"
16 "strings"
17 "sync"
18 "testing"
19 "time"
21 retryablehttp "github.com/hashicorp/go-retryablehttp"
22 "github.com/spf13/cobra"
23 "github.com/stretchr/testify/assert"
24 "github.com/stretchr/testify/require"
26 gitlab "gitlab.com/gitlab-org/api/client-go/v3"
28 "gitlab.com/gitlab-org/cli/internal/api"
29 "gitlab.com/gitlab-org/cli/internal/cmdutils"
30 "gitlab.com/gitlab-org/cli/internal/commands"
31 "gitlab.com/gitlab-org/cli/internal/commands/alias/expand"
32 apiCmd "gitlab.com/gitlab-org/cli/internal/commands/api"
33 "gitlab.com/gitlab-org/cli/internal/config"
34 "gitlab.com/gitlab-org/cli/internal/testing/cmdtest"
35)
37// telemetryServer wires the factory to a server that records the request the
38// hook actually puts on the wire. The send bypasses client-go's typed service
39// so it can carry project_path, which makes the wire format worth asserting.
40func telemetryServer(t *testing.T, opts ...cmdtest.FactoryOption) (cmdutils.Factory, func() []trackEventOptions) {
41 t.Helper()
43 // Recorded rather than asserted in the handler: it runs on the server's
44 // goroutine, where require must not be called.
45 type recorded struct {
46 method string
47 path string
48 body trackEventOptions
49 err error
50 }
52 var mu sync.Mutex
53 var seen []recorded
55 srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
56 var body trackEventOptions
57 err := json.NewDecoder(r.Body).Decode(&body)
59 mu.Lock()
60 seen = append(seen, recorded{method: r.Method, path: r.URL.Path, body: body, err: err})
61 mu.Unlock()
63 w.Header().Set("Content-Type", "application/json")
64 _, _ = w.Write([]byte(`{}`))
65 }))
66 t.Cleanup(srv.Close)
68 host := strings.TrimPrefix(srv.URL, "http://")
69 ios, _, _, _ := cmdtest.TestIOStreams(cmdtest.WithTestIOStreamsAsTTY(true))
70 // The default base URL is https; the test server speaks http.
71 client := cmdtest.NewTestApiClient(t, srv.Client(), "token", host, api.WithBaseURL(srv.URL+"/api/v4"))
73 factoryOpts := append([]cmdtest.FactoryOption{cmdtest.WithGitLabClient(client.Lab())}, opts...)
75 return cmdtest.NewTestFactory(ios, factoryOpts...), func() []trackEventOptions {
76 t.Helper()
78 mu.Lock()
79 defer mu.Unlock()
81 events := make([]trackEventOptions, 0, len(seen))
82 for _, rec := range seen {
83 require.NoError(t, rec.err, "telemetry body must be valid JSON")
84 require.Equal(t, http.MethodPost, rec.method)
85 require.Equal(t, "/api/v4/usage_data/track_event", rec.path)
86 events = append(events, rec.body)
87 }
88 return events
89 }
90}
92func Test_sendTelemetryData(t *testing.T) {
93 tests := []struct {
94 name string
95 cobraMocks []*cobra.Command
96 command string
97 subcommand string
98 fullCommand string
99 }{
100 {
101 name: "command with subcommand",
102 cobraMocks: []*cobra.Command{{Use: "glab"}, {Use: "mr"}, {Use: "view"}},
103 command: "mr",
104 subcommand: "view",
105 fullCommand: "mr view",
106 },
107 {
108 name: "command with multiple subcommands",
109 cobraMocks: []*cobra.Command{{Use: "glab"}, {Use: "command"}, {Use: "subcommand1"}, {Use: "subcommand2"}},
110 command: "command",
111 subcommand: "subcommand1 subcommand2",
112 fullCommand: "command subcommand1 subcommand2",
113 },
114 {
115 name: "single command only",
116 cobraMocks: []*cobra.Command{{Use: "glab"}, {Use: "version"}},
117 command: "version",
118 subcommand: "",
119 fullCommand: "version",
120 },
121 }
123 for _, tt := range tests {
124 t.Run(tt.name, func(t *testing.T) {
125 f, sent := telemetryServer(t)
127 passedCommand := tt.cobraMocks[0]
128 for i, cmd := range tt.cobraMocks {
129 if i > 0 {
130 tt.cobraMocks[i-1].AddCommand(cmd)
131 passedCommand = cmd
132 }
133 }
135 sendTelemetryData(f, passedCommand)
137 require.Equal(t, []trackEventOptions{{
138 Event: "gitlab_cli_command_used",
139 ProjectPath: "OWNER/REPO",
140 SendToSnowplow: new(true),
141 AdditionalProperties: map[string]string{
142 "label": tt.command,
143 "property": tt.subcommand,
144 "command_and_subcommand": tt.fullCommand,
145 "cli_version": "test",
146 "platform": runtime.GOOS,
147 "architecture": runtime.GOARCH,
148 },
149 }}, sent())
150 })
151 }
152}
154func Test_buildTelemetryEvent_codingAgent(t *testing.T) {
155 tests := []struct {
156 name string
157 codingAgent string
158 want string
159 wantPresent bool
160 }{
161 {name: "agent detected", codingAgent: "claude-code", want: "claude-code", wantPresent: true},
162 {name: "no agent detected", codingAgent: "", wantPresent: false},
163 }
165 for _, tt := range tests {
166 t.Run(tt.name, func(t *testing.T) {
167 f, _ := telemetryServer(t, cmdtest.WithBuildInfo(api.BuildInfo{
168 Version: "v1.2.3",
169 Platform: "linux",
170 Architecture: "amd64",
171 CodingAgent: tt.codingAgent,
172 }))
174 _, event, ok := buildTelemetryEvent(f, "version", "", "version")
175 require.True(t, ok)
177 agent, present := event.AdditionalProperties["coding_agent"]
178 require.Equal(t, tt.wantPresent, present)
179 require.Equal(t, tt.want, agent)
181 require.Equal(t, "v1.2.3", event.AdditionalProperties["cli_version"])
182 require.Equal(t, "linux", event.AdditionalProperties["platform"])
183 require.Equal(t, "amd64", event.AdditionalProperties["architecture"])
184 })
185 }
186}
188func Test_addTelemetryHook_blocksUntilEventIsSent(t *testing.T) {
189 // The hook used to spawn an unjoined goroutine, so glab exited before the
190 // event was sent for every command that did not linger afterwards.
191 f, sent := telemetryServer(t)
193 root := &cobra.Command{Use: "glab"}
194 version := &cobra.Command{Use: "version", Run: func(*cobra.Command, []string) {}}
195 root.AddCommand(version)
197 args := []string{"version"}
198 root.SetArgs(args)
199 hook := addTelemetryHook(f, root, args)
200 require.NoError(t, root.Execute())
201 hook()
203 events := sent()
204 require.Len(t, events, 1, "hook returned before the telemetry event was sent")
205 require.Equal(t, "version", events[0].AdditionalProperties["command_and_subcommand"])
206}
208func Test_addTelemetryHook_commandAttribution(t *testing.T) {
209 tests := []struct {
210 name string
211 argv []string
212 fullCommand string
213 }{
214 {
215 name: "ordinary command",
216 argv: []string{"glab", "mr", "list"},
217 fullCommand: "mr list",
218 },
219 {
220 name: "user alias",
221 argv: []string{"glab", "co", "123"},
222 fullCommand: "mr checkout",
223 },
224 {
225 name: "flag before command",
226 argv: []string{"glab", "--output", "json", "mr", "list"},
227 fullCommand: "mr list",
228 },
229 {
230 name: "repo override before command",
231 argv: []string{"glab", "-R", "ns/repo", "mr", "view"},
232 fullCommand: "mr view",
233 },
234 {
235 name: "flag before subcommand",
236 argv: []string{"glab", "mr", "--output", "json", "list"},
237 fullCommand: "mr list",
238 },
239 }
241 for _, tt := range tests {
242 t.Run(tt.name, func(t *testing.T) {
243 f, sent := telemetryServer(t)
244 root := commands.NewCmdRoot(f)
245 cfg := config.NewFromString("aliases:\n co: mr checkout\n")
246 expandedArgs, isShell, err := expand.ExpandAlias(cfg, tt.argv, nil)
247 require.NoError(t, err)
248 require.False(t, isShell)
250 addTelemetryHook(f, root, expandedArgs)()
252 events := sent()
253 require.Len(t, events, 1)
254 assert.Equal(t, tt.fullCommand, events[0].AdditionalProperties["command_and_subcommand"])
255 })
256 }
257}
259func Test_addTelemetryHook_shellCompletion(t *testing.T) {
260 for _, name := range []string{cobra.ShellCompRequestCmd, cobra.ShellCompNoDescRequestCmd} {
261 t.Run(name, func(t *testing.T) {
262 f, sent := telemetryServer(t)
263 root := commands.NewCmdRoot(f)
264 args := []string{name, "auth", "logout", "--hostnam"}
265 var stdout, stderr bytes.Buffer
266 root.SetOut(&stdout)
267 root.SetErr(&stderr)
268 root.SetArgs(args)
270 hook := addTelemetryHook(f, root, args)
271 require.NoError(t, root.Execute())
272 hook()
274 require.Contains(t, stdout.String(), "--hostname")
275 require.Contains(t, stdout.String(), ":4\n")
276 if name == cobra.ShellCompRequestCmd {
277 require.Contains(t, stdout.String(), "\tThe hostname of the GitLab instance.")
278 } else {
279 require.NotContains(t, stdout.String(), "\t")
280 }
281 require.Empty(t, sent(), "shell completion must not send telemetry")
282 })
283 }
284}
286func requestDeadline(t *testing.T, opts []gitlab.RequestOptionFunc) (time.Time, bool) {
287 t.Helper()
289 req, err := retryablehttp.NewRequest(http.MethodGet, "https://gitlab.example.com", nil)
290 require.NoError(t, err)
291 for _, opt := range opts {
292 require.NoError(t, opt(req))
293 }
294 return req.Context().Deadline()
295}
297func Test_telemetryRequestOptions_boundsTheRequest(t *testing.T) {
298 t.Parallel()
300 ctx, cancel := context.WithTimeout(t.Context(), telemetrySendTimeout)
301 defer cancel()
303 deadline, bounded := requestDeadline(t, telemetryRequestOptions(ctx))
305 require.True(t, bounded, "the request must carry a deadline so it cannot hold up exit")
306 require.False(t, deadline.After(time.Now().Add(telemetrySendTimeout)), "deadline exceeds telemetrySendTimeout")
307}
309func Test_sendTelemetryData_skipsMachineInvokedCommands(t *testing.T) {
310 // These run from shell startup files and from git. A blocking network call
311 // there is exactly what ShouldSkipUpdate already avoids.
312 for _, path := range []string{"completion", "auth git-credential", "auth credential-helper"} {
313 t.Run(path, func(t *testing.T) {
314 f, sent := telemetryServer(t)
316 cmd := &cobra.Command{Use: "glab"}
317 for name := range strings.SplitSeq(path, " ") {
318 child := &cobra.Command{Use: name}
319 cmd.AddCommand(child)
320 cmd = child
321 }
323 sendTelemetryData(f, cmd)
325 require.Empty(t, sent(), "no event may be sent for a machine-invoked command")
326 })
327 }
328}
330func Test_sendTelemetryData_skipsAgentHookRuns(t *testing.T) {
331 newSync := func() *cobra.Command {
332 root := &cobra.Command{Use: "glab"}
333 minder := &cobra.Command{Use: "minder"}
334 audit := &cobra.Command{Use: "audit"}
335 sync := &cobra.Command{Use: "sync"}
336 sync.Flags().String("hook", "", "")
337 root.AddCommand(minder)
338 minder.AddCommand(audit)
339 audit.AddCommand(sync)
340 return sync
341 }
343 t.Run("with --hook", func(t *testing.T) {
344 f, sent := telemetryServer(t)
345 cmd := newSync()
346 require.NoError(t, cmd.Flags().Set("hook", "codex"))
348 sendTelemetryData(f, cmd)
350 require.Empty(t, sent(), "the agent waits for its hook, and the glab it starts sends the event")
351 })
353 t.Run("without --hook", func(t *testing.T) {
354 f, sent := telemetryServer(t)
356 sendTelemetryData(f, newSync())
358 require.Len(t, sent(), 1)
359 })
360}
362func Test_ranFromAgentHook(t *testing.T) {
363 for _, name := range []string{"minder", "govern"} {
364 t.Run(name, func(t *testing.T) {
365 newRoot := func() *cobra.Command {
366 root := &cobra.Command{Use: "glab"}
367 group := &cobra.Command{Use: name}
368 audit := &cobra.Command{Use: "audit"}
369 sync := &cobra.Command{Use: "sync"}
370 sync.Flags().String("hook", "", "")
371 root.AddCommand(group)
372 group.AddCommand(audit)
373 audit.AddCommand(sync)
374 return root
375 }
376 args := []string{name, "audit", "sync", "--hook", "codex"}
378 root := newRoot()
379 cmd, _, err := root.Find(args)
380 require.NoError(t, err)
381 require.NoError(t, cmd.Flags().Set("hook", "codex"))
382 assert.True(t, ranFromAgentHook(root, args), "the update check would delay the agent and print to its hook")
384 assert.False(t, ranFromAgentHook(newRoot(), []string{name, "audit", "sync"}))
385 assert.False(t, ranFromAgentHook(newRoot(), []string{"no-such-command"}))
386 })
387 }
388}
390func Test_buildTelemetryEvent_sendsProjectPath(t *testing.T) {
391 t.Parallel()
393 // The instance resolves the path to project and namespace IDs, so glab
394 // never has to look them up.
395 t.Run("inside a repo", func(t *testing.T) {
396 t.Parallel()
398 f, _ := telemetryServer(t)
400 _, event, ok := buildTelemetryEvent(f, "version", "", "version")
401 require.True(t, ok)
403 require.Equal(t, "OWNER/REPO", event.ProjectPath)
404 })
406 t.Run("outside a repo", func(t *testing.T) {
407 t.Parallel()
409 f, _ := telemetryServer(t, cmdtest.WithBaseRepoError(errors.New("no remotes")))
411 _, event, ok := buildTelemetryEvent(f, "version", "", "version")
412 require.True(t, ok)
414 require.Empty(t, event.ProjectPath)
415 })
416}
418func Test_trackEventOptions_encoding(t *testing.T) {
419 t.Parallel()
421 // project_path and project_id are mutually exclusive on the endpoint, so an
422 // empty path must be omitted rather than sent as "".
423 body, err := json.Marshal(&trackEventOptions{
424 Event: "gitlab_cli_command_used",
425 SendToSnowplow: new(true),
426 AdditionalProperties: map[string]string{
427 "label": "version",
428 },
429 })
430 require.NoError(t, err)
431 require.NotContains(t, string(body), "project_path")
433 body, err = json.Marshal(&trackEventOptions{
434 Event: "gitlab_cli_command_used",
435 ProjectPath: "OWNER/REPO",
436 })
437 require.NoError(t, err)
438 require.Contains(t, string(body), `"project_path":"OWNER/REPO"`)
439}
441func Test_noRetry(t *testing.T) {
442 t.Parallel()
444 // The client retries five times by default. For telemetry that turns an
445 // instant failure, such as a refused connection, into the full timeout on
446 // every command.
447 t.Run("never retries", func(t *testing.T) {
448 t.Parallel()
450 retry, err := noRetry(t.Context(), nil, errors.New("connection refused"))
452 require.False(t, retry)
453 require.NoError(t, err)
454 })
456 t.Run("surfaces context cancellation", func(t *testing.T) {
457 t.Parallel()
459 ctx, cancel := context.WithCancel(t.Context())
460 cancel()
462 retry, err := noRetry(ctx, nil, nil)
464 require.False(t, retry)
465 require.ErrorIs(t, err, context.Canceled)
466 })
467}
469func Test_telemetryRequestOptions_disablesRetries(t *testing.T) {
470 t.Parallel()
472 // Guards the pairing: a deadline alone still leaves retries burning it.
473 require.Len(t, telemetryRequestOptions(t.Context()), 2)
474}
476func Test_templateEndpoint(t *testing.T) {
477 t.Parallel()
479 tests := []struct {
480 name string
481 path string
482 want string
483 }{
484 {name: "no parameters", path: "/user", want: "/user"},
485 {name: "leading slash optional", path: "user", want: "/user"},
486 {name: "numeric project id", path: "projects/278964/merge_requests", want: "/projects/:id/merge_requests"},
487 {name: "encoded project path", path: "projects/gitlab-org%2Fcli/issues", want: "/projects/:id/issues"},
488 {name: "glab placeholder", path: "projects/:fullpath/merge_requests", want: "/projects/:id/merge_requests"},
489 {name: "nested parameters", path: "projects/1/merge_requests/2/notes", want: "/projects/:id/merge_requests/:id/notes"},
490 {name: "trailing slash", path: "/projects/1/issues/", want: "/projects/:id/issues"},
491 {name: "uppercase segment", path: "/Projects/1/Issues", want: "/projects/:id/issues"},
492 {name: "graphql", path: "graphql", want: "/graphql"},
494 // Indistinguishable from route nouns by shape: a heuristic templater
495 // would keep these verbatim.
496 {name: "username", path: "users/phikai/projects", want: "/users/:id/projects"},
497 {name: "branch name", path: "projects/1/repository/branches/my-feature", want: "/projects/:id/repository/branches/:id"},
498 {name: "file path", path: "projects/1/repository/files/src%2Fmain.go/raw", want: "/projects/:id/repository/files/:id/raw"},
500 {name: "unknown endpoint", path: "projects/1/not_a_real_resource", want: unmatchedEndpoint},
501 {name: "empty", path: "", want: unmatchedEndpoint},
502 {name: "root", path: "/", want: unmatchedEndpoint},
503 }
505 for _, tt := range tests {
506 t.Run(tt.name, func(t *testing.T) {
507 t.Parallel()
508 assert.Equal(t, tt.want, templateEndpoint(tt.path))
509 })
510 }
511}
513func Test_templateEndpoint_neverEmitsRequestData(t *testing.T) {
514 t.Parallel()
516 // Every value is either a route client-go knows or the sentinel, so no
517 // input can survive into the payload.
518 paths := []string{
519 "projects/1/issues?private_token=glpat-SECRET&search=confidential",
520 "projects/1/issues#fragment",
521 "users/phikai/projects",
522 "projects/1/repository/branches/release%2F17-0",
523 "projects/1/not_a_real_resource/glpat-SECRET",
524 "../../etc/passwd",
525 }
527 for _, path := range paths {
528 got := templateEndpoint(path)
529 assert.NotContains(t, got, "glpat", path)
530 assert.NotContains(t, got, "phikai", path)
531 assert.NotContains(t, got, "confidential", path)
532 assert.NotContains(t, got, "passwd", path)
534 if got != unmatchedEndpoint {
535 assert.True(t, slices.ContainsFunc(gitlab.Routes(), func(r gitlab.Route) bool {
536 return r.String() == got
537 }), "%q produced %q, which is not a route the client knows", path, got)
538 }
539 }
540}
542func Test_apiEventProperties(t *testing.T) {
543 t.Parallel()
545 t.Run("reports endpoint and method", func(t *testing.T) {
546 t.Parallel()
548 cmd := parseAPICommand(t, []string{"projects/278964/merge_requests", "--field", "title=x"})
550 assert.Equal(t, map[string]string{
551 "api_endpoint": "/projects/:id/merge_requests",
552 "http_method": "POST",
553 }, apiEventProperties(cmd))
554 })
556 t.Run("nil for other commands", func(t *testing.T) {
557 t.Parallel()
559 assert.Nil(t, apiEventProperties(&cobra.Command{Use: "mr"}))
560 })
562 t.Run("nil when no endpoint was given", func(t *testing.T) {
563 t.Parallel()
565 assert.Nil(t, apiEventProperties(parseAPICommand(t, nil)))
566 })
567}
569// parseAPICommand parses args into the real command, so a renamed flag fails
570// here rather than silently in production.
571func parseAPICommand(t *testing.T, args []string) *cobra.Command {
572 t.Helper()
574 ios, _, _, _ := cmdtest.TestIOStreams()
575 cmd := apiCmd.NewCmdApi(cmdtest.NewTestFactory(ios), nil)
577 require.NoError(t, cmd.Flags().Parse(args))
578 return cmd
579}
581func Test_parseCommand(t *testing.T) {
582 tests := []struct {
583 name string
584 cmdString []string
585 command string
586 subcommand string
587 fullCommand string
588 }{
589 {
590 name: "basic command",
591 cmdString: []string{"glab", "mr", "list"},
592 command: "mr",
593 subcommand: "list",
594 fullCommand: "mr list",
595 },
596 {
597 name: "multiple subcommands",
598 cmdString: []string{"glab", "command", "subcommand1", "subcommand2", "subcommand3"},
599 command: "command",
600 subcommand: "subcommand1 subcommand2 subcommand3",
601 fullCommand: "command subcommand1 subcommand2 subcommand3",
602 },
603 {
604 name: "no subcommand",
605 cmdString: []string{"glab", "mr"},
606 command: "mr",
607 subcommand: "",
608 fullCommand: "mr",
609 },
610 {
611 name: "too short of a command",
612 cmdString: []string{"glab"},
613 command: "",
614 subcommand: "",
615 fullCommand: "",
616 },
617 }
619 for _, tt := range tests {
620 t.Run(tt.name, func(t *testing.T) {
621 command, subcommand, fullCommand := parseCommand(tt.cmdString)
623 require := require.New(t)
624 require.Equal(tt.command, command)
625 require.Equal(tt.subcommand, subcommand)
626 require.Equal(tt.fullCommand, fullCommand)
627 })
628 }
629}
631func TestIsTelemetryEnabled(t *testing.T) {
632 t.Parallel()
634 tests := []struct {
635 name string
636 configYaml string
637 expectedResult bool
638 }{
639 {
640 name: "enabled with 'true' value",
641 configYaml: "telemetry: true",
642 expectedResult: true,
643 },
644 {
645 name: "enabled with '1' value",
646 configYaml: "telemetry: '1'",
647 expectedResult: true,
648 },
649 {
650 name: "disabled with 'false' value",
651 configYaml: "telemetry: false",
652 expectedResult: false,
653 },
654 {
655 name: "disabled with '0' value",
656 configYaml: "telemetry: '0'",
657 expectedResult: false,
658 },
659 {
660 name: "enabled with empty value",
661 configYaml: "telemetry: ''",
662 expectedResult: true,
663 },
664 {
665 name: "enabled with other value",
666 configYaml: "telemetry: something",
667 expectedResult: true,
668 },
669 {
670 name: "no config value set",
671 expectedResult: true,
672 },
673 }
675 for _, tt := range tests {
676 t.Run(tt.name, func(t *testing.T) {
677 t.Parallel()
679 var cfg config.Config
680 if tt.configYaml != "" {
681 dir := t.TempDir()
682 require.NoError(t, os.WriteFile(filepath.Join(dir, "config.yml"), []byte(tt.configYaml), 0o600))
683 var err error
684 cfg, err = config.ParseConfig(filepath.Join(dir, "config.yml"))
685 require.NoError(t, err)
686 } else {
687 cfg = config.NewBlankConfig()
688 }
690 result := isTelemetryEnabled(cfg)
692 require.Equal(t, tt.expectedResult, result)
693 })
694 }
695}
Diagnostics6 git calls · 184 ms
CallStatusSizeTime0184 ms
discover200185 B2 ms
git.upload-pack discover http.response.status_code=200 git.upstream.cf_ray=- git.upstream.phase=ls-refs git.upstream.dur_ms=2 git.response.bytes=185 git.server.agent=git/2.56.g1891de4-Linux git.server.object_format=sha1 git.server.caps=agent ls-refs fetch server-option object-format git.server.fetch=shallow wait-for-done filter git.protocol.version=2 git.pkt.frames=9 git.pkt.data=7 git.pkt.flush=2 git.pkt.delim=0 git.pkt.bytes=185 git.pkt.payload.max=35
ls-refs20058 KiB3 ms
git.upload-pack ls-refs http.response.status_code=200 git.upstream.cf_ray=- git.upstream.phase=ls-refs git.upstream.dur_ms=2 git.response.bytes=59849 git.response.cache=UPDATING git.response.duration_ms=3 git.protocol.version=2 git.pkt.frames=731 git.pkt.data=730 git.pkt.flush=1 git.pkt.delim=0 git.pkt.bytes=59849 git.pkt.payload.max=143 git.ls_refs.count=730 git.ls_refs.head=refs/heads/main
fetchcombine:blob:none+tree:2 · deepen 12004.2 KiB · hit2 ms
git.upload-pack fetch http.response.status_code=200 git.upstream.cf_ray=- git.upstream.phase=fetch git.upstream.dur_ms=3 git.response.bytes=4273 git.response.cache=HIT git.response.duration_ms=2 git.fetch.filter=combine:blob:none+tree:2 git.fetch.wants=0dd7574dce9e385c5c30540e6c15657adc6bdce9 git.fetch.haves.count=0 git.fetch.deepen=1 git.fetch.thin_pack=false git.fetch.ofs_delta=true git.protocol.version=2 git.pkt.frames=7 git.pkt.data=5 git.pkt.flush=1 git.pkt.delim=1 git.pkt.bytes=4273 git.pkt.payload.max=4173 git.sideband.band1.bytes=4173 git.sideband.band2.bytes=0 git.sideband.band3.bytes=0 git.pack.objects=11 git.pack.bytes=4173 git.fetch.wide.objects=11 git.fetch.wide.extra_bytes=3930 git.fetch.wide.blobs=0
fetchtree:0 · deepen 1020032 KiB · hit3 ms
git.upload-pack fetch http.response.status_code=200 git.upstream.cf_ray=- git.upstream.phase=fetch git.upstream.dur_ms=2 git.response.bytes=32926 git.response.cache=HIT git.response.duration_ms=3 git.fetch.filter=tree:0 git.fetch.wants=0dd7574dce9e385c5c30540e6c15657adc6bdce9 git.fetch.haves.count=0 git.fetch.deepen=10 git.fetch.thin_pack=false git.fetch.ofs_delta=true git.protocol.version=2 git.pkt.frames=22 git.pkt.data=20 git.pkt.flush=1 git.pkt.delim=1 git.pkt.bytes=32926 git.pkt.payload.max=32046 git.sideband.band1.bytes=32046 git.sideband.band2.bytes=0 git.sideband.band3.bytes=0 git.pack.objects=80 git.pack.bytes=32046 git.pack.ofs_delta=36 git.pack.ref_delta=0 git.pack.chain.max=2 git.pack.trailer=cb0bad5d7ffc514895d8b21c4dd470327f90bc91 git.pack.full=44Open pack map
fetchtree:0200195 B · hit2 ms
git.upload-pack fetch http.response.status_code=200 git.upstream.cf_ray=- git.upstream.phase=fetch git.upstream.dur_ms=2 git.response.bytes=195 git.response.cache=HIT git.response.duration_ms=2 git.fetch.filter=tree:0 git.fetch.wants=62ad6b84b990e694d7e6e68667ba67fcbef93a08 git.fetch.haves.count=0 git.fetch.deepen=0 git.fetch.thin_pack=false git.fetch.ofs_delta=true git.protocol.version=2 git.pkt.frames=4 git.pkt.data=3 git.pkt.flush=1 git.pkt.delim=0 git.pkt.bytes=195 git.pkt.payload.max=168 git.sideband.band1.bytes=168 git.sideband.band2.bytes=0 git.sideband.band3.bytes=0 git.pack.objects=1 git.pack.bytes=168 git.pack.trailer=946df40edc15e3ab53d2f74cc477577e7e3fbcdcOpen pack map
fetch2005.6 KiB177 ms
git.upload-pack fetch http.response.status_code=200 git.upstream.cf_ray=- git.upstream.phase=fetch git.upstream.dur_ms=176 git.response.bytes=5726 git.response.cache=MISS git.response.duration_ms=177 git.fetch.wants=0ddd385183286ae34511246db9578df757b6dcc2 git.fetch.haves.count=0 git.fetch.deepen=0 git.fetch.thin_pack=false git.fetch.ofs_delta=true git.protocol.version=2 git.pkt.frames=4 git.pkt.data=3 git.pkt.flush=1 git.pkt.delim=0 git.pkt.bytes=5726 git.pkt.payload.max=5699 git.sideband.band1.bytes=5699 git.sideband.band2.bytes=0 git.sideband.band3.bytes=0
Each row is one HTTP round trip ply made to the git server for this page, on one timeline. discover asks what the server speaks, ls-refs lists branch tips, fetch brings objects by id. A hit was served by Workers Cache. Tap a row for its wire details.
- Remote
- https://gitlab.com/gitlab-org/cli
- Ref
- refs/heads/main
- Commit
- 0dd7574dce9e385c5c30540e6c15657adc6bdce9
- cf-ray
- a5e237db2ffda594
- Request
- c5edad63…
- Protocol
- v2 · sha1
- Agent
- git/2.56.g1891de4-Linux
- Filter
- advertised
- Fetch
- shallow wait-for-done filter
- Capabilities
- agent ls-refs fetch server-option object-format