Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion coderd/inboxnotifications.go
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,9 @@ func (api *API) watchInboxNotifications(rw http.ResponseWriter, r *http.Request)
defer encoder.Close(websocket.StatusNormalClosure)

// Log the request immediately instead of after it completes.
loggermw.RequestLoggerFromContext(ctx).WriteLog(ctx, http.StatusAccepted)
if rl := loggermw.RequestLoggerFromContext(ctx); rl != nil {
rl.WriteLog(ctx, http.StatusAccepted)
}

for {
select {
Expand Down
4 changes: 3 additions & 1 deletion coderd/provisionerjobs.go
Original file line number Diff line number Diff line change
Expand Up @@ -557,7 +557,9 @@ func (f *logFollower) follow() {
}

// Log the request immediately instead of after it completes.
loggermw.RequestLoggerFromContext(f.ctx).WriteLog(f.ctx, http.StatusAccepted)
if rl := loggermw.RequestLoggerFromContext(f.ctx); rl != nil {
rl.WriteLog(f.ctx, http.StatusAccepted)
}

// no need to wait if the job is done
if f.complete {
Expand Down
12 changes: 9 additions & 3 deletions coderd/workspaceagents.go
Original file line number Diff line number Diff line change
Expand Up @@ -578,7 +578,9 @@ func (api *API) workspaceAgentLogs(rw http.ResponseWriter, r *http.Request) {
defer t.Stop()

// Log the request immediately instead of after it completes.
loggermw.RequestLoggerFromContext(ctx).WriteLog(ctx, http.StatusAccepted)
if rl := loggermw.RequestLoggerFromContext(ctx); rl != nil {
rl.WriteLog(ctx, http.StatusAccepted)
}

go func() {
defer func() {
Expand Down Expand Up @@ -1047,7 +1049,9 @@ func (api *API) derpMapUpdates(rw http.ResponseWriter, r *http.Request) {
defer encoder.Close(websocket.StatusGoingAway)

// Log the request immediately instead of after it completes.
loggermw.RequestLoggerFromContext(ctx).WriteLog(ctx, http.StatusAccepted)
if rl := loggermw.RequestLoggerFromContext(ctx); rl != nil {
rl.WriteLog(ctx, http.StatusAccepted)
}

go func(ctx context.Context) {
// TODO(mafredri): Is this too frequent? Use separate ping disconnect timeout?
Expand Down Expand Up @@ -1501,7 +1505,9 @@ func (api *API) watchWorkspaceAgentMetadata(
defer sendTicker.Stop()

// Log the request immediately instead of after it completes.
loggermw.RequestLoggerFromContext(ctx).WriteLog(ctx, http.StatusAccepted)
if rl := loggermw.RequestLoggerFromContext(ctx); rl != nil {
rl.WriteLog(ctx, http.StatusAccepted)
}

// Send initial metadata.
sendMetadata()
Expand Down
4 changes: 3 additions & 1 deletion enterprise/coderd/provisionerdaemons.go
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,9 @@ func (api *API) provisionerDaemonServe(rw http.ResponseWriter, r *http.Request)
})

// Log the request immediately instead of after it completes.
loggermw.RequestLoggerFromContext(ctx).WriteLog(ctx, http.StatusAccepted)
if rl := loggermw.RequestLoggerFromContext(ctx); rl != nil {
rl.WriteLog(ctx, http.StatusAccepted)
}

err = server.Serve(ctx, session)
srvCancel()
Expand Down
Loading