Skip to content

Commit

Permalink
docs(logging): Require HTTPRequest.Status when grouping request logs (#…
Browse files Browse the repository at this point in the history
…3118)

This field must be set for Cloud Log Viewer to render request logs correctly.
  • Loading branch information
Hexcles committed Nov 2, 2020
1 parent f03dab2 commit 87e720d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 2 additions & 1 deletion logging/doc.go
Expand Up @@ -119,7 +119,8 @@ To group all the log entries written during a single HTTP request, create two
Loggers, a "parent" and a "child," with different log IDs. Both should be in the same
project, and have the same MonitoredResource type and labels.
- Parent entries must have HTTPRequest.Request populated. (Strictly speaking, only the URL is necessary.)
- Parent entries must have HTTPRequest.Request (strictly speaking, only Method and URL are necessary),
and HTTPRequest.Status populated.
- A child entry's timestamp must be within the time interval covered by the parent request. (i.e., before
the parent.Timestamp and after the parent.Timestamp - parent.HTTPRequest.Latency. This assumes the
Expand Down
2 changes: 2 additions & 0 deletions logging/examples_test.go
Expand Up @@ -99,6 +99,8 @@ func ExampleHTTPRequest() {
HTTPRequest: &logging.HTTPRequest{
// TODO: pass in request
Request: &http.Request{},
// TODO: set the status code
Status: http.StatusOK,
},
}
lg.Log(httpEntry)
Expand Down

0 comments on commit 87e720d

Please sign in to comment.