chore: add more metrics for batching etc#3651
Conversation
|
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. 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 (
|
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
|
Warning This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
This stack of pull requests is managed by Graphite. Learn more about stacking. |
|
Shouldnt go this into main or is the current merge location correct |
|
nah I fucked up graphite |
|
might as well merge this one now 😄 |
799f069
into
07-22-feat_use_the_new_api_based_chproxy
Graphite Automations"Post a GIF when PR approved" took an action on this PR • (07/23/25)1 gif was posted to this PR based on Andreas Thomas's automation. |
* chore: log params * fix: parallelize flushing * chore: replace chproxy with our own api * revert: api v1 changes * feat: use the new api based chproxy * fix: uncomment the container as we still need it * fix: add json tags to bind properly * fix: error handling * chore: add more metrics for batching etc (#3651) * fix: laod env correctly * ci: run apiv2 instead of chproxy * Update apps/api/src/pkg/analytics.ts Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * style: fmt --------- Co-authored-by: Flo <53355483+Flo4604@users.noreply.github.com> Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>


What does this PR do?
This PR adds comprehensive batch processing metrics and improves the batch processing implementation. It:
Adds new Prometheus metrics for batch operations:
BatchSizeDistributionto track batch sizes when flushedBatchOperationsTotalto count batch flush operationsBatchItemsProcessedTotalto measure throughputEnhances the batch processor to track the trigger reason for flushes (size limit, time interval, or close)
Increases batch sizes in Clickhouse client from 1000 to 10000 for API requests, key verifications, and rate limits
Adds HTTP request body size metrics to monitor payload sizes
Removes the deprecated
batch.consume.gofile in favor of the more configurable implementation inbatch.process.goFixes metric naming in buffer metrics by moving them from
unkey_api_buffer_*tounkey_buffer_*Fixes # (issue)
Type of change
How should this be tested?
Checklist
Required
pnpm buildpnpm fmtconsole.logsgit pull origin main