Set up StackExchange.Redis instrumentation
| Package | Supported versions |
|---|---|
StackExchange.Redis |
≥2.0.495 <3.0.0 |
For the full compatibility matrix including supported installation methods, refer to Data access technologies.
This page assumes the core agent is already set up. If not, see Set up the APM .NET Agent first.
Add the Elastic.Apm.StackExchange.Redis NuGet package to your project:
dotnet add package Elastic.Apm.StackExchange.Redis
Call the UseElasticApm() extension method on your IConnectionMultiplexer:
using Elastic.Apm.StackExchange.Redis;
var connection = await ConnectionMultiplexer.ConnectAsync("<redis connection>");
connection.UseElasticApm();
A callback is registered with the IConnectionMultiplexer to provide a profiling session for each transaction and span that captures redis commands sent with IConnectionMultiplexer.