Skip to content

Conversation

@VegetarianOrc
Copy link
Contributor

@VegetarianOrc VegetarianOrc commented Dec 3, 2025

What was changed

  • Add support for acquiring and using a MetricMeter inside Nexus operation handlers.
  • 💥 Narrow the accepted type of executor for sync Nexus operations from concurrent.futures.Executor to concurrent.futures.ThreadPoolExecutor. This is a breaking change.

Why?

To enable users to create metrics in Nexus operations in the same way as Activities.

The type of executor was narrowed to prevent users from running into known issues around pickleability. Additionally, handling Nexus operation start/cancel requests are intended to be short and aren't a great fit for something like a ProcessPoolExecutor.

Checklist

How was this tested:

New tests were added to include execution of Nexus operations via the async event loop and a ThreadPoolExecutor and verify that metrics are sent. The new tests mirror the existing workflow metrics tests, but are skipped in the time skipping environment due to lack of Nexus support.

@VegetarianOrc VegetarianOrc marked this pull request as ready for review December 3, 2025 23:11
@VegetarianOrc VegetarianOrc requested a review from a team as a code owner December 3, 2025 23:11
nexus_context: _OperationCtxT
"""Nexus-specific start operation context."""

runtime_metric_meter: temporalio.common.MetricMeter
Copy link
Contributor

Choose a reason for hiding this comment

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

This seems easy to mess up to me. If I'm just looking at the context, it seems easy to grab this one

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I went ahead and changed it from runtime_metric_meter to _runtime_metric_meter to help guide toward using metric_meter

Copy link
Contributor

@tconley1428 tconley1428 left a comment

Choose a reason for hiding this comment

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

Call out in the description what the breaking portion is.

@VegetarianOrc VegetarianOrc merged commit 89fb17f into main Dec 9, 2025
15 checks passed
@VegetarianOrc VegetarianOrc deleted the nexus-metric-meter branch December 9, 2025 00:07
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