The English version of quarkus.io is the official project site. Translated sites are community supported on a best-effort basis.

OpenTelemetryの使用

このガイドでは、Quarkusアプリケーションで OpenTelemetry (OTel)を利用して、インタラクティブなWebアプリケーションに分散トレースを提供する方法について説明します。

  • OpenTelemetry MetricsとLoggingはまだサポートされていません。

  • QuarkusがOpenTelemetry Autoconfiguration for Tracesをサポートするようになりました。設定は、 OpenTelemetry SDK Autoconfigure で確認できるものと一致し、 quarkus.* プレフィックスを使用しています。

  • エクステンションとそれが提供するライブラリは、Quarkusで直接インストルメント化されます。命令型ライブラリとリアクティブ型ライブラリの間のコンテキスト伝播の問題があるため、 OpenTelemetryエージェント の使用は必要なく、推奨もされていません

  • If you come from the legacy OpenTracing extension, there is a guide to help with the migration.

前提条件

このガイドを完成させるには、以下が必要です:

  • 約15分

  • IDE

  • JDK 17+がインストールされ、 JAVA_HOME が適切に設定されていること

  • Apache Maven 3.9.6

  • Docker と Docker Compose、または Podman 、および Docker Compose

  • 使用したい場合は、 Quarkus CLI

  • ネイティブ実行可能ファイルをビルドしたい場合、MandrelまたはGraalVM(あるいはネイティブなコンテナビルドを使用する場合はDocker)をインストールし、 適切に設定していること

アーキテクチャ

このガイドでは、分散トレースを実証するための簡単なRESTアプリケーションを作成します。

ソリューション

次の章で紹介する手順に沿って、ステップを踏んでアプリを作成することをお勧めします。ただし、すぐに完成した例に飛んでも構いません。

Gitレポジトリをクローンするか git clone https://github.com/quarkusio/quarkus-quickstarts.gitアーカイブ をダウンロードします。

ソリューションは opentelemetry-quickstart ディレクトリ にあります。

Mavenプロジェクトの作成

まず、新しいプロジェクトが必要です。以下のコマンドで新規プロジェクトを作成します。

コマンドラインインタフェース
quarkus create app org.acme:opentelemetry-quickstart \
    --extension='resteasy-reactive,quarkus-opentelemetry' \
    --no-code
cd opentelemetry-quickstart

Gradleプロジェクトを作成するには、 --gradle または --gradle-kotlin-dsl オプションを追加します。

Quarkus CLIのインストールと使用方法の詳細については、 Quarkus CLI ガイドを参照してください。

Maven
mvn io.quarkus.platform:quarkus-maven-plugin:3.8.2:create \
    -DprojectGroupId=org.acme \
    -DprojectArtifactId=opentelemetry-quickstart \
    -Dextensions='resteasy-reactive,quarkus-opentelemetry' \
    -DnoCode
cd opentelemetry-quickstart

Gradleプロジェクトを作成するには、 -DbuildTool=gradle または -DbuildTool=gradle-kotlin-dsl オプションを追加します。

Windowsユーザーの場合:

  • cmdを使用する場合、(バックスラッシュ \ を使用せず、すべてを同じ行に書かないでください)。

  • Powershellを使用する場合は、 -D パラメータを二重引用符で囲んでください。例: "-DprojectArtifactId=opentelemetry-quickstart"

このコマンドはMavenプロジェクトを生成し、quarkus-opentelemetry エクステンションをインポートします。このエクステンションには、デフォルトのOpenTelemetryサポートと、https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/protocol/otlp.md[OTLP]のgRPC spanエクスポーターが含まれています。

Quarkusプロジェクトがすでに設定されている場合、プロジェクトのベースディレクトリで次のコマンドを実行することで、quarkus-opentelemetry エクステンションをプロジェクトに追加できます:

コマンドラインインタフェース
quarkus extension add opentelemetry
Maven
./mvnw quarkus:add-extension -Dextensions='opentelemetry'
Gradle
./gradlew addExtension --extensions='opentelemetry'

これにより、 pom.xml に以下が追加されます:

pom.xml
<dependency>
    <groupId>io.quarkus</groupId>
    <artifactId>quarkus-opentelemetry</artifactId>
</dependency>
build.gradle
implementation("io.quarkus:quarkus-opentelemetry")

