Skip to content

Conversation

@nikhilsinhaparseable
Copy link
Contributor

@nikhilsinhaparseable nikhilsinhaparseable commented Nov 16, 2025

to be used in enterprise

Summary by CodeRabbit

  • New Features
    • Added daily tracking of cached LLM token usage, segmented by provider and model
    • Added daily tracking of reasoning LLM token usage, segmented by provider and model

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 16, 2025

Walkthrough

Two new date-based LLM token counter metrics were added to track cached and reasoning tokens by provider, model, and date. Associated increment helper functions and metric registrations were implemented in the metrics module.

Changes

Cohort / File(s) Summary
LLM Token Metrics
src/metrics/mod.rs
Added two new IntCounterVec metrics: TOTAL_CACHED_LLM_TOKENS_BY_DATE and TOTAL_REASONING_LLM_TOKENS_BY_DATE with labels for provider, model, and date; registered in custom metrics and metrics handler; introduced corresponding increment helper functions increment_cached_llm_tokens_by_date() and increment_reasoning_llm_tokens_by_date()

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

  • The changes follow an established pattern of metric definition and registration repeated consistently across two new metrics
  • All modifications are contained within a single file, reducing context-switching
  • Helper functions are straightforward wrappers around metric incrementation operations

Poem

🐰 New metrics bloom in the telemetry spring,
Cached tokens and reasoning paths we now track,
By date, model, provider—each detail precise,
The counters hop forward with each increment's grace,
Observability grows, and the data rings true!

Pre-merge checks and finishing touches

❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Description check ⚠️ Warning The PR description is minimal and vague ('to be used in enterprise'). It lacks required sections from the template including a proper Description section, key changes explanation, and testing/documentation checklist. Expand the description to include: the goal/rationale for adding these metrics, key changes made (new metrics and helper functions), and complete the testing/documentation checklist from the template.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: adding cached and reasoning token metrics to the codebase, which aligns perfectly with the file changes shown in the raw summary.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 8cfced3 and 45b327d.

📒 Files selected for processing (1)
  • src/metrics/mod.rs (3 hunks)
🧰 Additional context used
🧠 Learnings (3)
📚 Learning: 2025-08-25T01:32:25.980Z
Learnt from: nikhilsinhaparseable
Repo: parseablehq/parseable PR: 1415
File: src/metrics/mod.rs:163-173
Timestamp: 2025-08-25T01:32:25.980Z
Learning: The TOTAL_EVENTS_INGESTED_DATE, TOTAL_EVENTS_INGESTED_SIZE_DATE, and TOTAL_EVENTS_STORAGE_SIZE_DATE metrics in src/metrics/mod.rs are intentionally designed to track global totals across all streams for a given date, using labels ["format", "date"] rather than per-stream labels. This is the correct design for global aggregation purposes.

Applied to files:

  • src/metrics/mod.rs
📚 Learning: 2025-08-25T01:31:41.786Z
Learnt from: nikhilsinhaparseable
Repo: parseablehq/parseable PR: 1415
File: src/metadata.rs:63-68
Timestamp: 2025-08-25T01:31:41.786Z
Learning: The TOTAL_EVENTS_INGESTED_DATE, TOTAL_EVENTS_INGESTED_SIZE_DATE, and TOTAL_EVENTS_STORAGE_SIZE_DATE metrics in src/metadata.rs and src/storage/object_storage.rs are designed to track total events across all streams, not per-stream. They use labels [origin, parsed_date] to aggregate by format and date, while per-stream metrics use [stream_name, origin, parsed_date] labels.

Applied to files:

  • src/metrics/mod.rs
📚 Learning: 2025-10-20T17:48:53.444Z
Learnt from: nikhilsinhaparseable
Repo: parseablehq/parseable PR: 1448
File: src/handlers/http/cluster/mod.rs:1370-1400
Timestamp: 2025-10-20T17:48:53.444Z
Learning: In src/handlers/http/cluster/mod.rs, the billing metrics processing logic should NOT accumulate counter values from multiple Prometheus samples with the same labels. The intended behavior is to convert each received counter from nodes into individual events for ingestion, using `.insert()` to store the counter value directly.

Applied to files:

  • src/metrics/mod.rs
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (10)
  • GitHub Check: coverage
  • GitHub Check: Build Default x86_64-unknown-linux-gnu
  • GitHub Check: Build Default x86_64-apple-darwin
  • GitHub Check: Build Default x86_64-pc-windows-msvc
  • GitHub Check: Build Default aarch64-unknown-linux-gnu
  • GitHub Check: Build Default aarch64-apple-darwin
  • GitHub Check: Build Kafka aarch64-apple-darwin
  • GitHub Check: Build Kafka x86_64-unknown-linux-gnu
  • GitHub Check: Quest Smoke and Load Tests for Standalone deployments
  • GitHub Check: Quest Smoke and Load Tests for Distributed deployments
🔇 Additional comments (3)
src/metrics/mod.rs (3)

337-359: LGTM! Clean metric definitions following established patterns.

The new cached and reasoning token metrics are well-structured and consistent with the existing LLM token metrics. The label structure ["provider", "model", "date"] matches the pattern used by TOTAL_INPUT_LLM_TOKENS_BY_DATE and TOTAL_OUTPUT_LLM_TOKENS_BY_DATE, ensuring consistent tracking granularity across all LLM token types.


460-465: LGTM! Proper metric registration.

Both metrics are correctly registered in the custom_metrics function and properly grouped with the other LLM token metrics.


599-614: LGTM! Helper functions are consistent and correct.

The new increment functions follow the exact pattern of increment_input_llm_tokens_by_date and increment_output_llm_tokens_by_date, maintaining API consistency across all LLM token tracking functions.

Tip

📝 Customizable high-level summaries are now available!

You can now customize how CodeRabbit generates the high-level summary in your pull requests — including its content, structure, tone, and formatting.

  • Provide custom instructions to shape the summary (bullet lists, tables, contributor stats, etc.).
  • Use high_level_summary_in_walkthrough to move the summary from the description to the walkthrough section.

Example:

"Create a concise high-level summary as a bullet-point list. Then include a Markdown table showing lines added and removed by each contributing author."


Comment @coderabbitai help to get the list of available commands and usage tips.

@nikhilsinhaparseable nikhilsinhaparseable merged commit 9926adb into parseablehq:main Nov 17, 2025
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant