Skip to content

Add activation lifecycle latency metrics#10125

Merged
ReubenBond merged 1 commit into
dotnet:mainfrom
ReubenBond:rebond/activation-lifecycle-latency-metrics
May 21, 2026
Merged

Add activation lifecycle latency metrics#10125
ReubenBond merged 1 commit into
dotnet:mainfrom
ReubenBond:rebond/activation-lifecycle-latency-metrics

Conversation

@ReubenBond

@ReubenBond ReubenBond commented May 21, 2026

Copy link
Copy Markdown
Member

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

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>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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 ActivationData for activation (tagged by outcome) and deactivation (tagged by shutdown path).
  • Added a unit test validating the new instruments are histograms, have ms units, 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;
}
});
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