fluxninja / aperture

Rate limiting, caching, and request prioritization for modern workloads
https://docs.fluxninja.com
Apache License 2.0
622 stars 24 forks source link

Add partition length metrics to Olric #3053

Closed kwapik closed 9 months ago

kwapik commented 9 months ago

Description of change

This can be used to track number of keys and their backups in Olric.

Checklist

Summary by CodeRabbit

coderabbitai[bot] commented 9 months ago

Walkthrough

The recent changes involve enhancing the distributed cache metrics by introducing two new gauge metrics: one for the length of cache partitions and another for the length of backup cache partitions. These metrics are added to the DistCacheMetrics struct and are calculated within the DistCache type's scrapeMetrics method. Additionally, corresponding constants are defined in the metrics schema.

Changes

File(s) Change Summary
pkg/dist-cache/dist-cache-metrics.go, pkg/dist-cache/dist-cache.go Added PartitionsLength and BackupPartitionsLength metrics to DistCacheMetrics and updated scrapeMetrics to calculate these metrics.
pkg/metrics/schema.go Introduced new constants for cache partition length metrics.

Poem

🐇 In the realm of cache, a change took flight,
Metrics for partitions, now in plain sight.
Lengths counted with care, in backup and main,
CodeRabbit hopped joyfully, for clarity's gain.
🌟


Tips ### Chat with CodeRabbit Bot (`@coderabbitai`) - You can reply to a review comment made by CodeRabbit. - You can tag CodeRabbit on specific lines of code or files in the PR by tagging `@coderabbitai` in a comment. - You can tag `@coderabbitai` in a PR comment and ask one-off questions about the PR and the codebase. Use quoted replies to pass the context for follow-up questions. ### CodeRabbit Commands (invoked as PR comments) - `@coderabbitai pause` to pause the reviews on a PR. - `@coderabbitai resume` to resume the paused reviews. - `@coderabbitai review` to trigger a review. This is useful when automatic reviews are disabled for the repository. - `@coderabbitai resolve` resolve all the CodeRabbit review comments. - `@coderabbitai help` to get help. Additionally, you can add `@coderabbitai ignore` anywhere in the PR description to prevent this PR from being reviewed. ### CodeRabbit Configration File (`.coderabbit.yaml`) - You can programmatically configure CodeRabbit by adding a `.coderabbit.yaml` file to the root of your repository. - The JSON schema for the configuration file is available [here](https://coderabbit.ai/integrations/coderabbit-overrides.v2.json). - If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: `# yaml-language-server: $schema=https://coderabbit.ai/integrations/coderabbit-overrides.v2.json`