﻿---
title: Set up StackExchange.Redis instrumentation
description: How to enable Elastic APM .NET Agent instrumentation of Redis commands using the StackExchange.Redis client.
url: https://www.elastic.co/elastic/docs-builder/docs/3410/reference/apm/agents/dotnet/setup-stackexchange-redis
products:
  - APM .NET Agent
  - APM Agent
applies_to:
  - Serverless Observability projects: Generally available
  - Elastic Stack: Generally available
  - Application Performance Monitoring Agent for .NET: Generally available
---

# Set up StackExchange.Redis instrumentation
## Supported versions


| 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](/elastic/docs-builder/docs/3410/reference/apm/agents/dotnet/supported-technologies#supported-data-access-technologies).

## Quick start

This page assumes the core agent is already set up. If not, see [Set up the APM .NET Agent](https://www.elastic.co/elastic/docs-builder/docs/3410/reference/apm/agents/dotnet/set-up-apm-net-agent) first.
Add the [`Elastic.Apm.StackExchange.Redis`](https://www.nuget.org/packages/Elastic.Apm.StackExchange.Redis) NuGet package to your project:
```sh
dotnet add package Elastic.Apm.StackExchange.Redis
```

Call the `UseElasticApm()` extension method on your `IConnectionMultiplexer`:
```csharp
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`.