Repository navigation
Extension OpenTelemetry
Stateflows.Extensions.OpenTelemetry instruments State Machine, Activity, Action, and Entity execution for OpenTelemetry. It registers Stateflows observers and interceptors, an ActivitySource, and a Meter; the host remains responsible for choosing and configuring exporters.
Register the extension as part of Stateflows setup:
services.AddStateflows(stateflows => stateflows
.AddOpenTelemetry()
.AddStateMachines(machines => machines
.AddStateMachine<Order>()));The extension integrates its meter and trace source with the .NET OpenTelemetry SDK. Configure exporters and any additional resource attributes using the application's usual OpenTelemetry setup. Add a listener/exporter for the Stateflows activity source to collect traces.
The Stateflows meter reports resource execution counts, execution duration, and active/waiting execution gauges. Trace spans describe State Machine event processing and its transitions, and the other behavior tracers cover their respective behavior executions. Events marked [NoTracing] or carrying the NoTracing header can opt out of tracing.
The source also registers the Stateflows.Orleans meter name to make Orleans runtime instruments observable through the SDK when that runtime is used. This package adds instrumentation only; it does not configure a backend or exporter. See the extension source.
For local diagnostics, install OpenTelemetry.Exporter.Console and add exporters to the same service collection:
using OpenTelemetry.Metrics;
using OpenTelemetry.Trace;
services.AddOpenTelemetry()
.WithTracing(tracing => tracing.AddConsoleExporter())
.WithMetrics(metrics => metrics.AddConsoleExporter());This supplements the Stateflows extension registration above: its AddSource and AddMeter configuration is already registered. The host controls export destinations, sampling, resource attributes, and production credentials; console export is a local demonstration, not a production backend configuration.
Home page Support Code licensed under an MIT-style License. Documentation licensed under CC BY 4.0. © by Mikołaj Milewski, 2026
Overview
Installation
Runtimes
Orleans runtime
Concepts
Events and Structural Events
Messaging Patterns
Validation
Scheduling
Observability
Behaviors
Behavior Values
Dependency Injection
Behavioral Groups
State Machines
Concepts
State Identity
In-State Event Deferrals
Evaluation of Transitions
Exception Handling
Building blocks
Regions
States
State
Composite State
Orthogonal State
Final State
Pseudostates
Choice
Junction
Fork
Join
History
Transitions
Transition
Default Transition
Internal Transition
Activities
Concepts
Exception Handling
Implicit Fork and Join
Tokens
Building blocks
Nodes
Action Node
Decision Node
Merge Node
Initial Node
Final Node
Input Node
Output Node
Fork Node
Join Node
Accept Event Action Node
Send Event Action Node
Publish Event Action Node
Time Event Action Node
Data Store Node
Structured Activity Node
Iterative Activity Node
Parallel Activity Node
Flows
Data Flow
Control Flow
Actions
Entities
Fields
Mutations
Projections
Extensions
ClearScript
FluentValidation
JSON definitions
Minimal APIs
OneOf
OpenTelemetry
PlantUML
Scheduling