Jakarta REST リソースの調査

src/main/java/org/acme/opentelemetry/TracedResource.java のファイルを開くと、以下の内容が表示されます。

package org.acme.opentelemetry;

import jakarta.ws.rs.GET;
import jakarta.ws.rs.Path;
import jakarta.ws.rs.Produces;
import jakarta.ws.rs.core.MediaType;
import org.jboss.logging.Logger;

@Path("/hello")
public class TracedResource {

    private static final Logger LOG = Logger.getLogger(TracedResource.class);

    @GET
    @Produces(MediaType.TEXT_PLAIN)
    public String hello() {
        LOG.info("hello");
        return "hello";
    }
}

このアプリケーションには、トレースのためのコードが含まれていないことに注意してください。デフォルトでは、このエンドポイントに送信されたリクエストは、コードの変更を必要とせずにトレースされます。

コンフィグレーションの作成

エクステンションを動作させるために必須の設定はありません。

デフォルトのプロパティ値を変更する必要がある場合、 src/main/resources/application.properties ファイルを使用して、アプリケーション内でデフォルトの OTLP gRPC Exporter を設定する方法の例を以下に示します:

quarkus.application.name=myservice (1)
quarkus.otel.exporter.otlp.traces.endpoint=http://localhost:4317 (2)
quarkus.otel.exporter.otlp.traces.headers=authorization=Bearer my_secret (3)
quarkus.log.console.format=%d{HH:mm:ss} %-5p traceId=%X{traceId}, parentId=%X{parentId}, spanId=%X{spanId}, sampled=%X{sampled} [%c{2.}] (%t) %s%e%n  (4)

# Alternative to the console log
quarkus.http.access-log.pattern="...traceId=%{X,traceId} spanId=%{X,spanId}" (5)
1 このアプリケーションから作成されたすべてのスパンには、そのスパンが myservice アプリケーションによって作成されたことを示す OpenTelemetry Resource が含まれます。設定されていない場合は、デフォルトでアーティファクトIDが設定されます。
2 スパンを送信するためのgRPCエンドポイント。設定されていない場合、デフォルトは http://localhost:4317 .
3 認証によく使われるオプションのgRPCヘッダー
4 ログメッセージにトレース情報を追加する。
5 また、アクセスログにのみトレース情報を記載することもできます。この場合、コンソールログ形式の情報を省略する必要があります。

すべての設定は、 quarkus.opentelemetry. から quarkus.otel. に更新されています。

レガシー設定は現在非推奨となっていますが、移行期間中は引き続き使用できます。

Disable all or parts of the OpenTelemetry extension

Once you add the dependency, the extension will be enabled by default but there are a few ways to disable the OpenTelemetry extension globally or partially.

プロパティ名 デフォルト値 説明

quarkus.otel.enabled

true

If false, disable the OpenTelemetry usage at build time.

quarkus.otel.sdk.disabled

false

Comes from the OpenTelemetry autoconfiguration. If true, will disable the OpenTelemetry SDK usage at runtime.

quarkus.otel.traces.enabled

true

If false, disable the OpenTelemetry tracing usage at build time.

quarkus.otel.exporter.otlp.enabled

true

If false will disable the default OTLP exporter at build time.

If you need to enable or disable the exporter at runtime, you can use the サンプラー because it has the ability to filter out all the spans if needed.

アプリケーションの実行

最初のステップは、テレメトリデータを受信して処理し、キャプチャしたトレースを表示する Jaegerにエクスポートするための OpenTelemetry Collectorの設定と起動です。

Jaeger-all-in-oneは、Jaegerエージェント、OTelコレクター、クエリサービス/UIを含みます。分離型コレクタをインストールする必要はありません。トレースデータを直接Jaegerに送ることができます(OTLPレシーバーを有効にした後、詳細はこちらの ブログエントリ などをご覧ください)。

docker-compose up -d OpenTelemetry CollectorとJaegerシステムを、以下の docker-compose.yml ファイルを介して起動します。

version: "2"
services:

  # Jaeger
  jaeger-all-in-one:
    image: jaegertracing/all-in-one:latest
    ports:
      - "16686:16686" # Jaeger UI
      - "14268:14268" # Receive legacy OpenTracing traces, optional
      - "4317:4317"   # OTLP gRPC receiver
      - "4318:4318"   # OTLP HTTP receiver, not yet used by Quarkus, optional
      - "14250:14250" # Receive from external otel-collector, optional
    environment:
      - COLLECTOR_OTLP_ENABLED=true

オプションのポートは必要ないものは外しておいた方が良いです。

これでアプリケーションを実行する準備が整いました。トレーサーの設定に application.properties を使用している場合:

コマンドラインインタフェース
quarkus dev
Maven
./mvnw quarkus:dev
Gradle
./gradlew --console=plain quarkusDev

または、JVM引数でOTLP gRPCエンドポイントを設定する場合:

コマンドラインインタフェース
quarkus dev -Djvm.args="-Dquarkus.otel.exporter.otlp.traces.endpoint=http://localhost:4317"
Maven
./mvnw quarkus:dev -Djvm.args="-Dquarkus.otel.exporter.otlp.traces.endpoint=http://localhost:4317"
Gradle
./gradlew --console=plain quarkusDev -Djvm.args="-Dquarkus.otel.exporter.otlp.traces.endpoint=http://localhost:4317"

OpenTelemetry Collector、Jaegerシステム、アプリケーションが動作している状態で、提供されているエンドポイントにリクエストを出すことができます。

$ curl http://localhost:8080/hello
hello

最初のリクエストが送信された時点で、ログにトレース情報が表示されるようになります:

10:49:02 INFO  traceId=, parentId=, spanId=, sampled= [io.quarkus] (main) Installed features: [cdi, opentelemetry, resteasy-client, resteasy, smallrye-context-propagation, vertx]
10:49:03 INFO  traceId=17ceb8429b9f25b0b879fa1503259456, parentId=3125c8bee75b7ad6, spanId=58ce77c86dd23457, sampled=true [or.ac.op.TracedResource] (executor-thread-1) hello
10:49:03 INFO  traceId=ad23acd6d9a4ed3d1de07866a52fa2df, parentId=, spanId=df13f5b45cf4d1e2, sampled=true [or.ac.op.TracedResource] (executor-thread-0) hello

その後、 Jaeger UI にアクセスしてトレース情報を確認します。

CTRL+C を押すか、 q と入力して、アプリケーションを停止してください。

JDBC

JDBCインスツルメンテーションは、アプリケーションによって実行される各JDBCクエリのためにスパンを追加します。これを有効にするには、次の依存関係をビルドファイルに追加します。

pom.xml
<dependency>
    <groupId>io.opentelemetry.instrumentation</groupId>
    <artifactId>opentelemetry-jdbc</artifactId>
</dependency>
build.gradle
implementation("io.opentelemetry.instrumentation:opentelemetry-jdbc")

専用のJDBCデータソースラッパーを使用するため、データソースのテレメトリーを有効にする必要があります:

# enable tracing
quarkus.datasource.jdbc.telemetry=true

# configure datasource
quarkus.datasource.db-kind=postgresql
quarkus.datasource.jdbc.url=jdbc:postgresql://localhost:5432/mydatabase

追加設定

一部のユースケースでは、OpenTelemetryのカスタム設定が必要になります。 これらのセクションでは、適切に構成するために必要なものについて概説します。

IDジェネレーター

OpenTelemetry エクステンションでは、トレースおよびスパンの識別子を作成する際に、デフォルトでランダムな ID ジェネレーターを使用します。

ベンダー固有のプロトコルの中には、カスタム ID ジェネレーターを必要とするものがありますが、プロデューサーを作成することで、デフォルトの ID ジェネレーターを上書きすることができます。OpenTelemetryエクステンションは、 IdGenerator CDI Beanを検出し、トレーサープロデューサーを構成する際にそれを使用します。

@Singleton
public class CustomConfiguration {

    /** Creates a custom IdGenerator for OpenTelemetry */
    @Produces
    @Singleton
    public IdGenerator idGenerator() {
        return AwsXrayIdGenerator.getInstance();
    }
}

プロパゲーター

OpenTelemetry は、 プロパゲーター を介して分野横断的な関心事を伝播し、状態を保存するための基になる"コンテキスト"を共有します 分散トランザクションの存続期間全体にわたってデータにアクセスします。

デフォルトでは、OpenTelemetryエクステンションは、 W3C Trace ContextW3C Baggageプロパゲータを有効にしていますが、 設定リファレンスで説明されている propagators 設定を設定することで、サポートされているOpenTelemetryプロパゲータのいずれかを選択することができます。

追加プロパゲーター

  • b3, b3multi, jaeger, ottrace のプロパゲータは、プロジェクトに trace-propagatorsエクステンションを依存関係として追加する必要があります。

pom.xml
<dependency>
    <groupId>io.opentelemetry</groupId>
    <artifactId>opentelemetry-extension-trace-propagators</artifactId>
</dependency>
build.gradle
implementation("io.opentelemetry:opentelemetry-extension-trace-propagators")
  • xray プロパゲーターは、お客様のプロジェクトに aws エクステンションを依存関係として追加することを必要とします。

pom.xml
<dependency>
    <groupId>io.opentelemetry.contrib</groupId>
    <artifactId>opentelemetry-aws-xray-propagator</artifactId>
</dependency>
build.gradle
implementation("io.opentelemetry.contrib:opentelemetry-aws-xray-propagator")

Customise Propagator

To customise the propagation header you can implement the TextMapPropagatorCustomizer interface. This can be used, as an example, to restrict propagation of OpenTelemetry trace headers and prevent potentially sensitive data to be sent to third party systems.

/**
 * /**
 * Meant to be implemented by a CDI bean that provides arbitrary customization for the TextMapPropagator
 * that are to be registered with OpenTelemetry
 */
public interface TextMapPropagatorCustomizer {

    TextMapPropagator customize(Context context);

    interface Context {
        TextMapPropagator propagator();

        ConfigProperties otelConfigProperties();
    }
}

リソース

リソースは、テレメトリを生成しているエンティティの表現であり、誰がトレースを生成しているかを特徴づけるために、エクスポートされたトレースに属性を追加します。

設定リファレンス に記述されている resource-attributes トレーサーの設定を行うことで属性を追加することができます。 このプロパティは実行時にオーバーライドできるので、OpenTelemetry 拡張は Quarkus 設定リファレンス に記述されている優先順位に従ってその値を取得します。

カスタムリソースや OpenTelemetry SDK Extensionsで提供されているリソースを使用する必要がある場合は、複数のリソースプロデューサーを作成することができます。OpenTelemetryエクステンションは、 Resource CDI Beanを検出し、トレーサー・プロデューサーを構成する際にそれらをマージします。

@ApplicationScoped
public class CustomConfiguration {

    @Produces
    @ApplicationScoped
    public Resource osResource() {
        return OsResource.get();
    }

    @Produces
    @ApplicationScoped
    public Resource ecsResource() {
        return EcsResource.get();
    }
}

ユーザーデータ

By setting quarkus.otel.traces.eusp.enabled=true you can add information about the user related to each span. The user’s ID and roles will be added to the span attributes, if available.

サンプラー

A sampler decides whether a trace should be discarded or forwarded, effectively managing noise and reducing overhead by limiting the number of collected traces sent to the collector.

Quarkus comes equipped with a built-in sampler, and you also have the option to create your custom sampler.

To use the built-in sampler, you can configure it by setting the desired sampler parameters as detailed in the OpenTelemetry 設定リファレンス. As an example, you can configure the sampler to retain 50% of the traces:

# build time property only:
quarkus.otel.traces.sampler=traceidratio
# Runtime property:
quarkus.otel.traces.sampler.arg=0.5

An interesting use case for the sampler is to activate and deactivate tracing export at runtime, acording to this example:

# build time property only:
quarkus.otel.traces.sampler=traceidratio
# On (default). All traces are exported:
quarkus.otel.traces.sampler.arg=1.0
# Off. No traces are exported:
quarkus.otel.traces.sampler.arg=0.0

Quarkus 3.0では、設定に大きな変更が加えられました。

最新のJava OpenTelemetry SDKに準拠するため、Sampler関連のプロパティ名と値が変更されます。移行期間中は、 quarkus.opentelemetry.tracer.samplerquarkus.otel.traces.sampler をマッピングしているため、古いプロパティに新しい設定値を設定することが可能です。

サンプラーが親ベースである場合、現在廃止されたプロパティ quarkus.opentelemetry.tracer.sampler.parent-based を設定する必要はありません。

quarkus.opentelemetry.tracer.sampler で設定する必要がある値は、現在、以下の通りです:

旧サンプラーの設定値 新サンプラーの設定値 新サンプラーの設定値(親ベース)

