Skip to content

feat: add OTel stats to mempool and ntx state#1073

Merged
bobbinth merged 3 commits intonextfrom
mirko/otels
Jul 10, 2025
Merged

feat: add OTel stats to mempool and ntx state#1073
bobbinth merged 3 commits intonextfrom
mirko/otels

Conversation

@Mirko-von-Leipzig
Copy link
Collaborator

This PR adds open-telemetry stats to the mempool and the ntb state.

These likely aren't perfectly labeled, but should let us sneak a peak while things are running at least.

Copy link
Contributor

@bobbinth bobbinth left a comment

Choose a reason for hiding this comment

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

Looks good! Thank you! I left a couple of small comments inline.

Comment on lines +156 to +159
/// The amount of transactions which are root nodes.
pub fn num_roots(&self) -> usize {
self.inner.num_roots()
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Does the "root node" here mean transactions that have no parents? (i.e., they don't depend on other transactions). If so, I would add this to the comment.

Comment on lines +504 to +512
span.set_attribute("mempool.transactions.total", self.transactions.len());
span.set_attribute("mempool.transactions.roots", self.transactions.num_roots());
span.set_attribute("mempool.accounts", self.state.num_accounts());
span.set_attribute("mempool.nullifiers", self.state.num_nullifiers());
span.set_attribute("mempool.output_notes", self.state.num_notes_created());
span.set_attribute("mempool.batches.pending", self.batches.num_pending());
span.set_attribute("mempool.batches.proven", self.batches.num_proven());
span.set_attribute("mempool.batches.total", self.batches.len());
span.set_attribute("mempool.batches.roots", self.batches.num_roots());
Copy link
Contributor

Choose a reason for hiding this comment

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

nit (feel free to ignore): it is not immediately obvious what mempool.transactions.roots and mempool.batches.roots means. Maybe there is a better name for them?

Copy link
Collaborator

@sergerad sergerad left a comment

Choose a reason for hiding this comment

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

LGTM TY.

Btw I couldn't seem to find any events containing target field in devnet yesterday which was surprising. The other fields seemed to come through just fine.

@bobbinth
Copy link
Contributor

I'll merge as is. We can address the comments in subsequent PRs (if needed).

@bobbinth bobbinth merged commit 5163e83 into next Jul 10, 2025
8 checks passed
@bobbinth bobbinth deleted the mirko/otels branch July 10, 2025 20:26
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.

4 participants