You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: instrument error reporting and tracing for go jobs (#4819)
1. Makes error level (and the hypothetical levels above) logs create a
new error in the error reporting dashboard, which should hopefully link
to the logs
2. adds traces to all our go jobs, which should maybe let us use the
trace explorer to see how long things take in a fancy waterfall graph
(related to #3547)
- The exporter will create one big span for the exporter, and sub-spans
for each ecosystem
- The relations will create one big span for the relations, and a
sub-span for alias/upstream/related
- gitter traces each http request that is made to it. We can add
propagate the same trace from the worker/importer to correlate requests,
which should be fun.
This doesn't affect vulnfeeds (yet), since it uses a duplicate logging
thing.
To instrument tracing, you have to propagate the context correctly, and
the new `logger.[LEVEL]Context()` commands.
outBucketName:=flag.String("bucket", "osv-test-vulnerabilities", "Output bucket or directory name. If -local is true, this is a local path; otherwise, it's a GCS bucket name.")
28
33
vulnBucketName:=flag.String("osv-vulns-bucket", os.Getenv("OSV_VULNERABILITIES_BUCKET"), "GCS bucket to read vulnerability protobufs from. Can also be set with the OSV_VULNERABILITIES_BUCKET environment variable.")
@@ -31,22 +36,22 @@ func main() {
31
36
32
37
flag.Parse()
33
38
34
-
logger.Info("exporter starting",
39
+
logger.InfoContext(ctx, "exporter starting",
35
40
slog.String("bucket", *outBucketName),
36
41
slog.String("osv-vulns-bucket", *vulnBucketName),
37
42
slog.Bool("upload-to-gcs", *uploadToGCS),
38
43
slog.Int("workers", *numWorkers))
39
44
40
45
if*vulnBucketName=="" {
41
-
logger.Fatal("OSV_VULNERABILITIES_BUCKET must be set")
46
+
logger.FatalContext(ctx, "OSV_VULNERABILITIES_BUCKET must be set")
0 commit comments