on

always_on

parentbased_always_on

off

always_off

parentbased_always_off

ratio

traceidratio

parentbased_traceidratio

カスタムサンプラーを使用する必要がある場合、現在2種類の方法があります:

サンプラー CDI プロデューサー

You can create a sampler CDI producer. The Quarkus OpenTelemetry extension will detect the Sampler CDI bean and will use it when configuring the Tracer.

@Singleton
public class CustomConfiguration {

    /** Creates a custom sampler for OpenTelemetry */
    @Produces
    @Singleton
    public Sampler sampler() {
        return JaegerRemoteSampler.builder()
        .setServiceName("my-service")
        .build();
    }
}

OTelサンプラーSPI

This will use the SPI hooks available with the OTel Autoconfiguration. You can create a simple Sampler class:

public class CustomSPISampler implements Sampler {
    @Override
    public SamplingResult shouldSample(Context context,
            String s,
            String s1,
            SpanKind spanKind,
            Attributes attributes,
            List<LinkData> list) {
        // Do some sampling here
        return Sampler.alwaysOn().shouldSample(context, s, s1, spanKind, attributes, list);
    }

    @Override
    public String getDescription() {
        return "custom-spi-sampler-description";
    }
}

Then a Sampler Provider:

public class CustomSPISamplerProvider implements ConfigurableSamplerProvider {
    @Override
    public Sampler createSampler(ConfigProperties configProperties) {
        return new CustomSPISampler();
    }

    @Override
    public String getName() {
        return "custom-spi-sampler";
    }
}

Write the SPI loader text file at resources/META-INF/services with name io.opentelemetry.sdk.autoconfigure.spi.traces.ConfigurableSamplerProvider containing the full qualified name of the CustomSPISamplerProvider class.

Then activate on the configuration:

quarkus.otel.traces.sampler=custom-spi-sampler

As you can see, CDI is much simpler to work with.

追加の計器

Quarkusエクステンションの中には、トレースが後続の実行に伝搬されることを保証するために追加のコードを必要とするものがあります。これらのセクションでは、プロセスの境界を越えてトレースを伝搬するために必要なことを説明します。

このセクションで説明されている計器は、Quarkusでテストされており、標準モードとネイティブモードの両方で動作します。

CDI

Annotating a method in any CDI aware bean with the io.opentelemetry.instrumentation.annotations.WithSpan annotation will create a new Span and establish any required relationships with the current Trace context.

Annotating a method in any CDI aware bean with the io.opentelemetry.instrumentation.annotations.AddingSpanAttributes will not create a new span but will add annotated method parameters to attributes in the current span.

If a method is annotated by mistake with @AddingSpanAttributes and @WithSpan annotations, the @WithSpan annotation will take precedence.

Method parameters can be annotated with the io.opentelemetry.instrumentation.annotations.SpanAttribute annotation to indicate which method parameters should be part of the span. The parameter name can be customized as well.

例:

@ApplicationScoped
class SpanBean {
    @WithSpan
    void span() {

    }

    @WithSpan("name")
    void spanName() {

    }

    @WithSpan(kind = SERVER)
    void spanKind() {

    }

    @WithSpan
    void spanArgs(@SpanAttribute(value = "arg") String arg) {

    }

    @AddingSpanAttributes
    void addArgumentToExistingSpan(@SpanAttribute(value = "arg") String arg) {

    }
}

使用可能なOpenTelemetry CDI依存関係注入

MicroProfile Telemetry Tracingの仕様に基づき、Quarkusは以下のクラスのCDI依存関係注入をサポートしています。

  • io.opentelemetry.api.OpenTelemetry

  • io.opentelemetry.api.trace.Tracer

  • io.opentelemetry.api.trace.Span

  • io.opentelemetry.api.baggage.Baggage

これらのクラスは、CDIが有効なBeanに注入することができます。例えば、 Tracer は、カスタムスパンを開始するために特に有用です。

@Inject
Tracer tracer;

...

public void tracedWork() {
    Span span = tracer.spanBuilder("My custom span")
        .setAttribute("attr", "attr.value")
        .setParent(Context.current().with(Span.current()))
        .setSpanKind(SpanKind.INTERNAL)
        .startSpan();

    // traced work

    span.end();
}

SmallRye Reactive Messaging - Kafka

