Skip to content

[ENH]: migrate current metering functionality to new metering lib #4868

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

Merged
merged 21 commits into from
Jul 1, 2025

Conversation

c-gamble
Copy link
Contributor

Description of changes

This PR migrates all of the existing metering functionality of Chroma to use the metering library created in #4746. It does not introduce any new metering functionality on top of what was present before.

Test plan

  • 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 17, 2025 23:34
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 17, 2025

Migrate Metering Functionality to New Metering Library

This major PR migrates all existing Rust-side metering (usage tracking/events around collection operations) out of the old chroma-tracing-based design and over to a new centralized 'chroma-metering' library. No new metering features are introduced; rather, the entire metering data pathway, event types, field tracking, and integration points across the frontend and service layers are rewritten to leverage the library's new event contexts, atomic value handling, and event submission patterns. Extensive refactoring is performed across service logic, event construction, and API surfaces, and a reusable library (with macro-accelerated trait-based context/event definitions) is now the single source for all Rust metering primitives, event serialization/deserialization, and async event submission.

Key Changes:
• Introduced new 'chroma-metering' crate, consolidating metering event types, contexts, event context construction macros, and event submission logic
• Replaced the previous (chroma-tracing-based) metering code with the new event-driven pattern everywhere in Rust, including all collection operation handlers in the frontend service
• Refactored all service logic (add, update, delete, upsert, fork, query, count, get, etc.) to create, populate, and submit MeterEvent instances through the new library's context containers and helpers
• Removed the old meter_event.rs and related artifacts from chroma-tracing
• Introduced new types for atomic value tracking (MeteringAtomicU64) and ensured proper serialization, equality, and thread safety
• Added tests for event serialization/deserialization, event receiver registration, and meter submission flows, validating correctness
• Updated workspace and dependency configurations (Cargo.toml, Cargo.lock, sub-crate manifests) to support the new metering library

Affected Areas:
• Rust frontend service (all collection CRUD/query event tracking)
• Metering/tracing infrastructure
• API surface for metering event context management
• Build system (new crate, dependency changes, lockfile)

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

Copy link
Collaborator

@HammadB HammadB left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@c-gamble c-gamble merged commit 5ded105 into main Jul 1, 2025
111 of 113 checks passed
@c-gamble c-gamble deleted the cooper/chroma-metering-macros-integration branch July 1, 2025 21:15
c-gamble added a commit that referenced this pull request Jul 1, 2025
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.

- [x] Tests pass locally with `pytest` for python, `yarn test` for js,
`cargo test` for rust

## Documentation Changes
N/A
Inventrohyder pushed a commit to Inventrohyder/chroma that referenced this pull request Aug 5, 2025
…roma-core#4868)

## Description of changes

This PR migrates all of the existing metering functionality of Chroma to
use the metering library created in chroma-core#4746. It does not introduce any new
metering functionality on top of what was present before.

## Test plan

- [x] Tests pass locally with `pytest` for python, `yarn test` for js,
`cargo test` for rust

## Documentation Changes

N/A
Inventrohyder pushed a commit to Inventrohyder/chroma that referenced this pull request Aug 5, 2025
This PR uses the `chroma-metering` library introduced in
chroma-core#4868 to add execution timing
to requests received on the frontend.

⚠️ chroma-core#4868 should be merged first.

- [x] Tests pass locally with `pytest` for python, `yarn test` for js,
`cargo test` for rust

## Documentation Changes
N/A
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.

3 participants