aboutsummaryrefslogtreecommitdiff
path: root/internal/postgres/versionstate.go
diff options
context:
space:
mode:
authorJonathan Amsterdam <jba@google.com>2019-12-18 08:38:16 -0500
committerJulie Qiu <julie@golang.org>2020-03-27 16:46:50 -0400
commit193997f5c7cae335cd35527cac7664920fad087f (patch)
tree7cf3a42d37e2c5ab99483dbad46c8528cc03715e /internal/postgres/versionstate.go
parent4f918777601cb0e1fbbf1a4740440088063ed2f3 (diff)
downloadgo-x-pkgsite-193997f5c7cae335cd35527cac7664920fad087f.tar.xz
internal/{log,middleware}: add trace ID to context, use in logging
- The requestlog middleware gets the trace ID from the request and adds it to the request's context. - The internal/log package retrieves the traceID and adds it to log messages. It also creates two logs instead of one, a "parent" log used in requestlog, and a "child" log used for all other logging. Together, these two changes will cause the Stackdriver log viewer to group all log messages for a request with the request start and end log messages. - These changes require that all log functions take a context, so I plumbed one through everywhere. In a handful of cases it didn't seem worth doing the plumbing. I used context.TODO() for those so we can easily find and re-evalaute them. Change-Id: I663588463520187d0549a8f802ba9cb44a893592 Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/622940 Reviewed-by: Robert Findley <rfindley@google.com>
Diffstat (limited to 'internal/postgres/versionstate.go')
-rw-r--r--internal/postgres/versionstate.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/internal/postgres/versionstate.go b/internal/postgres/versionstate.go
index 6832081c..ddb70d5b 100644
--- a/internal/postgres/versionstate.go
+++ b/internal/postgres/versionstate.go
@@ -128,7 +128,7 @@ func (db *DB) UpdateVersionStatesForReprocessing(ctx context.Context, appVersion
if err != nil {
return fmt.Errorf("result.RowsAffected(): %v", err)
}
- log.Infof("Updated %d module version states to be reprocessed for app_version <= %q", affected, appVersion)
+ log.Infof(ctx, "Updated %d module version states to be reprocessed for app_version <= %q", affected, appVersion)
return nil
}