mirror of
https://github.com/tdurieux/anonymous_github.git
synced 2026-12-02 17:13:33 +01:00
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:
1 parent
2317544c5a
commit
e571268e56
9 files changed
+307
-11
No files matched your search
@@ -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,
|
||||
|
||||
Reference in new issue
Block a user