tsweb: add request ID for errors
If an optional request ID generating func is supplied to StdHandler, then requests that return an error will be logged with a request ID that is also shown as part of the response. Updates tailscale/corp#2549 Change-Id: Ic7499706df42f95b6878d44d4aab253e2fc6a69b Signed-off-by: Adrian Dewhurst <adrian@tailscale.com>
This commit is contained in:

committed by
Adrian Dewhurst

parent
cf31b58ed1
commit
f75a36f9bc
@ -45,6 +45,12 @@ type AccessLogRecord struct {
|
||||
Bytes int `json:"bytes,omitempty"`
|
||||
// Error encountered during request processing.
|
||||
Err string `json:"err,omitempty"`
|
||||
// RequestID is a unique ID for this request. When a request fails due to an
|
||||
// error, the ID is generated and displayed to the client immediately after
|
||||
// the error text, as well as logged here. This makes it easier to correlate
|
||||
// support requests with server logs. If a RequestID generator is not
|
||||
// configured, RequestID will be empty.
|
||||
RequestID RequestID `json:"request_id,omitempty"`
|
||||
}
|
||||
|
||||
// String returns m as a JSON string.
|
||||
|
Reference in New Issue
Block a user