Skip to content

feat: add prometheus metric for tracking user statuses #15281

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Oct 30, 2024
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
fixup! feat: add prometheus metric for tracking user statuses
  • Loading branch information
coadler committed Oct 30, 2024
commit 9b0d26dbaae89b61b98891a780b29b1f8c82494e
4 changes: 3 additions & 1 deletion coderd/prometheusmetrics/prometheusmetrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@

apiKeys, err := db.GetAPIKeysLastUsedAfter(ctx, dbtime.Now().Add(-1*time.Hour))
if err != nil {
logger.Error(ctx, "get api keys", slog.Error(err))

Check failure on line 61 in coderd/prometheusmetrics/prometheusmetrics.go

View workflow job for this annotation

GitHub Actions / lint

ruleguard: Message "get api keys" is too short, it must be at least 16 characters long. (gocritic)
continue
}
distinctUsers := map[uuid.UUID]struct{}{}
Expand Down Expand Up @@ -106,9 +106,11 @@
}

gauge.Reset()
//nolint:gocritic // This is a system service that needs full access
//to the users table.
users, err := db.GetUsers(dbauthz.AsSystemRestricted(ctx), database.GetUsersParams{})
if err != nil {
logger.Error(ctx, "get users", slog.Error(err))
logger.Error(ctx, "get all users for prometheus metrics", slog.Error(err))
continue
}

Expand Down
Loading