Skip to content

Commit d04cc38

Browse files
authored
fix: log more in importer (#4909)
Log when it's done, and for each vuln sent to worker
1 parent 560588b commit d04cc38

2 files changed

Lines changed: 13 additions & 1 deletion

File tree

go/cmd/importer/main.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,10 +90,12 @@ func main() {
9090
if err := importer.RunDeletions(ctx, config); err != nil {
9191
logger.FatalContext(ctx, "Importer-deleter failed", slog.Any("error", err))
9292
}
93+
logger.InfoContext(ctx, "Importer-deleter completed successfully")
9394
} else {
9495
if err := importer.Run(ctx, config); err != nil {
9596
logger.FatalContext(ctx, "Importer failed", slog.Any("error", err))
9697
}
98+
logger.InfoContext(ctx, "Importer completed successfully")
9799
}
98100
}
99101

go/internal/importer/importer.go

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -313,8 +313,18 @@ func processUpdate(ctx context.Context, config Config, item WorkItem) {
313313
}
314314
}
315315
if err := sendToWorker(ctx, config, item, hash, modified, &vulnProto); err != nil {
316-
logger.ErrorContext(ctx, "Failed to send to worker", slog.Any("error", err), slog.String("source", sourceRepoName), slog.String("path", sourcePath))
316+
logger.ErrorContext(ctx, "Failed to send to worker",
317+
slog.Any("error", err),
318+
slog.String("source", sourceRepoName),
319+
slog.String("path", sourcePath),
320+
slog.String("id", vulnProto.GetId()))
321+
322+
return
317323
}
324+
logger.InfoContext(ctx, "Sent to worker",
325+
slog.String("source", sourceRepoName),
326+
slog.String("path", sourcePath),
327+
slog.String("id", vulnProto.GetId()))
318328
}
319329

320330
func computeHash(data []byte) string {

0 commit comments

Comments
 (0)