Automatically instruments the outgoing calls to Redis made using
StackExchange.Redis
library.
dotnet add package OpenTelemetry.Instrumentation.StackExchangeRedis
// Connect to the server.
using var connection = ConnectionMultiplexer.Connect("localhost:6379");
// Pass the connection to AddRedisInstrumentation.
using var openTelemetry = Sdk.CreateTracerProvider(b => b
.AddRedisInstrumentation(connection)
.UseZipkinExporter()
.SetResource(Resources.CreateServiceResource("my-service"));
For a more detailed example see TestRedis.