Egil.Orleans.Storage
1.2.0
See the version list below for details.
dotnet add package Egil.Orleans.Storage --version 1.2.0
NuGet\Install-Package Egil.Orleans.Storage -Version 1.2.0
<PackageReference Include="Egil.Orleans.Storage" Version="1.2.0" />
paket add Egil.Orleans.Storage --version 1.2.0
#r "nuget: Egil.Orleans.Storage, 1.2.0"
// Install Egil.Orleans.Storage as a Cake Addin #addin nuget:?package=Egil.Orleans.Storage&version=1.2.0 // Install Egil.Orleans.Storage as a Cake Tool #tool nuget:?package=Egil.Orleans.Storage&version=1.2.0
Extensions to Orleans Storage
This library provides OpenTelemetry integration for Microsoft Orleans grain storage providers. It enables detailed telemetry collection for grain storage operations with minimal configuration, helping you monitor and analyze storage performance, errors, and usage patterns in your Orleans applications.
Installation
Install the package from NuGet: https://www.nuget.org/packages/Egil.Orleans.Storage
Usage
Adding Grain Storage Telemetry
Add telemetry enrichment for all registered grain storage providers:
siloBuilder.AddGrainStorageTelemetry();
This extension method wraps each registered grain storage provider with a telemetry enricher that creates spans for storage operations and collects metrics for read, write and clear operations.
Handling GET Operations for Missing Entities
Some storage providers (notably Azure Storage) mark read operations for non-existent entities as errors, which isn't always appropriate in Orleans. This processor ensures such operations are marked as successful in telemetry:
siloBuilder.Services.AddGrainStorageGetAlwaysOkTelemetryProcessor();
Configuring Sampling for Storage Telemetry
To prevent excessive telemetry collection in high-volume applications, configure sampling for storage operations:
siloBuilder.AddGrainStorageTelemetrySamplingProcessor(
samplingProbability: 0.1,
storageName: "MyStorage");
Parameters:
samplingProbability
: Value between 0.0 and 1.0 determining what percentage of operations to trace (0.1 = 10%)storageName
: Optional filter to apply sampling only to a specific storage providerstateName
: Optional filter to apply sampling only to a specific grain state
OpenTelemetry Configuration
To properly collect and export Orleans grain storage telemetry, configure your OpenTelemetry setup as shown (this extends the default configuration in Aspire enabled projects):
public static TBuilder ConfigureOpenTelemetry<TBuilder>(this TBuilder builder) where TBuilder : IHostApplicationBuilder
{
builder.Logging.AddOpenTelemetry(logging =>
{
logging.IncludeFormattedMessage = true;
logging.IncludeScopes = true;
});
builder.Services.AddOpenTelemetry()
.WithMetrics(metrics =>
{
metrics.AddAspNetCoreInstrumentation()
.AddHttpClientInstrumentation()
.AddRuntimeInstrumentation()
.AddMeter("Microsoft.Orleans")
.AddMeter("Microsoft.Orleans.GrainStorage"); // <-- Add this line to enable storage metrics
})
.WithTracing(tracing =>
{
tracing.AddSource("Microsoft.Orleans.Application");
tracing.AddSource("Microsoft.Orleans.GrainStorage"); // <-- Add this line to enable storage tracing
tracing.AddSource(builder.Environment.ApplicationName)
.AddAspNetCoreInstrumentation()
.AddHttpClientInstrumentation();
});
builder.AddOpenTelemetryExporters();
return builder;
}
private static TBuilder AddOpenTelemetryExporters<TBuilder>(this TBuilder builder) where TBuilder : IHostApplicationBuilder
{
if (!string.IsNullOrWhiteSpace(builder.Configuration["OTEL_EXPORTER_OTLP_ENDPOINT"]))
{
builder.Services
.AddOpenTelemetry()
.UseOtlpExporter()
// Recommended to allow parent sampler to influence child spans.
.WithTracing(tracing => tracing.SetSampler(
new ParentBasedSampler(
new AlwaysOnSampler())));
}
if (!string.IsNullOrWhiteSpace(builder.Configuration["APPLICATIONINSIGHTS_CONNECTION_STRING"]))
{
builder.Services
.AddOpenTelemetry()
.UseAzureMonitor()
// Recommended to allow parent sampler to influence child spans.
.WithTracing(tracing => tracing.SetSampler(
new ParentBasedSampler(
new AlwaysOnSampler())));
}
return builder;
}
The key components in this configuration:
- Adding the
Microsoft.Orleans.GrainStorage
meter to collect storage-specific metrics - Adding the
Microsoft.Orleans.GrainStorage
activity source to capture detailed traces - Configuring exporters like OTLP (OpenTelemetry Protocol) or Azure Monitor
Collected Telemetry
Metrics
orleans-storage-read
: Count of read operations with storage name and state name dimensionsorleans-storage-write
: Count of write operations with storage name and state name dimensionsorleans-storage-clear
: Count of clear operations with storage name and state name dimensions
Traces
Storage operations generate spans with the following attributes:
- Storage provider name
- State name
- Grain ID
- Operation type (Read/Write/Clear)
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. |
-
net9.0
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 9.0.3)
- Microsoft.Orleans.Runtime (>= 9.1.2)
- OpenTelemetry.Extensions.Hosting (>= 1.11.2)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
1.9.3 | 120 | 3/20/2025 |
1.8.3 | 105 | 3/20/2025 |
1.5.15-alpha-g0068e22c34 | 101 | 3/19/2025 |
1.5.14-alpha-g07becff3bc | 96 | 3/19/2025 |
1.5.13-alpha-gd675b7ec70 | 102 | 3/19/2025 |
1.5.12-alpha-gc2c32e4281 | 101 | 3/19/2025 |
1.5.11-alpha-gabddf5bf54 | 101 | 3/19/2025 |
1.5.5 | 104 | 3/19/2025 |
1.4.2-g1104c8c7ac | 106 | 3/19/2025 |
1.3.0 | 107 | 3/18/2025 |
1.2.0 | 109 | 3/18/2025 |
1.1.0 | 112 | 3/17/2025 |
1.0.3-alpha.0.3 | 104 | 3/17/2025 |
1.0.3-alpha.0.2 | 105 | 3/17/2025 |