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

# OpenFeign Integration | Sentry for Java

Capturing transactions requires that you first [set up tracing](https://docs.sentry.io/platforms/java/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/tracing/instrumentation/open-feign.md#install)

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

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/tracing/instrumentation/open-feign.md#configure)

Add `SentryCapability` to Feign builder:

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

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

## [Modify or Drop Spans](https://docs.sentry.io/platforms/java/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
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/");
```
