chore: clean up after changing ratelimit implementation#3081
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
1 Skipped Deployment
|
|
📝 WalkthroughWalkthroughThis pull request encompasses widespread refactoring and configuration updates across the project. The changes affect GitHub Actions workflows, API route tests, configuration documentation, CLI flag definitions, Docker deployments, build and test tasks, and integration tests for rate limiting. In addition, there is a major migration from OpenTelemetry to Prometheus for metrics collection, removal of legacy clustering, discovery, membership, and ring implementations, as well as updates to dependency versions and test container handling. Overall, the PR streamlines testing, observability, and distributed system configurations. Changes
Sequence Diagram(s)sequenceDiagram
participant T as Test Function
participant H as Integration Harness
participant R as RunRateLimitTest
participant M as Metrics Validator
T->>H: Initialize test harness
H->>R: Invoke RunRateLimitTest(limit, duration, windowCount, loadFactor, nodeCount)
R->>H: Setup rate limit namespace & generate root key
R->>H: Calculate RPS and dispatch requests via load balancer
H->>M: Collect and log metrics
M->>R: Return success metrics
R->>T: Report test outcome
sequenceDiagram
participant C as Client Request
participant M as Middleware (Prometheus)
participant P as Prometheus Collector
C->>M: Submit HTTP Request
M->>P: Increment HTTPRequestTotal counter & observe latency with HTTPRequestLatency
M->>C: Return HTTP Response
Possibly related PRs
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 golangci-lint (1.64.8)Error: you are using a configuration file for golangci-lint v2 with golangci-lint v1: please use golangci-lint v2 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
|
Thank you for following the naming conventions for pull request titles! 🙏 |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (12)
go/apps/api/routes/v2_ratelimit_set_override/403_test.go (1)
24-24: Inconsistent prefix compared to other filesWhile using
uid.New()is a good improvement, this file uses the prefix"name"while other similar test files use"test". Consider standardizing the prefix across all files for better consistency.- namespaceName := uid.New("name") + namespaceName := uid.New("test")apps/engineering/content/architecture/services/api/ratelimiting.mdx (2)
15-15: Consider adding hyphens to compound adjectivesFor improved readability, consider adding hyphens to compound adjectives:
- "rate-limiting system" instead of "rate limiting system" (line 15)
- "decision-making" instead of "decision making" (lines 33 and 83)
This follows standard English grammar rules for compound adjectives that precede nouns.
Also applies to: 33-33, 83-83
🧰 Tools
🪛 LanguageTool
[uncategorized] ~15-~15: If this is a compound adjective that modifies the following noun, use a hyphen.
Context: ...ents ### Sliding Window Algorithm The rate limiting system uses a sliding window algorithm ...(EN_COMPOUND_ADJECTIVE_INTERNAL)
57-57: Missing period at end of sentenceThere appears to be a missing period at the end of the sentence: "This ensures eventual consistency without adding latency to API responses"
🧰 Tools
🪛 LanguageTool
[uncategorized] ~57-~57: A period might be missing here.
Context: ...nsistency without adding latency to API responses ### 3. Redis Synchronization The syst...(AI_EN_LECTOR_MISSING_PUNCTUATION_PERIOD)
apps/engineering/content/architecture/services/api/config.mdx (1)
232-233: Consider adding a commaConsider adding a comma after "debugging" in the sentence: "This is useful for local development and debugging, but may need to be disabled in production environments..."
🧰 Tools
🪛 LanguageTool
[uncategorized] ~233-~233: Possible missing comma found.
Context: ...eful for local development and debugging but may need to be disabled in production e...(AI_HYDRA_LEO_MISSING_COMMA)
.github/workflows/job_test_go_api_local.yaml (1)
22-24: Improved test randomization with shuffle modeReplaced
-v -raceflags with-shuffle=onin the test command. This change improves test reliability by randomizing the order of test execution, which helps identify tests that incorrectly depend on execution order.However, consider if removing the
-raceflag was intentional, as it's useful for detecting race conditions.- run: go test -shuffle=on -timeout=60m $(go run ./scripts/shard-test ${{ matrix.shard }}) + run: go test -shuffle=on -race -timeout=60m $(go run ./scripts/shard-test ${{ matrix.shard }})go/apps/api/integration/harness.go (1)
43-43: Commented out OpenTelemetry for testingThe OpenTelemetry container initialization has been commented out, aligning with the PR's objective of cleaning up after changing the ratelimit implementation. This suggests a shift away from using OpenTelemetry for metrics in the testing environment.
Consider adding a comment explaining why OpenTelemetry is no longer needed or replacing the comment with code removal if it's permanently deprecated.
- //containerMgr.RunOtel(true) + // OpenTelemetry no longer used for metrics after ratelimit implementation changego/apps/api/integration/multi_node_ratelimiting/generate_tests/main.go (3)
23-31: Consider validating package name generation
If any parameter has invalid characters, the generated package name might break the build.
47-52: Be mindful of test expansions
As you add more test parameters, the file generation might become exceptionally large. Evaluate if there's any risk of generating too many tests.
86-94: Avoid panicking on file/directory errors
Panicking is acceptable in convenience scripts, but consider graceful error handling or logging in a production context.go/pkg/cache/cache.go (1)
107-110: Avoid overwriting old metric data
While usingSet(...)is valid for current stats, verify that periodically setting these values does not introduce concurrency conflicts or unexpected results.go/apps/api/integration/multi_node_ratelimiting/run.go (2)
36-44: Add transaction or additional error checks
Consider wrapping namespace creation in a transaction or checking for collisions in repeated test runs.
147-164: Validate distribution among nodes
You check that each node receives traffic. For thoroughness, consider capturing per-node success counts to ensure balanced load distribution.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (217)
go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes1_limit1000_duration1000_load0_90_windows10/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes1_limit1000_duration1000_load0_90_windows100/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes1_limit1000_duration1000_load10_00_windows10/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes1_limit1000_duration1000_load10_00_windows100/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes1_limit1000_duration1000_load2_00_windows10/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes1_limit1000_duration1000_load2_00_windows100/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes1_limit1000_duration3600000_load0_90_windows10/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes1_limit1000_duration3600000_load0_90_windows100/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes1_limit1000_duration3600000_load10_00_windows10/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes1_limit1000_duration3600000_load10_00_windows100/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes1_limit1000_duration3600000_load2_00_windows10/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes1_limit1000_duration3600000_load2_00_windows100/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes1_limit1000_duration60000_load0_90_windows10/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes1_limit1000_duration60000_load0_90_windows100/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes1_limit1000_duration60000_load10_00_windows10/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes1_limit1000_duration60000_load10_00_windows100/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes1_limit1000_duration60000_load2_00_windows10/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes1_limit1000_duration60000_load2_00_windows100/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes1_limit1000_duration86400000_load0_90_windows10/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes1_limit1000_duration86400000_load0_90_windows100/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes1_limit1000_duration86400000_load10_00_windows10/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes1_limit1000_duration86400000_load10_00_windows100/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes1_limit1000_duration86400000_load2_00_windows10/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes1_limit1000_duration86400000_load2_00_windows100/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes1_limit100_duration1000_load0_90_windows10/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes1_limit100_duration1000_load0_90_windows100/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes1_limit100_duration1000_load10_00_windows10/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes1_limit100_duration1000_load10_00_windows100/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes1_limit100_duration1000_load2_00_windows10/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes1_limit100_duration1000_load2_00_windows100/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes1_limit100_duration3600000_load0_90_windows10/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes1_limit100_duration3600000_load0_90_windows100/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes1_limit100_duration3600000_load10_00_windows10/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes1_limit100_duration3600000_load10_00_windows100/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes1_limit100_duration3600000_load2_00_windows10/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes1_limit100_duration3600000_load2_00_windows100/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes1_limit100_duration60000_load0_90_windows10/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes1_limit100_duration60000_load0_90_windows100/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes1_limit100_duration60000_load10_00_windows10/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes1_limit100_duration60000_load10_00_windows100/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes1_limit100_duration60000_load2_00_windows10/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes1_limit100_duration60000_load2_00_windows100/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes1_limit100_duration86400000_load0_90_windows10/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes1_limit100_duration86400000_load0_90_windows100/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes1_limit100_duration86400000_load10_00_windows10/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes1_limit100_duration86400000_load10_00_windows100/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes1_limit100_duration86400000_load2_00_windows10/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes1_limit100_duration86400000_load2_00_windows100/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes1_limit5_duration1000_load0_90_windows10/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes1_limit5_duration1000_load0_90_windows100/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes1_limit5_duration1000_load10_00_windows10/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes1_limit5_duration1000_load10_00_windows100/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes1_limit5_duration1000_load2_00_windows10/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes1_limit5_duration1000_load2_00_windows100/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes1_limit5_duration3600000_load0_90_windows10/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes1_limit5_duration3600000_load0_90_windows100/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes1_limit5_duration3600000_load10_00_windows10/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes1_limit5_duration3600000_load10_00_windows100/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes1_limit5_duration3600000_load2_00_windows10/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes1_limit5_duration3600000_load2_00_windows100/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes1_limit5_duration60000_load0_90_windows10/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes1_limit5_duration60000_load0_90_windows100/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes1_limit5_duration60000_load10_00_windows10/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes1_limit5_duration60000_load10_00_windows100/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes1_limit5_duration60000_load2_00_windows10/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes1_limit5_duration60000_load2_00_windows100/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes1_limit5_duration86400000_load0_90_windows10/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes1_limit5_duration86400000_load0_90_windows100/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes1_limit5_duration86400000_load10_00_windows10/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes1_limit5_duration86400000_load10_00_windows100/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes1_limit5_duration86400000_load2_00_windows10/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes1_limit5_duration86400000_load2_00_windows100/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes3_limit1000_duration1000_load0_90_windows10/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes3_limit1000_duration1000_load0_90_windows100/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes3_limit1000_duration1000_load10_00_windows10/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes3_limit1000_duration1000_load10_00_windows100/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes3_limit1000_duration1000_load2_00_windows10/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes3_limit1000_duration1000_load2_00_windows100/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes3_limit1000_duration3600000_load0_90_windows10/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes3_limit1000_duration3600000_load0_90_windows100/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes3_limit1000_duration3600000_load10_00_windows10/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes3_limit1000_duration3600000_load10_00_windows100/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes3_limit1000_duration3600000_load2_00_windows10/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes3_limit1000_duration3600000_load2_00_windows100/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes3_limit1000_duration60000_load0_90_windows10/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes3_limit1000_duration60000_load0_90_windows100/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes3_limit1000_duration60000_load10_00_windows10/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes3_limit1000_duration60000_load10_00_windows100/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes3_limit1000_duration60000_load2_00_windows10/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes3_limit1000_duration60000_load2_00_windows100/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes3_limit1000_duration86400000_load0_90_windows10/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes3_limit1000_duration86400000_load0_90_windows100/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes3_limit1000_duration86400000_load10_00_windows10/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes3_limit1000_duration86400000_load10_00_windows100/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes3_limit1000_duration86400000_load2_00_windows10/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes3_limit1000_duration86400000_load2_00_windows100/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes3_limit100_duration1000_load0_90_windows10/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes3_limit100_duration1000_load0_90_windows100/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes3_limit100_duration1000_load10_00_windows10/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes3_limit100_duration1000_load10_00_windows100/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes3_limit100_duration1000_load2_00_windows10/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes3_limit100_duration1000_load2_00_windows100/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes3_limit100_duration3600000_load0_90_windows10/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes3_limit100_duration3600000_load0_90_windows100/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes3_limit100_duration3600000_load10_00_windows10/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes3_limit100_duration3600000_load10_00_windows100/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes3_limit100_duration3600000_load2_00_windows10/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes3_limit100_duration3600000_load2_00_windows100/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes3_limit100_duration60000_load0_90_windows10/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes3_limit100_duration60000_load0_90_windows100/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes3_limit100_duration60000_load10_00_windows10/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes3_limit100_duration60000_load10_00_windows100/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes3_limit100_duration60000_load2_00_windows10/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes3_limit100_duration60000_load2_00_windows100/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes3_limit100_duration86400000_load0_90_windows10/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes3_limit100_duration86400000_load0_90_windows100/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes3_limit100_duration86400000_load10_00_windows10/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes3_limit100_duration86400000_load10_00_windows100/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes3_limit100_duration86400000_load2_00_windows10/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes3_limit100_duration86400000_load2_00_windows100/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes3_limit5_duration1000_load0_90_windows10/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes3_limit5_duration1000_load0_90_windows100/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes3_limit5_duration1000_load10_00_windows10/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes3_limit5_duration1000_load10_00_windows100/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes3_limit5_duration1000_load2_00_windows10/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes3_limit5_duration1000_load2_00_windows100/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes3_limit5_duration3600000_load0_90_windows10/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes3_limit5_duration3600000_load0_90_windows100/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes3_limit5_duration3600000_load10_00_windows10/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes3_limit5_duration3600000_load10_00_windows100/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes3_limit5_duration3600000_load2_00_windows10/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes3_limit5_duration3600000_load2_00_windows100/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes3_limit5_duration60000_load0_90_windows10/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes3_limit5_duration60000_load0_90_windows100/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes3_limit5_duration60000_load10_00_windows10/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes3_limit5_duration60000_load10_00_windows100/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes3_limit5_duration60000_load2_00_windows10/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes3_limit5_duration60000_load2_00_windows100/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes3_limit5_duration86400000_load0_90_windows10/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes3_limit5_duration86400000_load0_90_windows100/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes3_limit5_duration86400000_load10_00_windows10/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes3_limit5_duration86400000_load10_00_windows100/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes3_limit5_duration86400000_load2_00_windows10/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes3_limit5_duration86400000_load2_00_windows100/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes9_limit1000_duration1000_load0_90_windows10/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes9_limit1000_duration1000_load0_90_windows100/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes9_limit1000_duration1000_load10_00_windows10/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes9_limit1000_duration1000_load10_00_windows100/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes9_limit1000_duration1000_load2_00_windows10/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes9_limit1000_duration1000_load2_00_windows100/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes9_limit1000_duration3600000_load0_90_windows10/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes9_limit1000_duration3600000_load0_90_windows100/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes9_limit1000_duration3600000_load10_00_windows10/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes9_limit1000_duration3600000_load10_00_windows100/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes9_limit1000_duration3600000_load2_00_windows10/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes9_limit1000_duration3600000_load2_00_windows100/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes9_limit1000_duration60000_load0_90_windows10/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes9_limit1000_duration60000_load0_90_windows100/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes9_limit1000_duration60000_load10_00_windows10/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes9_limit1000_duration60000_load10_00_windows100/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes9_limit1000_duration60000_load2_00_windows10/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes9_limit1000_duration60000_load2_00_windows100/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes9_limit1000_duration86400000_load0_90_windows10/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes9_limit1000_duration86400000_load0_90_windows100/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes9_limit1000_duration86400000_load10_00_windows10/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes9_limit1000_duration86400000_load10_00_windows100/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes9_limit1000_duration86400000_load2_00_windows10/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes9_limit1000_duration86400000_load2_00_windows100/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes9_limit100_duration1000_load0_90_windows10/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes9_limit100_duration1000_load0_90_windows100/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes9_limit100_duration1000_load10_00_windows10/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes9_limit100_duration1000_load10_00_windows100/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes9_limit100_duration1000_load2_00_windows10/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes9_limit100_duration1000_load2_00_windows100/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes9_limit100_duration3600000_load0_90_windows10/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes9_limit100_duration3600000_load0_90_windows100/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes9_limit100_duration3600000_load10_00_windows10/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes9_limit100_duration3600000_load10_00_windows100/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes9_limit100_duration3600000_load2_00_windows10/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes9_limit100_duration3600000_load2_00_windows100/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes9_limit100_duration60000_load0_90_windows10/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes9_limit100_duration60000_load0_90_windows100/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes9_limit100_duration60000_load10_00_windows10/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes9_limit100_duration60000_load10_00_windows100/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes9_limit100_duration60000_load2_00_windows10/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes9_limit100_duration60000_load2_00_windows100/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes9_limit100_duration86400000_load0_90_windows10/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes9_limit100_duration86400000_load0_90_windows100/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes9_limit100_duration86400000_load10_00_windows10/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes9_limit100_duration86400000_load10_00_windows100/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes9_limit100_duration86400000_load2_00_windows10/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes9_limit100_duration86400000_load2_00_windows100/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes9_limit5_duration1000_load0_90_windows10/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes9_limit5_duration1000_load0_90_windows100/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes9_limit5_duration1000_load10_00_windows10/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes9_limit5_duration1000_load10_00_windows100/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes9_limit5_duration1000_load2_00_windows10/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes9_limit5_duration1000_load2_00_windows100/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes9_limit5_duration3600000_load0_90_windows10/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes9_limit5_duration3600000_load0_90_windows100/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes9_limit5_duration3600000_load10_00_windows10/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes9_limit5_duration3600000_load10_00_windows100/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes9_limit5_duration3600000_load2_00_windows10/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes9_limit5_duration3600000_load2_00_windows100/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes9_limit5_duration60000_load0_90_windows10/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes9_limit5_duration60000_load0_90_windows100/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes9_limit5_duration60000_load10_00_windows10/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes9_limit5_duration60000_load10_00_windows100/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes9_limit5_duration60000_load2_00_windows10/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes9_limit5_duration60000_load2_00_windows100/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes9_limit5_duration86400000_load0_90_windows10/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes9_limit5_duration86400000_load0_90_windows100/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes9_limit5_duration86400000_load10_00_windows10/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes9_limit5_duration86400000_load10_00_windows100/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes9_limit5_duration86400000_load2_00_windows10/generated_test.gois excluded by!**/generated/**go/apps/api/integration/multi_node_ratelimiting/generated/ratelimit_nodes9_limit5_duration86400000_load2_00_windows100/generated_test.gois excluded by!**/generated/**go/go.sumis excluded by!**/*.sum
📒 Files selected for processing (82)
.github/workflows/job_test_go_api_local.yaml(1 hunks)apps/api/src/routes/v1_ratelimits_limit.ts(2 hunks)apps/engineering/content/architecture/services/api/config.mdx(4 hunks)apps/engineering/content/architecture/services/api/ratelimiting.mdx(1 hunks)deployment/docker-compose.yaml(1 hunks)go/Taskfile.yml(2 hunks)go/apps/api/cancel_test.go(0 hunks)go/apps/api/config.go(0 hunks)go/apps/api/integration/harness.go(1 hunks)go/apps/api/integration/multi_node_ratelimiting/accuracy_test.go(0 hunks)go/apps/api/integration/multi_node_ratelimiting/generate_tests/main.go(1 hunks)go/apps/api/integration/multi_node_ratelimiting/run.go(1 hunks)go/apps/api/routes/v2_ratelimit_delete_override/200_test.go(1 hunks)go/apps/api/routes/v2_ratelimit_delete_override/400_test.go(5 hunks)go/apps/api/routes/v2_ratelimit_delete_override/401_test.go(2 hunks)go/apps/api/routes/v2_ratelimit_delete_override/403_test.go(1 hunks)go/apps/api/routes/v2_ratelimit_delete_override/404_test.go(1 hunks)go/apps/api/routes/v2_ratelimit_get_override/200_test.go(1 hunks)go/apps/api/routes/v2_ratelimit_get_override/400_test.go(5 hunks)go/apps/api/routes/v2_ratelimit_get_override/401_test.go(2 hunks)go/apps/api/routes/v2_ratelimit_get_override/403_test.go(1 hunks)go/apps/api/routes/v2_ratelimit_get_override/404_test.go(2 hunks)go/apps/api/routes/v2_ratelimit_limit/200_test.go(1 hunks)go/apps/api/routes/v2_ratelimit_limit/400_test.go(1 hunks)go/apps/api/routes/v2_ratelimit_limit/403_test.go(1 hunks)go/apps/api/routes/v2_ratelimit_limit/404_test.go(1 hunks)go/apps/api/routes/v2_ratelimit_set_override/200_test.go(3 hunks)go/apps/api/routes/v2_ratelimit_set_override/400_test.go(7 hunks)go/apps/api/routes/v2_ratelimit_set_override/401_test.go(2 hunks)go/apps/api/routes/v2_ratelimit_set_override/403_test.go(1 hunks)go/apps/api/run.go(1 hunks)go/cmd/api/main.go(1 hunks)go/go.mod(7 hunks)go/internal/services/ratelimit/bucket.go(2 hunks)go/internal/services/ratelimit/janitor.go(2 hunks)go/internal/services/ratelimit/replay.go(2 hunks)go/internal/services/ratelimit/window.go(2 hunks)go/pkg/cache/cache.go(5 hunks)go/pkg/circuitbreaker/lib_test.go(1 hunks)go/pkg/cluster/cluster.go(0 hunks)go/pkg/cluster/cluster_test.go(0 hunks)go/pkg/cluster/doc.go(0 hunks)go/pkg/cluster/interface.go(0 hunks)go/pkg/cluster/noop.go(0 hunks)go/pkg/counter/doc.go(1 hunks)go/pkg/counter/redis_test.go(0 hunks)go/pkg/db/permission_find_by_workspace_and_name.sql_generated.go(1 hunks)go/pkg/db/querier_generated.go(1 hunks)go/pkg/db/queries/permission_find_by_workspace_and_name.sql(1 hunks)go/pkg/discovery/awsecs.go(0 hunks)go/pkg/discovery/doc.go(0 hunks)go/pkg/discovery/interface.go(0 hunks)go/pkg/discovery/redis.go(0 hunks)go/pkg/discovery/static.go(0 hunks)go/pkg/membership/doc.go(0 hunks)go/pkg/membership/interface.go(0 hunks)go/pkg/membership/logger.go(0 hunks)go/pkg/membership/member.go(0 hunks)go/pkg/membership/membership_test.go(0 hunks)go/pkg/membership/serf.go(0 hunks)go/pkg/otel/grafana.go(0 hunks)go/pkg/otel/metrics/doc.go(0 hunks)go/pkg/otel/metrics/interface.go(0 hunks)go/pkg/otel/metrics/metrics.go(0 hunks)go/pkg/otel/metrics/observable.go(0 hunks)go/pkg/prometheus/metrics/cache.go(1 hunks)go/pkg/prometheus/metrics/http.go(1 hunks)go/pkg/prometheus/metrics/ratelimit.go(1 hunks)go/pkg/prometheus/promhttp.go(0 hunks)go/pkg/prometheus/server.go(1 hunks)go/pkg/ring/consistency/checker.go(0 hunks)go/pkg/ring/doc.go(0 hunks)go/pkg/ring/ring.go(0 hunks)go/pkg/ring/ring_test.go(0 hunks)go/pkg/testutil/containers/mysql.go(3 hunks)go/pkg/testutil/http.go(2 hunks)go/pkg/testutil/seed/seed.go(2 hunks)go/pkg/uid/uid_test.go(2 hunks)go/pkg/zen/middleware_logger.go(1 hunks)go/pkg/zen/middleware_metrics.go(2 hunks)go/pkg/zen/server.go(0 hunks)go/proto/ratelimit/v1/service.proto(0 hunks)
💤 Files with no reviewable changes (32)
- go/pkg/membership/doc.go
- go/apps/api/cancel_test.go
- go/apps/api/config.go
- go/pkg/ring/ring_test.go
- go/pkg/membership/logger.go
- go/pkg/counter/redis_test.go
- go/pkg/cluster/cluster_test.go
- go/pkg/cluster/doc.go
- go/pkg/discovery/doc.go
- go/pkg/discovery/static.go
- go/pkg/ring/doc.go
- go/pkg/discovery/interface.go
- go/pkg/otel/metrics/interface.go
- go/pkg/ring/consistency/checker.go
- go/pkg/cluster/interface.go
- go/pkg/otel/metrics/metrics.go
- go/pkg/membership/membership_test.go
- go/pkg/otel/metrics/doc.go
- go/pkg/prometheus/promhttp.go
- go/pkg/zen/server.go
- go/pkg/cluster/noop.go
- go/pkg/otel/grafana.go
- go/pkg/ring/ring.go
- go/pkg/membership/interface.go
- go/apps/api/integration/multi_node_ratelimiting/accuracy_test.go
- go/pkg/otel/metrics/observable.go
- go/pkg/discovery/redis.go
- go/pkg/membership/member.go
- go/pkg/membership/serf.go
- go/proto/ratelimit/v1/service.proto
- go/pkg/discovery/awsecs.go
- go/pkg/cluster/cluster.go
🧰 Additional context used
🧬 Code Definitions (21)
go/apps/api/routes/v2_ratelimit_get_override/401_test.go (1)
go/apps/api/routes/v2_ratelimit_get_override/handler.go (1)
New(29-124)
go/apps/api/routes/v2_ratelimit_get_override/403_test.go (4)
go/apps/api/routes/v2_ratelimit_delete_override/handler.go (1)
New(33-216)go/apps/api/routes/v2_ratelimit_get_override/handler.go (1)
New(29-124)go/apps/api/routes/v2_ratelimit_set_override/handler.go (1)
New(31-123)go/pkg/uid/uid.go (1)
New(63-83)
go/apps/api/routes/v2_ratelimit_delete_override/401_test.go (1)
go/apps/api/routes/v2_ratelimit_delete_override/handler.go (1)
New(33-216)
go/apps/api/routes/v2_ratelimit_set_override/403_test.go (5)
go/apps/api/routes/v2_ratelimit_limit/handler.go (1)
New(42-229)go/apps/api/routes/v2_ratelimit_delete_override/handler.go (1)
New(33-216)go/apps/api/routes/v2_ratelimit_get_override/handler.go (1)
New(29-124)go/apps/api/routes/v2_ratelimit_set_override/handler.go (1)
New(31-123)go/pkg/uid/uid.go (1)
New(63-83)
go/apps/api/routes/v2_ratelimit_limit/404_test.go (4)
go/apps/api/routes/v2_ratelimit_limit/handler.go (1)
New(42-229)go/apps/api/routes/v2_ratelimit_get_override/handler.go (1)
New(29-124)go/apps/api/routes/v2_ratelimit_set_override/handler.go (1)
New(31-123)go/pkg/uid/uid.go (1)
New(63-83)
go/apps/api/routes/v2_ratelimit_limit/403_test.go (5)
go/apps/api/routes/v2_ratelimit_limit/handler.go (1)
New(42-229)go/apps/api/routes/v2_ratelimit_delete_override/handler.go (1)
New(33-216)go/apps/api/routes/v2_ratelimit_get_override/handler.go (1)
New(29-124)go/apps/api/routes/v2_ratelimit_set_override/handler.go (1)
New(31-123)go/pkg/uid/uid.go (1)
New(63-83)
go/apps/api/routes/v2_ratelimit_set_override/401_test.go (2)
go/apps/api/routes/v2_ratelimit_get_override/handler.go (1)
New(29-124)go/apps/api/routes/v2_ratelimit_set_override/handler.go (1)
New(31-123)
go/pkg/testutil/http.go (2)
go/pkg/testutil/containers/mysql.go (2)
WithReuse(23-27)WithPurge(29-33)apps/agent/pkg/logging/logger.go (1)
Logger(13-13)
go/apps/api/routes/v2_ratelimit_delete_override/200_test.go (2)
go/apps/api/routes/v2_ratelimit_delete_override/handler.go (1)
New(33-216)go/pkg/uid/uid.go (1)
New(63-83)
go/apps/api/routes/v2_ratelimit_limit/200_test.go (1)
go/apps/api/routes/v2_ratelimit_limit/handler.go (1)
New(42-229)
go/apps/api/routes/v2_ratelimit_limit/400_test.go (1)
go/apps/api/routes/v2_ratelimit_limit/handler.go (1)
New(42-229)
go/apps/api/routes/v2_ratelimit_set_override/400_test.go (2)
go/pkg/ptr/pointer.go (1)
P(49-51)go/apps/api/routes/v2_ratelimit_set_override/handler.go (1)
New(31-123)
go/apps/api/routes/v2_ratelimit_delete_override/404_test.go (3)
go/apps/api/routes/v2_ratelimit_delete_override/handler.go (1)
New(33-216)go/apps/api/routes/v2_ratelimit_set_override/handler.go (1)
New(31-123)go/pkg/uid/uid.go (1)
New(63-83)
go/apps/api/routes/v2_ratelimit_get_override/404_test.go (4)
go/apps/api/routes/v2_ratelimit_get_override/handler.go (1)
New(29-124)go/apps/api/routes/v2_ratelimit_set_override/handler.go (1)
New(31-123)go/apps/api/integration/harness.go (1)
New(35-70)go/pkg/uid/uid.go (1)
New(63-83)
go/apps/api/routes/v2_ratelimit_set_override/200_test.go (2)
go/apps/api/routes/v2_ratelimit_set_override/handler.go (1)
New(31-123)go/pkg/uid/uid.go (1)
New(63-83)
go/apps/api/run.go (1)
go/pkg/otel/logging/interface.go (1)
Logger(11-116)
go/pkg/uid/uid_test.go (1)
go/pkg/uid/uid.go (2)
APIPrefix(20-20)New(63-83)
go/apps/api/routes/v2_ratelimit_delete_override/400_test.go (1)
go/pkg/ptr/pointer.go (1)
P(49-51)
go/pkg/testutil/containers/mysql.go (1)
go/pkg/testutil/containers/containers.go (1)
Containers(13-17)
go/apps/api/routes/v2_ratelimit_get_override/400_test.go (1)
go/pkg/ptr/pointer.go (1)
P(49-51)
go/cmd/api/main.go (5)
go/apps/api/routes/v2_ratelimit_limit/handler.go (1)
New(42-229)go/apps/api/routes/v2_ratelimit_delete_override/handler.go (1)
New(33-216)go/apps/api/routes/v2_ratelimit_get_override/handler.go (1)
New(29-124)go/pkg/clickhouse/client.go (1)
New(59-161)go/pkg/uid/uid.go (1)
InstancePrefix(34-34)
🪛 LanguageTool
apps/engineering/content/architecture/services/api/ratelimiting.mdx
[uncategorized] ~9-~9: If this is a compound adjective that modifies the following noun, use a hyphen.
Context: ... The Unkey API implements a distributed rate limiting system using a sliding window algorithm...
(EN_COMPOUND_ADJECTIVE_INTERNAL)
[uncategorized] ~15-~15: If this is a compound adjective that modifies the following noun, use a hyphen.
Context: ...ents ### Sliding Window Algorithm The rate limiting system uses a sliding window algorithm ...
(EN_COMPOUND_ADJECTIVE_INTERNAL)
[uncategorized] ~33-~33: The noun “decision-making” (= the process of deciding something) is spelled with a hyphen.
Context: ...aintains local in-memory state for fast decision making: 1. Buckets: Track rate limit stat...
(DECISION_MAKING)
[uncategorized] ~57-~57: A period might be missing here.
Context: ...nsistency without adding latency to API responses ### 3. Redis Synchronization The syst...
(AI_EN_LECTOR_MISSING_PUNCTUATION_PERIOD)
[uncategorized] ~83-~83: The noun “Decision-Making” (= the process of deciding something) is spelled with a hyphen.
Context: ...## Performance Optimizations - Local Decision Making: Most decisions made locally avoid Re...
(DECISION_MAKING)
apps/engineering/content/architecture/services/api/config.mdx
[uncategorized] ~233-~233: Possible missing comma found.
Context: ...eful for local development and debugging but may need to be disabled in production e...
(AI_HYDRA_LEO_MISSING_COMMA)
⏰ Context from checks skipped due to timeout of 90000ms (10)
- GitHub Check: Test Go API Local / Test (Shard 6/8)
- GitHub Check: Test Go API Local / Test (Shard 3/8)
- GitHub Check: Test Go API Local / Test (Shard 7/8)
- GitHub Check: Test Go API Local / Test (Shard 1/8)
- GitHub Check: Test Go API Local / Test (Shard 5/8)
- GitHub Check: Test Go API Local / Test (Shard 4/8)
- GitHub Check: Test Go API Local / Test (Shard 2/8)
- GitHub Check: Test Agent Local / test_agent_local
- GitHub Check: Test API / API Test Local
- GitHub Check: Build / Build
🔇 Additional comments (111)
go/apps/api/routes/v2_ratelimit_delete_override/401_test.go (2)
10-10: Import added for uid packageThe uid package is now imported to support the dynamic generation of test identifiers.
31-31: Improved test robustness by using dynamic identifiersReplacing the static string "test_namespace" with a dynamically generated identifier using
uid.New("test")helps prevent potential test interference when tests run in parallel and better simulates real-world usage where IDs would be unique.go/apps/api/routes/v2_ratelimit_get_override/403_test.go (1)
24-24: Enhanced test isolation with dynamic namespace identifierReplacing the hardcoded namespace name with a dynamically generated identifier using
uid.New("test")improves test isolation and prevents potential conflicts between test runs.go/apps/api/routes/v2_ratelimit_get_override/401_test.go (2)
10-10: Import added for uid packageThe uid package is now properly imported to support the dynamic generation of test identifiers.
31-31: Improved test reliability with dynamic identifiersSwitching from static string "test_namespace" to a dynamically generated identifier using
uid.New("test")helps prevent test interference and better represents real-world conditions.go/apps/api/routes/v2_ratelimit_limit/404_test.go (1)
62-62: Enhanced test isolation with dynamic namespace identifierUsing
uid.New("test")for the deleted namespace name rather than a static string improves test isolation by ensuring unique identifiers for each test run, preventing potential conflicts from leftover data.go/apps/api/routes/v2_ratelimit_limit/400_test.go (1)
36-36: Good improvement using dynamic namespace IDsThe change from hardcoded
"test_namespace"to usinguid.New("test")improves test reliability by generating unique identifiers for each test run. This prevents potential test interference and aligns with modern testing practices.go/apps/api/routes/v2_ratelimit_limit/403_test.go (1)
24-24: Good improvement using dynamic namespace IDsUsing
uid.New("test")instead of a hardcoded string ensures test isolation by generating unique namespace identifiers for each test run, preventing potential interference between tests.go/apps/api/routes/v2_ratelimit_get_override/200_test.go (1)
23-23: Good improvement using dynamic namespace IDsThe change from hardcoded
"test_namespace"to usinguid.New("test")improves test isolation and reliability by generating unique identifiers for each test run.go/apps/api/routes/v2_ratelimit_delete_override/200_test.go (1)
23-23: Improved test reliability with dynamic namespace namingUsing
uid.New("test")instead of a hardcoded string enhances test reliability by ensuring each test run uses a unique namespace name. This prevents potential conflicts when tests run in parallel or when test data persists between runs.go/apps/api/routes/v2_ratelimit_delete_override/404_test.go (1)
24-24: LGTM: Consistent use of unique identifiersThis change follows the same pattern as in other test files, replacing hardcoded namespace names with dynamically generated ones for better test isolation.
go/apps/api/routes/v2_ratelimit_limit/200_test.go (1)
23-23: Consistent improvement to test robustnessThe change from hardcoded namespace name to a dynamically generated one follows the same pattern seen in other test files, ensuring test isolation and preventing potential data conflicts.
go/apps/api/routes/v2_ratelimit_get_override/404_test.go (2)
24-24: LGTM: Consistent improvement to test stabilityUsing
uid.New("test")follows the same pattern as other test changes, ensuring unique namespace names for test isolation.
41-41: More precise permission scoping in root key creationChanged from using a wildcard permission to a namespace-specific permission. This makes the test more realistic, as it now reflects how permissions would typically be scoped in production environments.
go/apps/api/routes/v2_ratelimit_delete_override/403_test.go (1)
24-24: Good improvement to use dynamic namespace namingChanging from a static string to
uid.New("test")improves test isolation by ensuring unique namespace names across test runs, which helps prevent potential test interference when running tests concurrently.go/apps/api/routes/v2_ratelimit_set_override/401_test.go (2)
10-10: LGTM: Import required for uid.NewProperly added the uid package import to support the dynamic namespace name generation.
31-31: Consistent approach to namespace name generationUsing
uid.New("test")instead of a static string aligns with other test files and ensures test isolation with unique namespace names.go/apps/api/routes/v2_ratelimit_get_override/400_test.go (5)
12-14: Good package update for pointer handling and unique ID generationUpdating the imports to use
ptrpackage for pointer creation and adding theuidpackage for unique ID generation improves code consistency across the codebase.
54-54: Updated pointer creation to use consistent packageChanged from using
util.Pointertoptr.Pfor pointer creation, which is more concise and follows the project's standardized approach.
73-74: Consistent pointer creation patternUpdated pointer creation to use
ptr.Pfor consistency with the rest of the codebase.
119-119: Dynamic namespace name generation for better test isolationUsing
uid.New("test")instead of a static string prevents potential test collisions when running tests concurrently.
136-136: Consistent namespace name generationUsing
uid.New("test")maintains consistency with other test cases and improves test isolation.go/pkg/uid/uid_test.go (3)
7-7: Updated import path reflecting package reorganizationUpdated the import path from
apps/agent/pkg/uidtogo/pkg/uid, aligning with the project's restructuring.
23-23: Updated test to use APIPrefix instead of NodePrefixChanged the test to use
uid.APIPrefixinstead ofuid.NodePrefix, which aligns with the current API structure.
29-29: Simplified function call by removing unnecessary type conversionRemoved the explicit
string()conversion when callinguid.New(), as the function now directly accepts thePrefixtype.go/apps/api/routes/v2_ratelimit_delete_override/400_test.go (5)
11-13: Improved imports with specialized packagesThe imports now use the dedicated
ptranduidpackages, which provide more specialized functionality than generic utility functions. Theptrpackage offers type-safe pointer creation, anduidgenerates unique identifiers with proper formatting.
53-53: Clean pointer creation with generic helperReplaced utility pointer creation with
ptr.Pwhich provides a cleaner, more type-safe way to create pointers to values. This approach is more maintainable and consistent with Go's idiomatic practices.
72-72: Consistent pointer creation patternConsistently applying
ptr.Pfor pointer creation throughout the codebase improves readability and maintainability.
117-117: Enhanced test data with unique identifiersUsing
uid.New("test")instead of hardcoded values improves test isolation by ensuring each test run has unique identifiers, which helps prevent potential test interference and makes debugging easier.
134-134: Consistent use of unique identifiersConsistently using
uid.New()across test cases ensures a uniform approach to test data generation.go/apps/api/routes/v2_ratelimit_set_override/400_test.go (3)
11-13: Improved imports with specialized packagesThe imports now use the dedicated
ptranduidpackages, which provide more specialized functionality than generic utility functions. This makes the code more maintainable and follows the principle of using the most specific tool for the job.
53-53: Consistent use of ptr.P across all test casesThe change uniformly applies
ptr.Pfor pointer creation throughout all test cases, improving code consistency. The generic functionP[T any](t T) *Tprovides a cleaner, more type-safe way to create pointers compared to the previous approach.Also applies to: 74-74, 97-97, 118-118, 140-140
189-189: Enhanced test data with unique identifiersUsing
uid.New("test")instead of hardcoded namespace names improves test isolation and prevents potential test interference by ensuring each test run has unique identifiers. This is particularly important for tests that may run in parallel or be executed multiple times.go/apps/api/routes/v2_ratelimit_set_override/200_test.go (3)
23-23: Enhanced test data with unique identifiersUsing
uid.New("test")instead of a hardcoded namespace name improves test isolation and makes tests more robust by ensuring each test run has unique identifiers.
41-41: Improved permission specificationThe permission string now uses the namespace ID directly through
fmt.Sprintf("ratelimit.%s.set_override", namespaceID), which makes the permission scoping more explicit and correctly tied to the specific resource being tested. This makes the test more accurate in representing real-world permission scenarios.
58-58: Enhanced error reportingChanged error message format from
%vto%+v, which provides more detailed output when tests fail. This makes debugging failed tests easier by showing the full struct content including field names.go/pkg/counter/doc.go (1)
43-44: The package declaration is correctly formatted.The code appears to be a proper package declaration with no issues.
go/pkg/zen/middleware_logger.go (1)
27-32: Adjusted logging level from Debug to Info.This change increases the visibility of request logs by moving them from debug level to info level. This is useful for operational monitoring and ensures that standard request information is readily available in production logs without enabling debug mode.
go/pkg/circuitbreaker/lib_test.go (1)
10-10: Updated import path for the clock package.The import has been correctly updated to reflect the new location of the clock package in the project structure, aligning with broader codebase reorganization efforts mentioned in the PR objectives.
apps/api/src/routes/v1_ratelimits_limit.ts (2)
412-412: Updated response type to match new AWS API structure.The code correctly adapts to the API response structure change, where the success boolean is now nested inside a data object.
422-423: Updated property access to match new response structure.This change ensures proper access to the success field within the nested data object structure returned by the AWS API.
go/pkg/prometheus/server.go (4)
1-15: Well-structured package documentationThe documentation provides a clear overview of the package's purpose and common use cases. The comprehensive explanation helps developers understand when and how to use this package, which is essential for proper integration.
26-32: Clear and concise config structureThe Config struct is well-documented with appropriate comments explaining the purpose of each field. The simple design with just a Logger dependency makes it easy to use and maintain.
34-73: Excellent function documentation with examplesThe documentation for the
Newfunction is very comprehensive, including parameters, return values, an explanation of what the function does, and a practical usage example. This level of detail helps developers understand how to use the function correctly.
74-92: Simple and effective implementationThe implementation is clean and follows good practices. It leverages the zen server framework consistently while providing a focused functionality for exposing Prometheus metrics.
go/internal/services/ratelimit/window.go (2)
3-7: Properly migrated from OpenTelemetry to Prometheus metricsThe import has been updated to use the Prometheus metrics package instead of OpenTelemetry, aligning with the broader migration strategy indicated in the PR summary.
57-58: Simplified metrics collectionThe metrics tracking has been updated from
metrics.Ratelimit.CreatedWindows.Add(context.Background(), 1)to the more straightforwardmetrics.RatelimitWindowsCreated.Inc(), which simplifies the code and removes the unnecessary context parameter.apps/engineering/content/architecture/services/api/ratelimiting.mdx (7)
7-9: Improved architecture overview sectionThe new "Overview" section provides a clearer, more concise introduction to the rate limiting system than the previous "Cluster Formation" section. It effectively communicates the key aspects of the architecture.
🧰 Tools
🪛 LanguageTool
[uncategorized] ~9-~9: If this is a compound adjective that modifies the following noun, use a hyphen.
Context: ... The Unkey API implements a distributed rate limiting system using a sliding window algorithm...(EN_COMPOUND_ADJECTIVE_INTERNAL)
13-22: Well-structured explanation of sliding window algorithmThe explanation of the sliding window algorithm is clear and detailed, breaking down complex concepts into digestible points. This helps developers understand how the rate limiting system works at a fundamental level.
🧰 Tools
🪛 LanguageTool
[uncategorized] ~15-~15: If this is a compound adjective that modifies the following noun, use a hyphen.
Context: ...ents ### Sliding Window Algorithm The rate limiting system uses a sliding window algorithm ...(EN_COMPOUND_ADJECTIVE_INTERNAL)
23-30: Clear explanation of Redis's role in the architectureThe document effectively explains how Redis serves as the centralized counter store for rate limiting, detailing its role in maintaining atomic counters, managing TTL, and ensuring consistent counting across nodes.
31-38: Good description of local in-memory stateThe section on local in-memory state clearly explains how each API node maintains local state for fast decision making, including the concepts of buckets, windows, and memory management.
🧰 Tools
🪛 LanguageTool
[uncategorized] ~33-~33: The noun “decision-making” (= the process of deciding something) is spelled with a hyphen.
Context: ...aintains local in-memory state for fast decision making: 1. Buckets: Track rate limit stat...(DECISION_MAKING)
41-66: Comprehensive request flow documentationThe request flow section provides a detailed step-by-step explanation of how rate limit requests are processed, including initial checks, asynchronous synchronization, and Redis synchronization. This helps developers understand the complete lifecycle of a request.
🧰 Tools
🪛 LanguageTool
[uncategorized] ~57-~57: A period might be missing here.
Context: ...nsistency without adding latency to API responses ### 3. Redis Synchronization The syst...(AI_EN_LECTOR_MISSING_PUNCTUATION_PERIOD)
69-87: Thorough implementation detailsThe implementation details sections (Bucket and Window Management, Resilience Features, Performance Optimizations) provide valuable insights into how the system works internally and handles edge cases. This information is crucial for maintainers and contributors.
🧰 Tools
🪛 LanguageTool
[uncategorized] ~83-~83: The noun “Decision-Making” (= the process of deciding something) is spelled with a hyphen.
Context: ...## Performance Optimizations - Local Decision Making: Most decisions made locally avoid Re...(DECISION_MAKING)
88-106: Comprehensive deployment considerationsThe deployment considerations section provides valuable information about Redis configuration, scaling strategies, and the overall architecture's balance between accuracy, performance, and operational simplicity. This helps operators understand how to effectively deploy and scale the system.
apps/engineering/content/architecture/services/api/config.mdx (8)
84-92: Well-documented new --image propertyThe new
--imageproperty is well-documented with clear examples and environment variable mapping. This will help users correctly specify the container image for deployment.
101-109: Important security warning in --test-mode documentationThe documentation for
--test-modeappropriately includes a clear warning about not using this option in production, which is essential for security. The examples and explanation are thorough.
121-129: Clear documentation for --instance-id propertyThe
--instance-idproperty is well-documented with a thorough explanation of its purpose and usage scenarios. The examples illustrate how to use this property effectively.
217-228: Well-explained --prometheus-port propertyThe documentation for the new
--prometheus-portproperty clearly explains how to enable and configure Prometheus metrics exposure. The examples cover common scenarios, providing users with good guidance.
230-238: Updated --color property with new default valueThe documentation for the
--colorproperty has been updated to reflect the new default value oftrue. The explanation provides clear guidance on when to enable or disable this feature.🧰 Tools
🪛 LanguageTool
[uncategorized] ~233-~233: Possible missing comma found.
Context: ...eful for local development and debugging but may need to be disabled in production e...(AI_HYDRA_LEO_MISSING_COMMA)
240-251: Clear Redis configuration documentationThe Redis configuration section clearly explains the purpose of Redis in the system (rate-limiting and distributed counters) and provides good examples of connection strings for different deployment scenarios.
281-287: Updated Docker Compose example with new configurationThe Docker Compose example has been updated to include new configuration options like
UNKEY_PLATFORM,UNKEY_IMAGE,UNKEY_REDIS_URL, andUNKEY_PROMETHEUS_PORT, reflecting the changes in the configuration schema.
290-303: Improved AWS ECS exampleThe AWS ECS example has been updated to include the new configuration options like
--image,--redis-url,--otel, and--prometheus-port, which helps users understand how to configure the API in a production AWS environment.go/cmd/api/main.go (5)
17-38: Well-organized server configuration flags with clear descriptionsThe server configuration flags are now well-structured with concise descriptions. The addition of
http-port,color, andtest-modeflags makes the API configuration more explicit and user-friendly.
40-66: Instance identification flags are properly documentedThe instance identification flags now have clearer usage descriptions that explain their purpose in logging and metrics. Good organization with appropriate section comments.
68-80: Clear database configuration with appropriate requirementsThe database configuration flags are well structured with the primary database properly marked as required. The readonly replica option is optional with a clear description of its purpose for reducing load on the primary database.
82-94: Improved caching and storage configurationThe Redis URL flag now clearly indicates its purpose for rate-limiting and distributed counters, which aligns with the PR objective of cleaning up after changing the ratelimit implementation.
96-116: Simplified observability configurationThe observability configuration flags now have more concise descriptions that focus on the essential information. The configuration options for OpenTelemetry and Prometheus are clearly defined.
go/go.mod (2)
5-31: Updated direct dependencies to latest versionsThe direct dependencies have been updated to their latest versions, including ClickHouse, MySQL driver, and OpenTelemetry packages. This is good practice for security and performance improvements.
33-153: Updated indirect dependenciesThe indirect dependencies have been properly updated to match the direct dependency changes. Pay special attention to the OpenTelemetry packages (lines 127-130) which are part of the metrics collection changes mentioned in the PR title.
go/apps/api/run.go (1)
132-137: Configuration simplified by removing InstanceID parameterThe
InstanceIDparameter has been removed from thezen.Configstruct, which aligns with the broader removal of clustering features mentioned in the PR summary. This simplification maintains logging context while streamlining the server configuration.go/pkg/db/queries/permission_find_by_workspace_and_name.sql (1)
1-3: Well-structured query for permission lookupThe new SQL query looks good. It correctly uses parameterized queries via
sqlc.arg()to prevent SQL injection and provides a clear, focused query for finding permissions by workspace and name.go/pkg/testutil/http.go (2)
55-55: Test database configuration improved with container reuseAdding
WithReuse(true)andWithPurge(false)parameters toRunMySQLimproves test efficiency by reusing MySQL containers across tests rather than recreating them each time.
72-77: Server configuration simplified by removing InstanceID parameterConsistent with changes in the main API server configuration, the
InstanceIDparameter has been removed from the test server configuration, ensuring testing matches production behavior.go/internal/services/ratelimit/bucket.go (2)
8-8: Metrics package updated to use PrometheusThe import has been updated from the internal metrics package to the Prometheus metrics package, aligning with the PR's goal of migrating from OpenTelemetry to Prometheus for metrics collection.
101-101: Simplified metrics recording with PrometheusThe metrics recording has been updated to use Prometheus's simpler
Inc()method instead of the previous OpenTelemetry approach that required a context parameter. This simplifies the code while maintaining the same functionality.go/pkg/db/querier_generated.go (1)
99-103: New SQL query interface method looks good.This addition to the Querier interface provides a way to retrieve a permission by both workspace ID and name, which is a useful query for permission management. The method is properly documented with the SQL query details in the comments.
go/pkg/zen/middleware_metrics.go (1)
65-69: Successfully migrated from OpenTelemetry to Prometheus metrics.The implementation correctly switches from OpenTelemetry to Prometheus metrics for HTTP request tracking. The changes properly capture method, path, and status in label values for both request counts and latency observations.
go/pkg/prometheus/metrics/http.go (1)
1-67: Well-designed Prometheus metrics implementation.The new HTTP metrics implementation provides:
- Well-documented histogram buckets optimized for web service latencies
- Clear metrics naming with proper subsystem prefixes
- Good documentation with usage examples
- Consistent labeling approach with method, path, and status
The granularity of the latency buckets is appropriate for web service monitoring, capturing everything from 1ms to 10s requests.
go/Taskfile.yml (6)
14-14: Added Redis as a dependencyAdding
redis:latestto the pull task is consistent with the broader changes in this PR to use Redis for rate limiting instead of the previous clustered approach.
17-19: Good addition of a Docker build taskAdding a dedicated task for building the Docker image improves the build process organization and allows it to be referenced as a dependency in other tasks.
24-24: Ensures Docker image is built before testsAdding the
build-dockerdependency to thetest-fulltask ensures that the image is built before running the full test suite, which likely includes integration tests that require this image.
29-32: Improved test command with better feedbackThe added echo command provides useful information about test duration and alternatives. The updated test command now includes shuffle and additional parameters for better test coverage and reliability.
36-36: Explicit skip of integration tests in unit test taskAdding the
-skip "^TestIntegration_"flag to the unit test task creates a clearer separation between unit and integration tests, which should speed up the development cycle.
45-45:Details
❓ Verification inconclusive
Confirm if buf generate is still needed
The
buf generatecommand has been commented out. Ensure this is intentional and won't break any code generation needs.
🏁 Script executed:
#!/bin/bash # Check if buf is still used in the codebase echo "Checking for buf configuration files..." fd -t f "buf.yaml|buf.gen.yaml|buf.work.yaml" echo "Checking for imports or uses of buf-generated code..." rg -i "buf.build|generated/buf" --type goLength of output: 369
Review: Confirm Buf Code Generation and Usage
- The repository still contains Buf configuration files in both
apps/agentandgo(i.e.,buf.yamlandbuf.gen.yaml), suggesting Buf is still set up.- No occurrences of Buf-generated code references (like "buf.build" or "generated/buf") were located in the Go files.
- The
buf generatecommand remains commented out ingo/Taskfile.yml(line 45).Please confirm whether:
- Buf code generation is invoked elsewhere or handled manually, making the commented command intentional.
- Alternatively, if the generation is essential to the build process, the command should be uncommented (or the configuration files removed if no longer needed).
go/internal/services/ratelimit/janitor.go (4)
6-6: Migration from OpenTelemetry to Prometheus metricsThe import has been updated to use Prometheus metrics instead of OpenTelemetry, which is consistent with the overall migration pattern in this PR.
44-44: Type change from int64 to float64 for metricsChanged the type of
windowsvariable fromint64tofloat64to align with Prometheus conventions, which uses float64 for all metric values.
51-51: Simplified counter metrics with Prometheus Inc() methodUpdated the metrics recording for evicted windows and buckets to use the simpler
Inc()method instead ofAdd(ctx, 1). This eliminates context dependency and is more idiomatic for Prometheus.Also applies to: 58-58
64-65: Updated gauge metrics to use Prometheus Set() methodChanged the gauge metrics for buckets and windows count to use the
Set()method instead ofRecord(), eliminating context dependency and making the code more aligned with Prometheus patterns.go/internal/services/ratelimit/replay.go (2)
9-9: Migration from OpenTelemetry to Prometheus metricsThe import has been updated to use Prometheus metrics instead of OpenTelemetry, which is consistent with the overall migration pattern in this PR.
50-50: Updated histogram metrics to use Prometheus Observe() method with secondsChanged the latency metrics to use the Prometheus
Observe()method instead ofRecord()and switched from milliseconds to seconds as the time unit, which is the Prometheus convention for time-based metrics.deployment/docker-compose.yaml (1)
59-59: Replaced clustering configuration with direct Redis URLThe environment variables related to clustering (
UNKEY_CLUSTER,UNKEY_CLUSTER_GOSSIP_PORT,UNKEY_CLUSTER_RPC_PORT, andUNKEY_CLUSTER_DISCOVERY_REDIS_URL) have been removed and replaced with a direct Redis connection URL. This aligns with the PR objective of cleaning up after changing the rate limit implementation to use Redis directly instead of clustering.go/pkg/db/permission_find_by_workspace_and_name.sql_generated.go (1)
26-38: Handle "no rows" scenario
You might want to check iferr == sql.ErrNoRowsand handle it explicitly. Returning an error for an empty result can cause confusion for upstream code.go/pkg/cache/cache.go (3)
68-70: Good approach tracking deletions
Incrementing a metric on cache deletion is helpful for observability.
163-170: Potential concurrency risk with shared timer
prometheus.NewTimer(...)usage is fine, but confirm that timing every concurrent request won't cause overhead or lock contention.
239-239: Revalidation metric
Incrementing theCacheRevalidationsmetric is beneficial for tracking usage. Continue to monitor concurrency safety if revalidations spike under heavy load.go/apps/api/integration/multi_node_ratelimiting/run.go (1)
61-63: Check for integer overflow
Ensure integer operations incalculateRPS(limit, duration, loadFactor)don’t overflow when handling large values for limit or duration.go/pkg/testutil/containers/mysql.go (6)
16-19: Well-designed container configuration structThe new
containerConfigstruct provides a clean way to configure MySQL container behavior with reuse and purge options.
21-33: Good implementation of functional options patternThe
applytype and companion functionsWithReuseandWithPurgefollow the idiomatic Go functional options pattern, making the API both flexible and readable.
81-93: Clean function signature update with proper defaultsThe updated function signature with variadic options and appropriate defaults (reuse=false, purge=true) maintains backward compatibility while adding new functionality.
95-106: Smart container naming strategy for reuseUsing a fixed name "mysql-reuse" when the reuse flag is true ensures consistency across test runs, while the dynamic test-specific naming is preserved for non-reuse cases.
127-132: Conditional resource cleanup based on configurationThe cleanup function now properly respects the purge flag, allowing resources to persist when needed without changing the core behavior.
163-179: Optimization: Skip schema creation for reused containersGood performance optimization by only creating the database schema when starting a new container, not when reusing an existing one.
go/pkg/prometheus/metrics/cache.go (5)
1-12: Well-documented metrics packageClear package documentation that explains the purpose of the metrics collection.
13-43: Comprehensive cache hit/miss trackingThe
CacheHitsandCacheMissesmetrics provide essential visibility into cache efficiency with good example usage documentation.
44-73: Detailed cache operation metricsThe
CacheWritesandCacheDeletedmetrics offer granular tracking of write operations and deletions with appropriate labeling.
94-134: Well-structured cache capacity and revalidation metricsThe
CacheSize,CacheCapacity, andCacheRevalidationsmetrics provide comprehensive monitoring capabilities for cache maintenance and optimization.
84-92:Details
✅ Verification successful
Verify latencyBuckets variable is defined
The
CacheReadLatencymetric useslatencyBucketswhich isn't defined in this file. Ensure this variable is defined elsewhere in the package.
🏁 Script executed:
#!/bin/bash # Check if latencyBuckets is defined elsewhere in the prometheus/metrics package echo "Searching for latencyBuckets definition in metrics package..." rg --type go "var\s+latencyBuckets" go/pkg/prometheus/metrics/ echo "Searching for latencyBuckets initialization..." rg --type go "latencyBuckets\s*=" go/pkg/prometheus/metrics/Length of output: 495
Verified:
latencyBucketsis defined in the packageThe
latencyBucketsvariable is indeed defined in the package (located ingo/pkg/prometheus/metrics/http.go), so no changes are needed incache.go.go/pkg/prometheus/metrics/ratelimit.go (4)
1-12: Well-documented rate limiting metrics packageClear package documentation that explains the purpose of the rate limiting metrics collection.
13-91: Comprehensive rate limit resource trackingGood coverage of metrics for tracking the lifecycle and resource usage of rate limiting components (buckets and windows).
93-130: Detailed decision-making metricsThe metrics for tracking local vs. origin decisions and refreshes provide valuable insights into distributed rate limiter behavior.
140-147:Details
✅ Verification successful
Verify latencyBuckets variable is defined
The
RatelimitOriginSyncLatencymetric useslatencyBucketswhich isn't defined in this file. Ensure this variable is defined elsewhere in the package.
🏁 Script executed:
#!/bin/bash # Check if latencyBuckets is defined elsewhere in the prometheus/metrics package echo "Searching for latencyBuckets definition in metrics package..." rg --type go "var\s+latencyBuckets" go/pkg/prometheus/metrics/ echo "Searching for latencyBuckets initialization..." rg --type go "latencyBuckets\s*=" go/pkg/prometheus/metrics/Length of output: 495
LatencyBuckets Definition Verified
- Confirmed that
latencyBucketsis defined ingo/pkg/prometheus/metrics/http.go(usingvar latencyBuckets = []float64{ ... }).No further action is needed for this code segment.
| mysqlErr := &mysql.MySQLError{} // nolint:exhaustruct | ||
| if errors.As(err, &mysqlErr) { | ||
| // Error 1062 (23000): Duplicate entry | ||
| if mysqlErr.Number == 1064 { | ||
| existing, findErr := db.Query.FindPermissionByWorkspaceAndName(ctx, s.DB.RO(), db.FindPermissionByWorkspaceAndNameParams{ | ||
| WorkspaceID: s.Resources.RootWorkspace.ID, | ||
| Name: permission, | ||
| }) | ||
| require.NoError(s.t, findErr) | ||
| s.t.Logf("found existing permission: %+v", existing) | ||
| permissionID = existing.ID | ||
| } | ||
|
|
||
| } else { | ||
| require.NoError(s.t, err) | ||
| } |
There was a problem hiding this comment.
Fix incorrect MySQL error code for duplicate entries.
The error handling for duplicate entries is checking for the wrong MySQL error code. Error code 1064 is for SQL syntax errors, not duplicate entries. The correct error code for duplicate entries in MySQL is 1062.
- if mysqlErr.Number == 1064 {
+ if mysqlErr.Number == 1062 {📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| mysqlErr := &mysql.MySQLError{} // nolint:exhaustruct | |
| if errors.As(err, &mysqlErr) { | |
| // Error 1062 (23000): Duplicate entry | |
| if mysqlErr.Number == 1064 { | |
| existing, findErr := db.Query.FindPermissionByWorkspaceAndName(ctx, s.DB.RO(), db.FindPermissionByWorkspaceAndNameParams{ | |
| WorkspaceID: s.Resources.RootWorkspace.ID, | |
| Name: permission, | |
| }) | |
| require.NoError(s.t, findErr) | |
| s.t.Logf("found existing permission: %+v", existing) | |
| permissionID = existing.ID | |
| } | |
| } else { | |
| require.NoError(s.t, err) | |
| } | |
| mysqlErr := &mysql.MySQLError{} // nolint:exhaustruct | |
| if errors.As(err, &mysqlErr) { | |
| // Error 1062 (23000): Duplicate entry | |
| if mysqlErr.Number == 1062 { | |
| existing, findErr := db.Query.FindPermissionByWorkspaceAndName(ctx, s.DB.RO(), db.FindPermissionByWorkspaceAndNameParams{ | |
| WorkspaceID: s.Resources.RootWorkspace.ID, | |
| Name: permission, | |
| }) | |
| require.NoError(s.t, findErr) | |
| s.t.Logf("found existing permission: %+v", existing) | |
| permissionID = existing.ID | |
| } | |
| } else { | |
| require.NoError(s.t, err) | |
| } |
Summary by CodeRabbit
New Features
Improvements
Documentation