Skip to content

feat: expose workspace statuses (with details) as a prometheus metric #12762

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 15 commits into from
Apr 2, 2024
Merged
Show file tree
Hide file tree
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
Remove SuperShort duration as extraneous
Signed-off-by: Danny Kopping <danny@coder.com>
  • Loading branch information
dannykopping committed Mar 28, 2024
commit acd104c807e83f95b505bdda435911426fe4aeba
6 changes: 3 additions & 3 deletions coderd/prometheusmetrics/prometheusmetrics_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ func TestWorkspaceStatuses(t *testing.T) {
t.Run(tc.Name, func(t *testing.T) {
t.Parallel()
registry := prometheus.NewRegistry()
closeFunc, err := prometheusmetrics.Workspaces(context.Background(), slogtest.Make(t, nil), registry, tc.Database(), testutil.IntervalFast)
closeFunc, err := prometheusmetrics.Workspaces(context.Background(), slogtest.Make(t, nil).Leveled(slog.LevelWarn), registry, tc.Database(), testutil.IntervalFast)
require.NoError(t, err)
t.Cleanup(closeFunc)

Expand Down Expand Up @@ -179,7 +179,7 @@ func TestWorkspaceStatuses(t *testing.T) {
}
t.Logf("sum %d == total %d", sum, tc.Total)
return sum == tc.Total
}, testutil.WaitSuperShort, testutil.IntervalFast)
}, testutil.WaitShort, testutil.IntervalFast)
})
}
}
Expand Down Expand Up @@ -270,7 +270,7 @@ func TestWorkspaceDetails(t *testing.T) {
t.Logf("status series = %d, expected == %d", stSum, tc.ExpectedSeries)
t.Logf("workspace series = %d, expected == %d", len(wMap), tc.ExpectedWorkspaces)
return stSum == tc.ExpectedSeries && len(wMap) == tc.ExpectedWorkspaces
}, testutil.WaitSuperShort, testutil.IntervalFast)
}, testutil.WaitShort, testutil.IntervalFast)
})
}
}
Expand Down
9 changes: 4 additions & 5 deletions testutil/duration.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,10 @@ import (
// Constants for timing out operations, usable for creating contexts
// that timeout or in require.Eventually.
const (
WaitSuperShort = time.Second
WaitShort = 10 * time.Second
WaitMedium = 15 * time.Second
WaitLong = 25 * time.Second
WaitSuperLong = 60 * time.Second
WaitShort = 10 * time.Second
WaitMedium = 15 * time.Second
WaitLong = 25 * time.Second
WaitSuperLong = 60 * time.Second
)

// Constants for delaying repeated operations, e.g. in
Expand Down
9 changes: 4 additions & 5 deletions testutil/duration_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,10 @@ import "time"
//
// Windows durations are adjusted for slow CI workers.
const (
WaitSuperShort = time.Second
WaitShort = 15 * time.Second
WaitMedium = 20 * time.Second
WaitLong = 35 * time.Second
WaitSuperLong = 120 * time.Second
WaitShort = 15 * time.Second
WaitMedium = 20 * time.Second
WaitLong = 35 * time.Second
WaitSuperLong = 120 * time.Second
)

// Constants for delaying repeated operations, e.g. in
Expand Down