Skip to content

Keep MetricsCollector enabled in local dev; only disable RateLimitMiddleware#716

Merged
rickyrombo merged 3 commits intomjp-rate-limit-devfrom
copilot/sub-pr-712-again
Mar 11, 2026
Merged

Keep MetricsCollector enabled in local dev; only disable RateLimitMiddleware#716
rickyrombo merged 3 commits intomjp-rate-limit-devfrom
copilot/sub-pr-712-again

Conversation

Copy link
Contributor

Copilot AI commented Mar 11, 2026

The previous change mistakenly disabled both metricsCollector and rateLimitMiddleware in local dev environments. Only rate limiting should be skipped in local dev.

Changes

  • api/server.go: Split the single initialization guard into two separate conditions:
    • metricsCollector — gated on writePool != nil && config.Env != "test" (enabled in local dev)
    • rateLimitMiddleware — additionally gated on !isLocalDev (disabled in local dev)
if writePool != nil && config.Env != "test" {
    metricsCollector = NewMetricsCollector(logger, writePool)
    if !isLocalDev {
        rateLimitMiddleware = NewRateLimitMiddleware(logger, writePool)
    }
}

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

…itMiddleware

Co-authored-by: rickyrombo <3690498+rickyrombo@users.noreply.github.com>
Copilot AI changed the title [WIP] Address feedback on disabling rate limits in local dev setup Keep MetricsCollector enabled in local dev; only disable RateLimitMiddleware Mar 11, 2026
@rickyrombo rickyrombo marked this pull request as ready for review March 11, 2026 02:47
@rickyrombo rickyrombo merged commit c0ffaa1 into mjp-rate-limit-dev Mar 11, 2026
3 checks passed
@rickyrombo rickyrombo deleted the copilot/sub-pr-712-again branch March 11, 2026 02:48
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.

2 participants