SmallRye Reactive Messaging extension for Kafkaを使用すると、スパンをKafka Recordに伝搬させることができます。

TracingMetadata tm = TracingMetadata.withPrevious(Context.current());
Message out = Message.of(...).withMetadata(tm);

上記は、生成されている Message に追加できる TracingMetadata オブジェクトを作成し、OpenTelemetry Context を取得して、伝播のために現在のスパンを抽出しています。

エクスポーター

デフォルト

The Quarkus OpenTelemetry extension uses its own exporter built on top of Vert.x for optimal performance and maintainability.

The exporter is automatically wired with CDI, that’s why the quarkus.otel.traces.exporter property defaults to cdi.

The quarkus.otel.exporter.otlp.traces.protocol default to grpc and http/protobuf can also be used.

On Quarkiverse

追加のエクスポーターは、Quarkiverseの quarkus-opentelemetry-exporter プロジェクトで利用できるようになる予定です。

OpenTelemetry 設定リファレンス

Quarkusは、OpenTelemetryのAutoconfiguration for Tracesをサポートしています。設定は、 OpenTelemetry SDK Autoconfigure で確認できるものと一致し、 quarkus.* プレフィックスを追加しています。

Quarkus OpenTelemetryの設定プロパティに quarkus.otel.* プレフィックスが付くようになりました。

プレフィックスが quarkus.opentelemetry. の *レガシープロパティ は、現在、移行期間中、デフォルトとして新しいプロパティにマッピングされています。詳細は以下の「デフォルト」欄を参照してください。

ビルド時に固定される構成プロパティ - 他のすべての構成プロパティは実行時にオーバーライド可能

Configuration property

デフォルト

List of exporters supported by Quarkus.

List of exporters to be used for tracing, separated by commas. Has one of the values on ExporterType otlp, cdi, none or the full qualified name of a class implementing io.opentelemetry.sdk.trace.export.SpanExporter

Default on Quarkus is ExporterType.Constants#CDI_VALUE.

Environment variable: QUARKUS_OTEL_TRACES_EXPORTER

Show more

list of string

cdi

The sampler to use for tracing.

Has one of the values on SamplerType always_on, always_off, traceidratio, parentbased_always_on, parentbased_always_off, parentbased_traceidratio or the Sampler SPI name. This will use the OTel SPI hooks for the io.opentelemetry.sdk.trace.samplers.Sampler implementation set in the provider: io.opentelemetry.sdk.autoconfigure.spi.traces.ConfigurableSamplerProvider.

Fallbacks to the legacy property quarkus.opentelemetry.tracer.sampler.sampler.name or defaults to SamplerType.Constants#PARENT_BASED_ALWAYS_ON.

Environment variable: QUARKUS_OTEL_TRACES_SAMPLER

Show more

string

parentbased_always_on

Enable the io.quarkus.opentelemetry.runtime.exporter.otlp.EndUserSpanProcessor.

The io.quarkus.opentelemetry.runtime.exporter.otlp.EndUserSpanProcessor adds the io.opentelemetry.semconv.SemanticAttributes.ENDUSER_ID and io.opentelemetry.semconv.SemanticAttributes.ENDUSER_ROLE to the Span.

Environment variable: QUARKUS_OTEL_TRACES_EUSP_ENABLED

Show more

boolean

false

No Metrics exporter for now

Environment variable: QUARKUS_OTEL_METRICS_EXPORTER

Show more

list of string

none

No Log exporter for now.

Environment variable: QUARKUS_OTEL_LOGS_EXPORTER

Show more

list of string

none

The propagators to be used. Use a comma-separated list for multiple propagators.

Has values from PropagatorType or the full qualified name of a class implementing io.opentelemetry.context.propagation.TextMapPropagator.

Default is PropagatorType.Constants#TRACE_CONTEXT,PropagatorType.Constants#BAGGAGE (W3C).

Environment variable: QUARKUS_OTEL_PROPAGATORS

Show more

list of string

tracecontext,baggage

Enables instrumentation for gRPC.

Environment variable: QUARKUS_OTEL_INSTRUMENT_GRPC

Show more

boolean

true

Enables instrumentation for SmallRye Reactive Messaging.

Environment variable: QUARKUS_OTEL_INSTRUMENT_REACTIVE_MESSAGING

Show more

boolean

true

