Skip to content

Commit

Permalink
server: return all completed stmt diag requests
Browse files Browse the repository at this point in the history
Fixes cockroachdb#80104

Previously, we only return statement diagnostics requests
that have not yet expired. Since we use the results of this
request to populate completed statement diagnostics bundles
in addition to outstanding requests, completed statement
diag bundles would disappear from the UI after the request
expired.

This commit ensures that `StatementDiagnosticsRequests`
returns all completed stmt diag requests so that we can
display the complete history of completed bundles in the UI.

Release note (bug fix): completed stmt diagnostics bundles
now persist in the UI in stmt diag bundle pages
  • Loading branch information
xinhaoz committed Sep 21, 2022
1 parent 7d2106a commit 5d25638
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pkg/server/statement_diagnostics_requests.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ func (s *statusServer) CancelStatementDiagnosticsReport(

// StatementDiagnosticsRequests retrieves all statement diagnostics
// requests in the `system.statement_diagnostics_requests` table that
// have not yet expired.
// have either completed or have not yet expired.
func (s *statusServer) StatementDiagnosticsRequests(
ctx context.Context, _ *serverpb.StatementDiagnosticsReportsRequest,
) (*serverpb.StatementDiagnosticsReportsResponse, error) {
Expand Down Expand Up @@ -182,7 +182,7 @@ func (s *statusServer) StatementDiagnosticsRequests(
if expiresAt, ok := row[6].(*tree.DTimestampTZ); ok {
req.ExpiresAt = expiresAt.Time
// Don't return already expired requests.
if req.ExpiresAt.Before(timeutil.Now()) {
if !completed && req.ExpiresAt.Before(timeutil.Now()) {
continue
}
}
Expand Down

0 comments on commit 5d25638

Please sign in to comment.