---
title: "OpenFeign Integration"
description: "Learn how to capture tracing information of OpenFeign-based HTTP clients."
url: https://docs.sentry.io/platforms/java/guides/spring-boot/tracing/instrumentation/open-feign/
---

# OpenFeign Integration | Sentry for Spring Boot

Capturing transactions requires that you first [set up tracing](https://docs.sentry.io/platforms/java/guides/spring-boot/tracing.md) if you haven't already.

Sentry OpenFeign integration provides the `SentryFeignClient`, which creates a span for each outgoing HTTP request executed with a [Feign](https://github.com/OpenFeign/feign)-based HTTP client.

### [Install](https://docs.sentry.io/platforms/java/guides/spring-boot/tracing/instrumentation/open-feign.md#install)

**Maven**

```xml
<dependency>
    <groupId>io.sentry</groupId>
    <artifactId>sentry-openfeign</artifactId>
    <version>8.42.0</version>
</dependency>
```

**Gradle**

```groovy
implementation 'io.sentry:sentry-openfeign:8.42.0'
```

**SBT**

```scala
libraryDependencies += "io.sentry" % "sentry-openfeign" % "8.42.0"
```

For other dependency managers see the [central Maven repository](https://search.maven.org/artifact/io.sentry/sentry-openfeign).

## [Configure](https://docs.sentry.io/platforms/java/guides/spring-boot/tracing/instrumentation/open-feign.md#configure)

Add `SentryCapability` to Feign builder:

**java**

```java
import feign.Feign;
import io.sentry.openfeign.SentryCapability;

YourApi api = Feign.builder()
    .addCapability(new SentryCapability())
    ...
    .target(YourApi.class, "https://your-api-host/");
```

**kotlin**

```kotlin
import feign.Feign
import io.sentry.openfeign.SentryCapability

val api = Feign.builder()
    .addCapability(SentryCapability())
    ...
    .target(YourApi::class.java, "https://your-api-host/")
```

## [Modify or Drop Spans](https://docs.sentry.io/platforms/java/guides/spring-boot/tracing/instrumentation/open-feign.md#modify-or-drop-spans)

Spans created around HTTP requests can be modified or dropped using `SentryFeignClient.BeforeSpanCallback` passed to `SentryCapability`:

**java**

```java
import feign.Feign;
import io.sentry.openfeign.SentryCapability;

YourApi api = Feign.builder()
    .addCapability(
        new SentryCapability(
            (span, request, response) -> {
              // modify span or return `null` to drop
              if (request.url().endsWith("/todos")) {
                span.setTag("tag-name", "tag-value");
              }
              return span;
            }))
    ...
    .target(YourApi.class, "https://your-api-host/");
```

**kotlin**

```kotlin
import feign.Feign
import feign.Request
import feign.Response
import io.sentry.ISpan
import io.sentry.openfeign.SentryCapability
import io.sentry.openfeign.SentryFeignClient.BeforeSpanCallback

val api = Feign.builder()
    .addCapability(
        SentryCapability(
            BeforeSpanCallback { span: ISpan, request: Request, response: Response? ->
                // modify span or return `null` to drop
                if (request.url().endsWith("/todos")) {
                    span.setTag("tag-name", "tag-value")
                }
                span
            }))
    .target(YourApi::class.java, "https://your-api-host/")
```
