Configuring global flags

What flags in Armeria are

Flags are global variables that control the behavior of Armeria. These variables mostly serve one of the following two purposes:

  1. Overriding the default system values.
  2. Enhanced debugging or monitoring.

You can also override these properties by setting JVM system properties. For example:

  • -Dcom.linecorp.armeria.defaultRequestTimeoutMillis=<long>
  • -Dcom.linecorp.armeria.defaultMaxServerNumRequestsPerConnection=<integer>
  • -Dcom.linecorp.armeria.reportBlockedEventLoop=<boolean>
  • -Dcom.linecorp.armeria.verboseSocketExceptions=<boolean>

Implementing your own FlagsProvider

Create your own FlagsProvider and load it via Java SPI. If there are multiple implementations of FlagsProvider, the implementation with the highest priority will take precedence over the others.
package com.example.providers;

public class MyFlagsProvider implements FlagsProvider {

  public int priority() {
    // The provider with higher value will be evaluated first.
    return 100;

  public Long defaultRequestTimeoutMillis() {
      return 5000L;

  public TransportType transportType() {
      return TransportType.EPOLL;

  public Boolean reportBlockedEventLoop() {
      return true;

  public Sampler<? super RequestContext> requestContextLeakDetectionSampler() {
      // Samples all request contexts.
      return Sampler.always();

  public MeterRegistry meterRegistry() {
      return PrometheusMeterRegistries.newRegistry();


Add the following text file to your classpath or JAR file.