Skip to content

[ENH]: chroma-metering-macros #4746

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 46 commits into from
Jun 17, 2025
Merged

[ENH]: chroma-metering-macros #4746

merged 46 commits into from
Jun 17, 2025

Conversation

c-gamble
Copy link
Contributor

@c-gamble c-gamble commented Jun 3, 2025

Description of changes

This PR introduces a metering library that provides a procedural macro for defining attributes and events. Please view the relevant ADR (not linked) for additional context.

Todo

  • First cut
  • Change disk registry to in-memory
  • Move registry into macros crate
  • Realize that first cut actually doesn't work, put everything into one macro
  • Clean up variable names/functions (readability)
  • Formalize and expand test suite (robustness)
  • Add documentation via comments (maintainability)

Test plan

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

Documentation Changes

WIP

@c-gamble c-gamble requested review from drewkim and HammadB June 3, 2025 23:43
@c-gamble c-gamble changed the title [ENH]: metering library first cut [ENH]: chroma-metering Jun 3, 2025
@c-gamble c-gamble marked this pull request as ready for review June 5, 2025 21:58
Copy link
Contributor

propel-code-bot bot commented Jun 5, 2025

Introduce Procedural Macro-Based Metering Library (chroma-metering)

This PR introduces a new procedural macro-based metering library (chroma-metering) for the Chroma Rust workspace. The library enables users to define custom 'capabilities' and 'contexts' for structured, reliable, and scalable multi-threaded metering. It supplies a single macro, initialize_metering, which generates all metering infrastructure (traits, forwarding, trait-object downcasting, context management, and async-friendly APIs). Comprehensive documentation, test coverage, and a new workspace member are included.

Key Changes:
• Adds new crate chroma-metering providing a procedural macro system for metering.
• Implements macro-processing logic supporting custom capability/context/handler triples; outputs all boilerplate and safe trait object forwarding.
• Defines runtime (Enter/Exit stack, thread-local handling, custom Receiver integration, safe context downcasting) through generated code.
• Includes detailed in-crate documentation, README, and an extensive async/concurrency-aware test suite.
• Updates Cargo workspace to register and integrate the new crate.

Affected Areas:
• Cargo workspace membership and dependencies
• New codebase in rust/metering/
• Build/test pipeline due to new crate and procedural macro
• Metering-related logic and integration touchpoints

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

@c-gamble c-gamble force-pushed the cooper/chroma-metering-lib branch from 49241a6 to ed6e4a3 Compare June 9, 2025 17:17
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.

My comments are questions I will ask live

@c-gamble c-gamble changed the title [ENH]: chroma-metering [ENH]: chroma-metering-macros Jun 16, 2025
@c-gamble c-gamble merged commit 84c0feb into main Jun 17, 2025
57 checks passed
@c-gamble c-gamble deleted the cooper/chroma-metering-lib branch June 17, 2025 00:46
c-gamble added a commit that referenced this pull request Jul 1, 2025
)

## 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

- [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
## Description of changes

This PR introduces a metering library that provides a procedural macro
for defining attributes and events. Please view the relevant ADR (not
linked) for additional context.

## Todo

- [x] First cut
- [x] Change disk registry to in-memory
- [x] Move registry into macros crate
- [x] Realize that first cut actually doesn't work, put everything into
one macro
- [x] Clean up variable names/functions (readability)
- [x] Formalize and expand test suite (robustness)
- [x] Add documentation via comments (maintainability)

## Test plan

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

## Documentation Changes

WIP
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
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