Repository navigation
Done
Description
Is your feature request related to a problem?
When gitcacheproxy_upstream_ops_total{op="clone"|"fetch",result="error"} rises, an operator cannot tell which repo failed, when, or why. The metric uses repo="-" on failure by design (bounded cardinality), so the detail has to come from logs, and the logs do not carry it:
- Upstream git stderr is read only to classify the failure. It is never logged, so an unrecognized failure shows only "permanent or unrecognized error".
- Errors are logged with
error = %e, which drops the source chain (e.g. whether an auth rejection was 401, 403 or 404). - A budget timeout and a cancellation are the same error.
- A client disconnect or shutdown cancels the operation, counts it as
result="error", and logs nothing. The counter can rise with no log line at any level.
Describe the solution you'd like
Log each upstream operation once, at its final failure, with structured fields:
op: clone | fetch | want_fetchtrigger: request | refreshrepoerror_kind: auth | transient_http | tls | connection | dns | timeout | unknownelapsed_msstderr: a redacted summary of git stderr (last 8 lines, at most 1 KiB)error: the full error chain, including attempts and exit status
Also:
- Split timeout from cancellation. Log cancellation at debug and do not count it as
result="error". This changes an existing metric. - Callers do not log a failure that is already logged, so one failure gives one line.
- Redact the stderr summary: URL userinfo,
AuthorizationandCookievalues, and the credential in use. Remove inheritedGIT_TRACE*andGIT_CURL_VERBOSEfrom upstream git. Keep stderr out of the returned error.
Describe alternatives you've considered
- Raise the log level only: still no stderr, no timeout vs cancel split, and silent cancellations.
- An
error_kindmetric label: bounded, but not needed once the log exists. - Error message or URL as a metric label: rejected, unbounded cardinality.
Scope check
- Keeps the proxy strictly read-only and pull-only (it must never push or
proactively replicate to upstream). - Not already tracked in the README "Status / scope" (LRU eviction, per-repo
histograms, scheduled refresh) or listed there as a non-goal (git-free image).
Metadata
Metadata
Assignees
Labels
No labels
Activity
profiling commentedon Nov 19, 2026
Design note before I open a PR, on one point that differs from the current docs.
docs/architecture.mdsays retry logs carry no raw upstream stderr. Looking at the history, that line comes from #37: before it, upstream clone/fetch used.status()and inherited stderr, so git's diagnostics went straight to the process output, unfiltered and unbounded (that is how the TLS EOF in #35 was diagnosed). #37 piped stderr to classify it and, as a side effect, stopped surfacing it. I could not find a review discussion that asked for that restriction, so I read it as a conservative default rather than a requirement. Please correct me if there was a reason I am missing.Proposal: put a bounded, redacted stderr summary on the single final-failure log line only. The error string returned to callers stays as it is, so
noisy_stderr_is_drained_and_not_exposed_in_errorsstill holds.GIT_TRACE*/GIT_CURL_VERBOSEfrom upstream git, so stderr holds only git's own diagnostics andremote:lines.transport_anonymize_url), and its trace redactsAuthorization/Cookie(http.c,trace2.c). The proxy applies the same rules again as defense in depth, and also replaces any verbatim occurrence of the credential used for that operation.Recognized failures without the raw text only give a category, and unrecognized ones give "permanent or unrecognized error" plus an exit code, which is where diagnosis is needed most. I will update the architecture doc to match. Happy to drop the stderr field or move it to debug if you prefer; the rest of #82 does not depend on it.
feat(git): log upstream failures with stderr
feat(git): log upstream failures with stderr
feat(git): log upstream failures with stderr
feat(git): log upstream failures with stderr
feat(git): log upstream failures with stderr
feat(git): log upstream failures with stderr
feat(git): log upstream failures with stderr
feat(git): log upstream failures with stderr