mirror of
https://github.com/tailscale/tailscale.git
synced 2025-08-21 10:27:30 +00:00
tsweb: switch to fastuuid for request ID generation
Request ID generation appears prominently in some services cumulative allocation rate, and while this does not eradicate this issue (the API still makes UUID objects), it does improve the overhead of this API and reduce the amount of garbage that it produces. Updates tailscale/corp#18266 Updates tailscale/corp#19054 Signed-off-by: James Tucker <james@tailscale.com>
This commit is contained in:

committed by
James Tucker

parent
d0f3fa7d7e
commit
8fa3026614
@@ -7,8 +7,8 @@ import (
|
||||
"context"
|
||||
"net/http"
|
||||
|
||||
"github.com/google/uuid"
|
||||
"tailscale.com/util/ctxkey"
|
||||
"tailscale.com/util/fastuuid"
|
||||
)
|
||||
|
||||
// RequestID is an opaque identifier for a HTTP request, used to correlate
|
||||
@@ -44,7 +44,7 @@ func GenerateRequestID() RequestID {
|
||||
// REQ-1 indicates the version of the RequestID pattern. It is
|
||||
// currently arbitrary but allows for forward compatible
|
||||
// transitions if needed.
|
||||
return RequestID("REQ-1" + uuid.NewString())
|
||||
return RequestID("REQ-1" + fastuuid.NewUUID().String())
|
||||
}
|
||||
|
||||
// SetRequestID is an HTTP middleware that injects a RequestID in the
|
||||
|
Reference in New Issue
Block a user