﻿---
title: Set up Confluent Kafka instrumentation
description: How to enable Elastic APM .NET Agent tracing of Confluent Kafka producers and consumers via OpenTelemetry activities or the profiler.
url: https://www.elastic.co/elastic/docs-builder/docs/3406/reference/apm/agents/dotnet/setup-kafka
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 Confluent Kafka instrumentation
## Supported versions


| Package           | Supported versions |
|-------------------|--------------------|
| `Confluent.Kafka` | ≥1.4.0 <3.0.0      |

For the full compatibility matrix including supported installation methods, refer to [Messaging systems](/elastic/docs-builder/docs/3406/reference/apm/agents/dotnet/supported-technologies#supported-messaging-systems).

## 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/3406/reference/apm/agents/dotnet/set-up-apm-net-agent) first.
`Confluent.Kafka` does not natively emit OpenTelemetry activities. To enable tracing without the profiler, add [`Confluent.Kafka.Extensions.Diagnostics`](https://www.nuget.org/packages/Confluent.Kafka.Extensions.Diagnostics) (a third-party package) to your project. This package wraps producers and consumers to emit OpenTelemetry activities, which the agent's built-in [OpenTelemetry Bridge](https://www.elastic.co/elastic/docs-builder/docs/3406/reference/apm/agents/dotnet/opentelemetry-bridge) captures automatically.
Follow the setup instructions in the [`Confluent.Kafka.Extensions.Diagnostics`](https://www.nuget.org/packages/Confluent.Kafka.Extensions.Diagnostics) package, in particular the producer configuration which requires explicit wrapping.
<note>
  If you are using the [Elastic APM Profiler](https://www.elastic.co/elastic/docs-builder/docs/3406/reference/apm/agents/dotnet/setup-auto-instrumentation), Kafka is instrumented automatically via IL rewriting for `Confluent.Kafka` ≥1.4.0 <3.0.0 with no code changes required. The `Confluent.Kafka.Extensions.Diagnostics` package is not needed in that case.
</note>