Skip to content

[ENH]: add metric for component queue depth & change dispatcher queue depth metric buckets #5261

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 1 commit into from
Aug 13, 2025

Conversation

codetheweb
Copy link
Contributor

@codetheweb codetheweb commented Aug 13, 2025

Description of changes

This adds a metric for the queue depth of components (number of messages waiting to be handled by the component) and updates the dispatcher queue metrics to have a dynamic set of boundaries based on the current config.

This will help debug component/dispatcher queuing issues.

Test plan

How are these changes tested?

I validated that the metrics show up in Grafana when running with Tilt and that the values look reasonable.

Migration plan

Are there any migrations, or any forwards/backwards compatibility changes needed in order to make sure this change deploys reliably?

Observability plan

What is the plan to instrument and monitor this change?

Documentation Changes

Are all docstrings for user-facing APIs updated if required? Do we need to make documentation changes in the docs section?

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)

@codetheweb codetheweb changed the title [ENH]: add metric for component queue depth & change dispatcher queue depth metrics to histograms [ENH]: add metric for component queue depth & change dispatcher queue depth metric buckets Aug 13, 2025
@codetheweb codetheweb force-pushed the feat-component-queue-metric-dispatcher-gauges branch from 688fccd to 4121d31 Compare August 13, 2025 18:34
@codetheweb codetheweb marked this pull request as ready for review August 13, 2025 18:44
@codetheweb codetheweb requested a review from sanketkedia August 13, 2025 18:44
Copy link
Contributor

Add Component and Dispatcher Queue Depth Metrics with Dynamic Histogram Bucketing

This PR introduces a new metric to track the queue depth of each component, allowing observability into how many messages are waiting for processing per component. Additionally, it modifies the dispatcher queue metrics so that the associated OpenTelemetry histograms use dynamically-calculated bucket boundaries based on the relevant configuration values (e.g., max queue sizes). This enhancement is intended to facilitate debugging of component and dispatcher queuing issues. The changes were validated visually in Grafana using Tilt.

Key Changes

• Introduced an OpenTelemetry histogram metric in ComponentExecutor to track each components queue depth (``component_queue_depth') with dynamic bucket boundaries based on queue size.
• Refactored Dispatcher queue depth metrics: metrics are now instantiated with histogram boundaries that reflect dispatcher and I/O queue size configuration, replacing the previous static or default boundaries.
DispatcherMetrics uses a new constructor (new) to support dynamic histogram boundary setup based on worker/IO queue sizes.
• Dispatchers new' method updated to pass the necessary config values for metrics initialization.
• Metrics are recorded on each message loop iteration inside ComponentExecutor and Dispatcher based on current queue state.
• Minimal reorganization of imports at the top of the affected files.

Affected Areas

• rust/system/src/execution/dispatcher.rs
• rust/system/src/executor.rs
• Metrics and observability for queue depth across the system

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

@blacksmith-sh blacksmith-sh bot deleted a comment from codetheweb Aug 13, 2025
@codetheweb codetheweb merged commit f178c35 into main Aug 13, 2025
116 of 118 checks passed
@codetheweb codetheweb deleted the feat-component-queue-metric-dispatcher-gauges branch August 13, 2025 20:55
chroma-droid pushed a commit that referenced this pull request Aug 13, 2025
codetheweb added a commit that referenced this pull request Aug 13, 2025
Co-authored-by: Max Isom <codetheweb@users.noreply.github.com>
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