Skip to content

[ENH]: add request timing to metering #4877

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 23 commits into
base: main
Choose a base branch
from
Open

Conversation

c-gamble
Copy link
Contributor

This PR uses the chroma-metering library introduced in #4868 to add execution timing to requests received on the frontend.

⚠️ #4868 should be merged first.

  • Tests pass locally with pytest for python, yarn test for js, cargo test for rust

Documentation Changes

N/A

@c-gamble c-gamble requested review from HammadB and Sicheng-Pan June 18, 2025 17:30
Copy link

Reviewer Checklist

Please leverage this checklist to ensure your code review is thorough before approving

Testing, Bugs, Errors, Logs, Documentation

  • Can you think of any use case in which the code does not behave as intended? Have they been tested?
  • Can you think of any inputs or external events that could break the code? Is user input validated and safe? Have they been tested?
  • If appropriate, are there adequate property based tests?
  • If appropriate, are there adequate unit tests?
  • Should any logging, debugging, tracing information be added or removed?
  • Are error messages user-friendly?
  • Have all documentation changes needed been made?
  • Have all non-obvious changes been commented?

System Compatibility

  • Are there any potential impacts on other parts of the system or backward compatibility?
  • Does this change intersect with any items on our roadmap, and if so, is there a plan for fitting them together?

Quality

  • Is this code of a unexpectedly high quality (Readability, Modularity, Intuitiveness)

Copy link
Contributor

propel-code-bot bot commented Jun 18, 2025

Integrate New Metering Library and Add Request Execution Timing to Frontend

This PR replaces all prior metering event collection and emission logic in the Rust frontend with the new chroma-metering crate. It adds support for measuring execution timing (latency) of all major frontend API requests by establishing metering contexts at the API boundary, propagating them through business logic, and capturing relevant metrics (including precise timing) before submitting detailed structured meter events to the system for billing/monitoring purposes. This change touches all data/read/write request paths in the frontend and fully removes the previous tracing-based event definitions. PR #4868 must be merged first, as it introduces the chroma-metering library.

Key Changes:
• Replace chroma_tracing::meter_event usages and event creation with contexts and event types from the new chroma-metering crate throughout the Rust frontend logic.
• Instrument all API endpoints (add, update, upsert, count, get, query, delete, fork) to construct metering contexts at request entry, propagate them, attach relevant metadata (timings, byte counts, etc.), and emit structured events.
• Implement request execution duration metering: calculate latency from request entry to completion for each endpoint and encapsulate this in the metering data.
• Add new chroma-metering crate with types, context helpers, event definitions, and atomic value wrappers. Move event receiver/submit logic and types from chroma-tracing to chroma-metering.
• Remove legacy meter event enums and tracing-based logic from chroma-tracing.
• Update project wiring: adjust Cargo.toml and workspace definitions to build and depend on the new crate, and update all frontend imports accordingly.

Affected Areas:
• Rust frontend API implementation (all major endpoints in service_based_frontend.rs and server.rs)
• Event/data metering logic (now in the chroma-metering crate)
• Project Cargo.toml and workspace management
• Event emission and receiver initialization
• Removal of old tracing logic in tracing/src/meter_event.rs

This summary was automatically generated by @propel-code-bot

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