---
title: gRPC configuration
description: Configuration for Allure gRPC | Step status | Metadata capture | Redact sensitive data | Limit body size
---

# Allure gRPC configuration

This page describes the options that affect the behavior of the [Allure gRPC](/docs/grpc/) integration.

To change the defaults, create the interceptor via `AllureGrpc.builder()` instead of `new AllureGrpc()`. All builder methods are chainable. Call `build()` at the end to get the interceptor.

```java
import io.grpc.ClientInterceptor;
import io.grpc.ManagedChannel;
import io.grpc.ManagedChannelBuilder;
import io.qameta.allure.grpc.AllureGrpc;

ClientInterceptor allure = AllureGrpc.builder()
        .redactHeader("x-api-key")
        .redactCookie("session")
        .build();

ManagedChannel channel = ManagedChannelBuilder.forAddress("localhost", 8080)
        .intercept(allure)
        .usePlaintext()
        .build();
```

## Step status

- `markStepFailedOnNonZeroCode(boolean enabled)`

By default, if a call ends with a non-zero gRPC status code, its step is marked as failed. Pass `false` to keep such steps passed, for example, if your tests check error responses on purpose.

```java
ClientInterceptor allure = AllureGrpc.builder()
        .markStepFailedOnNonZeroCode(false)
        .build();
```

## Metadata capture

- `captureRequestMetadata(boolean enabled)`
- `captureResponseMetadata(boolean enabled)`

By default, the attachment contains the request metadata, and the response headers and trailers. Pass `false` to leave them out for either direction. The `grpc-status` and `grpc-message` trailers are always shown.

```java
ClientInterceptor allure = AllureGrpc.builder()
        .captureRequestMetadata(false)
        .captureResponseMetadata(false)
        .build();
```

## Redact sensitive data

- `redactHeader(String name)` - replace the value of the given metadata key with a placeholder. The name is not case-sensitive.
- `redactCookie(String name)` - replace the value of the given cookie with a placeholder. Allure gRPC shows the cookies from the `cookie` metadata separately from the other metadata.

By default, the `authorization` metadata value is replaced with a placeholder.

```java
ClientInterceptor allure = AllureGrpc.builder()
        .redactHeader("x-api-key")
        .redactCookie("session")
        .build();
```

## Configure the HTTP exchange attachment

- `configureExchange(Consumer<HttpExchange.Builder> customizer)`

Allure gRPC records each call as an [HTTP exchange attachment](/docs/attachments/#http-exchanges). Use `configureExchange()` to change the other properties of this attachment, for example, the maximum size of the messages. If you call `configureExchange()`, `redactHeader()` or `redactCookie()` several times, all the changes are applied.

The following methods of the HTTP exchange builder are useful for gRPC calls:

- `redactHeader(String name)`, `redactCookie(String name)` - same as the builder methods above.
- `setMaxBodySize(long maxBodySize)` - the maximum number of bytes of the request or response messages to keep. Longer messages are truncated and marked as truncated in the report. Defaults to 1 MiB.

```java
ClientInterceptor allure = AllureGrpc.builder()
        .configureExchange(exchange -> exchange.setMaxBodySize(256_000))
        .build();
```
