feat(logging): record each outbound call to GitHub and other external services

One info record per HTTP request to an external host (fetch and node:http),
with method, host, a fixed endpoint label, status or error code, duration and
the caller's requestId. Internal hops are skipped. Labels keep only literal
segments, so no owner, repository, path or identifier is logged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Thomas DurieuxandClaude Opus 5.5 committed 2026-11-29 11:57:28 +00:00
1 parent 2317544c5a
commit e571268e56
9 files changed
+307 -11

No files matched your search

+3
View File
@@ -4,8 +4,11 @@ import { SandboxedJob } from "bullmq";
import { logContext, validTraceId } from "../core/log-context";
import { createLogger, reportOutputDrops } from "../core/logger";
import type { RepoJobData } from "./index";
import { installExternalRequestLogging } from "../core/external-request-logging";
const logger = createLogger("queue");
export function loggedJob(queue: "download" | "remove" | "cache", work: (job: SandboxedJob<RepoJobData, void>) => Promise<void>) {
// Sandboxed processors run in their own process.
installExternalRequestLogging();
return (job: SandboxedJob<RepoJobData, void>) => logContext.run({
service: "worker", jobId: validTraceId(job.data.logJobId) ? job.data.logJobId : randomUUID(),
requestId: validTraceId(job.data.requestId) ? job.data.requestId : undefined,