Skip to content

Expose Redis pool metrics#37

Merged
haasonsaas merged 1 commit intomainfrom
jonathanhaas/redis-pool-metrics
Apr 14, 2026
Merged

Expose Redis pool metrics#37
haasonsaas merged 1 commit intomainfrom
jonathanhaas/redis-pool-metrics

Conversation

@haasonsaas
Copy link
Copy Markdown
Collaborator

Summary

  • expose Redis pool stats from ASB bootstrap alongside the existing Postgres stats hook
  • register shared Redis pool Prometheus collectors for the ASB metrics endpoint
  • bump service-runtime to v0.1.17 and cover the Redis metrics output in tests

Testing

  • go test ./cmd/asb-api ./internal/bootstrap ./internal/api/httpapi
  • go test ./...
  • git diff --check

@cursor
Copy link
Copy Markdown

cursor bot commented Apr 14, 2026

PR Summary

Low Risk
Low risk: adds optional Redis pool Prometheus collectors alongside existing DB stats and extends runtime wiring; behavior is additive and guarded by nil checks.

Overview
Adds Redis pool metrics to the /metrics endpoint by extending bootstrap.ServiceRuntime with a RedisStats hook and wiring it through newRuntimeStore when Redis is configured.

Updates registerRuntimeMetrics to conditionally register both DB and Redis collectors (returning errors per-registration), bumps github.com/evalops/service-runtime to v0.1.17, and adds a test asserting Redis pool metrics output.

Reviewed by Cursor Bugbot for commit 8fbb93d. Bugbot is set up for automated code reviews on this repo. Configure here.

@haasonsaas haasonsaas merged commit 04ab024 into main Apr 14, 2026
4 checks passed
@haasonsaas haasonsaas deleted the jonathanhaas/redis-pool-metrics branch April 14, 2026 01:22
Copy link
Copy Markdown

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

Bugbot Autofix is ON, but it could not run because the branch was deleted or merged before autofix could start.

Reviewed by Cursor Bugbot for commit 8fbb93d. Configure here.

return nil
}
return client.PoolStats
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interface nil check won't catch typed nil values

Low Severity

The redisPoolStats function accepts goredis.UniversalClient (an interface) and uses client == nil as a guard, but this check doesn't catch typed nil values — a well-known Go interface gotcha. If a caller passes a nil *goredis.Client, the interface wrapper is non-nil, so the guard is skipped and client.PoolStats would panic. The companion function pgxPoolDBStats avoids this by accepting the concrete pointer type *pgxpool.Pool, where the nil check works correctly.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 8fbb93d. Configure here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant