Skip to content

Cache with_label_values more & don't do metrics while holding lock #2734

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 2 commits into
base: master
Choose a base branch
from

Conversation

Centril
Copy link
Contributor

@Centril Centril commented May 14, 2025

Description of Changes

Two things happen here that work together to improve performance:

  • Calls to with_label_values are cached to the extent possible.
  • No metrics are reported while a transaction lock, read-only or mutable, is held.

Changes to traits.rs are:

  • Transaction terminal functions (methods consuming transactions, like committing) now also return TxMetrics and sometimes also the reducer name (String) from the ExecutionContext.
  • TxData now exposes which tables were affected.

Closes #1099 which was the first attempt at not reporting while holding the lock. The PR has since bitrotted.

API and ABI breaking changes

None

Expected complexity level and risk

3, most of the complication is where datastore transactionality is touched.

Testing

Should be covered by existing tests.

@Centril Centril requested a review from cloutiertyler as a code owner May 14, 2025 11:26
@Centril Centril requested a review from joshua-spacetime May 14, 2025 11:27
@Centril Centril changed the title Cache with_label_values where possible & don't do metrics while holding lock Cache with_label_values more & don't do metrics while holding lock May 14, 2025
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.

2 participants