Split transport stats by protocol phase · Entire
Split transport stats by protocol phase
44b243f→main·
Soph·3mo ago·2 files·+23 added/-4 removed
Sessions
99a3ba48420bView transcript
[?
Can you take a look at the go code (wasm) in /Users/soph/Work/entire/devenv/entire-io-worktree1 based a bit on that I wonder if something like this can be build:Codex·GPT-5.4·1 step](/content/gh/entireio/git-sync/session/019d6d29-8cf7-7fe3-adc9-8c3e4d9d5603#timeline-99a3ba48420b/index.html)
Changes
2
internal/syncer
Mprotocol_v2.go+18/-2
- Msyncer.go+5/-2
25 unmodified lines
26
27
28
29
30
31
32
309 unmodified lines
342
343
344
344
345
346
347
348
34 unmodified lines
383
384
385
385
386
387
388
389
143 unmodified lines
533
534
535
536
537
538
539
38 unmodified lines
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
2 unmodified lines
600
601
602
603
604
605
606
25 unmodified lines
const (
delimPkt = "0001"
responseEndPkt = "0002"
statsPhaseHdr = "X-Git-Sync-Stats-Phase"
)
type packetType int
309 unmodified lines
return nil, err
}
data, err := postRPC(ctx, conn, transport.UploadPackServiceName, body, true)
data, err := postRPCWithPhase(ctx, conn, transport.UploadPackServiceName, body, true, "upload-pack ls-refs")
if err != nil {
return nil, err
}
34 unmodified lines
return err
}
reader, err := postRPCStream(ctx, conn, transport.UploadPackServiceName, body, true)
reader, err := postRPCStreamWithPhase(ctx, conn, transport.UploadPackServiceName, body, true, "upload-pack fetch")
if err != nil {
return err
}
143 unmodified lines
}
req.Header.Set("Accept", "*/*")
req.Header.Set("User-Agent", capability.DefaultAgent())
req.Header.Set(statsPhaseHdr, service+" info-refs")
if gitProtocol != "" {
req.Header.Set("Git-Protocol", gitProtocol)
}
38 unmodified lines
return io.ReadAll(reader)
}
func postRPCWithPhase(ctx context.Context, conn *transportConn, service string, body []byte, gitProtocolV2 bool, phase string) ([]byte, error) {
reader, err := postRPCStreamWithPhase(ctx, conn, service, body, gitProtocolV2, phase)
if err != nil {
return nil, err
}
defer reader.Close()
return io.ReadAll(reader)
}
func postRPCStream(ctx context.Context, conn *transportConn, service string, body []byte, gitProtocolV2 bool) (io.ReadCloser, error) {
return postRPCStreamWithPhase(ctx, conn, service, body, gitProtocolV2, service)
}
func postRPCStreamWithPhase(ctx context.Context, conn *transportConn, service string, body []byte, gitProtocolV2 bool, phase string) (io.ReadCloser, error) {
url := fmt.Sprintf("%s/%s", conn.endpoint.String(), service)
req, err := http.NewRequestWithContext(ctx, http.MethodPost, url, bytes.NewReader(body))
if err != nil {
2 unmodified lines
req.Header.Set("Content-Type", fmt.Sprintf("application/x-%s-request", service))
req.Header.Set("Accept", fmt.Sprintf("application/x-%s-result", service))
req.Header.Set("User-Agent", capability.DefaultAgent())
req.Header.Set(statsPhaseHdr, phase)
if gitProtocolV2 {
req.Header.Set("Git-Protocol", "version=2")
}