Add activation lifecycle latency metrics#10125
Merged
ReubenBond merged 1 commit intoMay 21, 2026
Merged
Conversation
Record histogram measurements for grain activation and deactivation latency in the catalog lifecycle path. Tag activation latency by outcome and deactivation latency by shutdown path. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds new catalog-level histogram metrics to measure grain activation and deactivation lifecycle latency, enabling operators to identify slow lifecycle work without introducing high-cardinality grain labels.
Changes:
- Added two new metric instrument names for activation/deactivation latency histograms.
- Implemented histogram recording in
ActivationDatafor activation (tagged by outcome) and deactivation (tagged by shutdown path). - Added a unit test validating the new instruments are histograms, have
msunits, and record expected values.
Show a summary per file
| File | Description |
|---|---|
| test/Orleans.Core.Tests/Runtime/CatalogInstrumentsTests.cs | Adds a metrics listener test to validate the new catalog lifecycle latency histograms emit measurements. |
| src/Orleans.Runtime/Catalog/ActivationData.cs | Records activation latency (with outcome) and deactivation latency (with shutdown-path tag) from the activation/deactivation lifecycle paths. |
| src/Orleans.Core/Diagnostics/Metrics/InstrumentNames.cs | Introduces new metric name constants for catalog activation/deactivation latency histograms. |
| src/Orleans.Core/Diagnostics/Metrics/CatalogInstruments.cs | Adds histogram instruments and helper methods to record activation/deactivation latency with low-cardinality tags. |
Copilot's findings
- Files reviewed: 4/4 changed files
- Comments generated: 1
Comment on lines
+35
to
+45
| listener.SetMeasurementEventCallback<double>((instrument, measurement, tags, state) => | ||
| { | ||
| if (instrument.Name == InstrumentNames.CATALOG_ACTIVATION_LATENCY) | ||
| { | ||
| activationLatencyMeasurement = measurement; | ||
| } | ||
| else if (instrument.Name == InstrumentNames.CATALOG_DEACTIVATION_LATENCY) | ||
| { | ||
| deactivationLatencyMeasurement = measurement; | ||
| } | ||
| }); |
This was referenced Jun 14, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Reason
Add visibility into grain activation and deactivation latency so operators can observe slow lifecycle work in the catalog path.
Solution
Add catalog histogram instruments for activation and deactivation latency. Activation measurements are tagged by outcome, and deactivation measurements are tagged by the shutdown path so slow lifecycle operations can be separated without high-cardinality grain labels. The measurements are recorded from ActivationData's activation/deactivation lifecycle paths and covered by a metrics test.
Microsoft Reviewers: Open in CodeFlow