Enables instrumentation for JAX-RS Rest Client backed by RESTEasy Classic.

Environment variable: QUARKUS_OTEL_INSTRUMENT_REST_CLIENT_CLASSIC

Show more

boolean

true

Enables instrumentation for RESTEasy Reactive.

Environment variable: QUARKUS_OTEL_INSTRUMENT_RESTEASY_REACTIVE

Show more

boolean

true

Enables instrumentation for RESTEasy Classic.

Environment variable: QUARKUS_OTEL_INSTRUMENT_RESTEASY_CLASSIC

Show more

boolean

true

If true, disable the OpenTelemetry SDK. Runtime configuration.

Defaults to false.

Environment variable: QUARKUS_OTEL_SDK_DISABLED

Show more

boolean

false

Suppress non-application uris from trace collection. This will suppress tracing of /q endpoints.

Providing a custom io.opentelemetry.sdk.trace.samplers.Sampler CDI Bean will ignore this setting.

This is a Quarkus specific property. Suppressing non-application uris is enabled by default.

Fallbacks to the legacy property quarkus.opentelemetry.tracer.suppress-non-application-uris or defaults to true.

Environment variable: QUARKUS_OTEL_TRACES_SUPPRESS_NON_APPLICATION_URIS

Show more

boolean

true

Include static resources from trace collection.

This is a Quarkus specific property. Include static resources is disabled by default. Providing a custom io.opentelemetry.sdk.trace.samplers.Sampler CDI Bean will ignore this setting.

Fallbacks to the legacy property quarkus.opentelemetry.tracer.include-static-resources or defaults to false.

Environment variable: QUARKUS_OTEL_TRACES_INCLUDE_STATIC_RESOURCES

Show more

boolean

false

Sampler argument. Depends on the quarkus.otel.traces.sampler property. Fallbacks to the legacy property quarkus.opentelemetry.tracer.sampler.ratio.

When setting the stock sampler to traceidratio or parentbased_traceidratio you need to set a double compatible value between 0.0d and 1.0d, like 0.01d or 0.5d. It is kept as a String to allow the flexible customisation of alternative samplers.

Defaults to 1.0d.

Environment variable: QUARKUS_OTEL_TRACES_SAMPLER_ARG

Show more

string

1.0d

The maximum length of attribute values. Applies to spans and logs.

By default, there is no limit.

Environment variable: QUARKUS_OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT

Show more

string

The maximum number of attributes. Applies to spans, span events, span links, and logs.

Default is 128.

Environment variable: QUARKUS_OTEL_ATTRIBUTE_COUNT_LIMIT

Show more

int

128

The maximum length of span attribute values. Takes precedence over otel.attribute.value.length.limit.

By default, there is no limit.

Environment variable: QUARKUS_OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT

Show more

int

The maximum number of attributes per span. Takes precedence over otel.attribute.count.limit.

Default is 128.

Environment variable: QUARKUS_OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT

Show more

int

128

The maximum number of events per span.

Default is 128.

Environment variable: QUARKUS_OTEL_SPAN_EVENT_COUNT_LIMIT

Show more

int

128

The maximum number of links per span.

Default is 128.

Environment variable: QUARKUS_OTEL_SPAN_LINK_COUNT_LIMIT

Show more

int

128

The interval, in milliseconds, between two consecutive exports.

Default is 5000.

Environment variable: QUARKUS_OTEL_BSP_SCHEDULE_DELAY

Show more

Duration

5S

The maximum queue size.

Default is 2048.

Environment variable: QUARKUS_OTEL_BSP_MAX_QUEUE_SIZE

Show more

int

2048

The maximum batch size.

Default is 512.

Environment variable: QUARKUS_OTEL_BSP_MAX_EXPORT_BATCH_SIZE

Show more

int

512

The maximum allowed time, in milliseconds, to export data.

Default is 30s.

Environment variable: QUARKUS_OTEL_BSP_EXPORT_TIMEOUT

Show more

Duration

30S

Specify resource attributes in the following format: key1=val1,key2=val2,key3=val3.

Environment variable: QUARKUS_OTEL_RESOURCE_ATTRIBUTES

Show more

list of string

Specify logical service name. Takes precedence over service.name defined with otel.resource.attributes and from quarkus.application.name.

Defaults to quarkus.application.name.

