Skip to content

Conversation

@rkargMsft
Copy link
Contributor

@rkargMsft rkargMsft commented Jan 5, 2026

Adds Lifecycle and Storage ActivitySources and new Spans for:

  • Lifecycle - Placement, activation, grain directory, migration, dehydrate/rehydrate
  • Storage -Persistance read/write/clear
  • Application - IAsyncEnumerable: main call span and nested Start/MoveNext/Dispose
    • Note that these three spans have moved out of the Runtime ActivitySource and into the Application ActivitySource. Versions on those ActivitySources have been updated to reflect this change.

Additionally added public constants in Orleans.Diagnostics.ActivitySources to help with adding listeners, such as through OpenTelemetry's .AddSource(ActivitySources.ApplicationGrainActivitySourceName). There is additionally a ActivitySources.AllActivitySourceName value to get all Orleans spans.

Documentation PR: dotnet/docs#50919

Microsoft Reviewers: Open in CodeFlow

rkargMsft and others added 5 commits January 5, 2026 19:03
…racing

Introduce distinct ActivitySources for application, runtime, lifecycle, and storage tracing in Orleans. Update grain call filter and runtime logic to use the correct source based on operation type. Enhance async enumerable tracing with session activities and proper context propagation. Add new grain and tests to verify async enumerable activity spans. Improve test coverage and assertions for new tracing structure, increasing observability and diagnostic precision across subsystems.
Copy link
Contributor

Copilot AI left a comment

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 comprehensive distributed tracing support for Orleans grain lifecycle operations, including activation, placement, storage, and migration. The changes introduce new activity sources to organize telemetry spans and instrument key runtime operations that were previously not traced.

Key changes:

  • Introduces new ActivitySources and ActivityNames abstractions to centralize activity source management and operation naming
  • Adds tracing spans for grain activation, placement filtering, directory registration, and OnActivateAsync execution
  • Adds tracing spans for storage operations (read, write, clear) with proper parent context propagation
  • Adds tracing spans for grain migration (dehydrate/rehydrate) with context propagation across silos
  • Adds comprehensive test coverage to verify span creation and proper parent-child relationships

Reviewed changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 12 comments.

Show a summary per file
File Description
src/Orleans.Core.Abstractions/Diagnostics/ActivitySources.cs New file defining centralized activity sources for Application, Runtime, Lifecycle, and Storage operations
src/Orleans.Core/Diagnostics/ActivityNames.cs New file defining standardized operation names for tracing spans
src/Orleans.Core/Diagnostics/ActivityPropagationGrainCallFilter.cs Updated to use new ActivitySources abstraction and route different interface types to appropriate activity sources
src/Orleans.Core.Abstractions/Runtime/AsyncEnumerableRequest.cs Adds session-level activity tracking for async enumerable operations with proper parent-child relationships
src/Orleans.Core.Abstractions/Properties/AssemblyInfo.cs Exposes internal types to Tester assembly for testing
src/Orleans.Runtime/Catalog/Catalog.cs Adds activation span creation with activity context propagation from request context
src/Orleans.Runtime/Catalog/ActivationData.cs Adds detailed lifecycle tracing for activation, dehydration, and rehydration with events and error tracking
src/Orleans.Runtime/Storage/StateStorageBridge.cs Adds storage operation tracing spans with parent context from activation activity
src/Orleans.Runtime/Placement/PlacementService.cs Adds placement operation tracing and placement filter spans with activity context restoration
test/Tester/ActivationTracingTests.cs Comprehensive test suite verifying all new tracing spans and their parent-child relationships
test/Tester/ActivityPropagationTests.cs Updated to use new ActivitySources constants
test/Grains/TestGrainInterfaces/IActivityGrain.cs Adds test interface for async enumerable activity tracing
test/Grains/TestGrains/ActivityGrain.cs Adds test grain implementation for async enumerable activity tracing

@rkargMsft rkargMsft marked this pull request as ready for review January 6, 2026 23:49
…rable spans.

Runtime (1.0.0 -> 2.0.0) no longer gets the Start/MoveNext/Dispose spans
Application (1.0.0 -> 1.1.0) now gets the Start/MoveNext/Dispose spans and these are nested under a new span for the overall grain call being made.
@rkargMsft
Copy link
Contributor Author

@ReubenBond This PR should be ready for review. Docs PR also linked.

Test failure appears to be a flaky test.

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.

1 participant