Skip to content

feat: expose template insights as Prometheus metrics #10325

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 21 commits into from
Oct 19, 2023
Merged
Prev Previous commit
Next Next commit
t.cleanup to defer
  • Loading branch information
mtojek committed Oct 18, 2023
commit e41bfbcb54427b17a90482b3d6ced3bba803a629
6 changes: 3 additions & 3 deletions coderd/prometheusmetrics/insights/metricscollector_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import (
func TestCollect_TemplateInsights(t *testing.T) {
t.Parallel()

logger := slogtest.Make(t, nil)
logger := slogtest.Make(t, &slogtest.Options{IgnoreErrors: true})
db, ps := dbtestutil.NewDB(t)

options := &coderdtest.Options{
Expand All @@ -39,7 +39,7 @@ func TestCollect_TemplateInsights(t *testing.T) {

// Given
// Initialize metrics collector
mc, err := insights.NewMetricsCollector(db, logger.Named("metrics_collector"), 0, time.Millisecond)
mc, err := insights.NewMetricsCollector(db, logger, 0, time.Second)
require.NoError(t, err)

registry := prometheus.NewRegistry()
Expand Down Expand Up @@ -72,7 +72,7 @@ func TestCollect_TemplateInsights(t *testing.T) {
// Run metrics collector
closeFunc, err := mc.Run(ctx)
require.NoError(t, err)
t.Cleanup(closeFunc)
defer closeFunc()

// Connect to the agent to generate usage/latency stats.
conn, err := client.DialWorkspaceAgent(ctx, resources[0].Agents[0].ID, &codersdk.DialWorkspaceAgentOptions{
Expand Down