Environment variable: QUARKUS_OTEL_SERVICE_NAME

Show more

string

${quarkus.application.name:unset}

Specify resource attribute keys that are filtered.

Environment variable: QUARKUS_OTEL_EXPERIMENTAL_RESOURCE_DISABLED_KEYS

Show more

list of string

The maximum amount of time Quarkus will wait for the OpenTelemetry SDK to flush unsent spans and shutdown.

Environment variable: QUARKUS_OTEL_EXPERIMENTAL_SHUTDOWN_WAIT_TIME

Show more

Duration

1S

Enables instrumentation for Vert.x HTTP.

Environment variable: QUARKUS_OTEL_INSTRUMENT_VERTX_HTTP

Show more

boolean

true

Enables instrumentation for Vert.x Event Bus.

Environment variable: QUARKUS_OTEL_INSTRUMENT_VERTX_EVENT_BUS

Show more

boolean

true

Enables instrumentation for Vert.x SQL Client.

Environment variable: QUARKUS_OTEL_INSTRUMENT_VERTX_SQL_CLIENT

Show more

boolean

true

Sets the OTLP endpoint to connect to. If unset, defaults to OtlpExporterRuntimeConfig#DEFAULT_GRPC_BASE_URI. We are currently using just the traces, therefore quarkus.otel.exporter.otlp.traces.endpoint is recommended.

Environment variable: QUARKUS_OTEL_EXPORTER_OTLP_ENDPOINT

Show more

string

http://localhost:4317/

OTLP Exporter specific. Will override otel.exporter.otlp.endpoint, if set.

Fallbacks to the legacy property quarkus.opentelemetry.tracer.exporter.otlp.endpoint< or defaults to OtlpExporterRuntimeConfig#DEFAULT_GRPC_BASE_URI.

Environment variable: QUARKUS_OTEL_EXPORTER_OTLP_TRACES_ENDPOINT

Show more

string

http://localhost:4317/

Key-value pairs to be used as headers associated with gRPC requests. The format is similar to the OTEL_EXPORTER_OTLP_HEADERS environment variable, a list of key-value pairs separated by the "=" character. i.e.: key1=value1,key2=value2

Environment variable: QUARKUS_OTEL_EXPORTER_OTLP_TRACES_HEADERS

Show more

list of string

Sets the method used to compress payloads. If unset, compression is disabled. Currently supported compression methods include gzip and none.

Environment variable: QUARKUS_OTEL_EXPORTER_OTLP_TRACES_COMPRESSION

Show more

gzip, none

Sets the maximum time to wait for the collector to process an exported batch of spans. If unset, defaults to `OtlpExporterRuntimeConfig#DEFAULT_TIMEOUT_SECS`s.

Environment variable: QUARKUS_OTEL_EXPORTER_OTLP_TRACES_TIMEOUT

Show more

Duration

10S

OTLP defines the encoding of telemetry data and the protocol used to exchange data between the client and the server. Depending on the exporter, the available protocols will be different.

Currently, only grpc and http/protobuf are allowed.

Environment variable: QUARKUS_OTEL_EXPORTER_OTLP_TRACES_PROTOCOL

Show more

string

grpc

Comma-separated list of the path to the key files (Pem format).

Environment variable: QUARKUS_OTEL_EXPORTER_OTLP_TRACES_KEY_CERT_KEYS

Show more

list of string

Comma-separated list of the path to the certificate files (Pem format).

Environment variable: QUARKUS_OTEL_EXPORTER_OTLP_TRACES_KEY_CERT_CERTS

Show more

list of string

Comma-separated list of the trust certificate files (Pem format).

Environment variable: QUARKUS_OTEL_EXPORTER_OTLP_TRACES_TRUST_CERT_CERTS

Show more

list of string

期間フォーマットについて

To write duration values, use the standard java.time.Duration format. See the Duration#parse() Java API documentation for more information.

数字で始まる簡略化した書式を使うこともできます:

  • 数値のみの場合は、秒単位の時間を表します。

  • 数値の後に ms が続く場合は、ミリ秒単位の時間を表します。

その他の場合は、簡略化されたフォーマットが解析のために java.time.Duration フォーマットに変換されます:

  • 数値の後に hms が続く場合は、その前に PT が付けられます。

  • 数値の後に d が続く場合は、その前に P が付けられます。

関連コンテンツ