Quarkus Opentelemetry Exporter for Google Cloud Platform

Exporters are OpenTelemetry SDK Plugins which implement the Exporter interface, and emit telemetry to consumers, usually observability vendors.

This exporter sends data to Google Cloud Platform using opentelemetry-operations-java library.

This extension doesn’t work on native mode.

The UdsNameResolverProvider is forced to be initialized at run time with no good reason. This can be related to https://github.com/oracle/graal/pull/8230.

Installation

Add exporter dependency

To use this extension, first, add the io.quarkiverse.opentelemetry.exporter:quarkus-opentelemetry extension to your build file.

For Maven:

<dependency>
    <groupId>io.quarkiverse.opentelemetry.exporter</groupId>
    <artifactId>quarkus-opentelemetry-exporter-gcp</artifactId>
    <version>3.8.3.1</version>
</dependency>

Disable default exporter

quarkus-opentelemetry extension already includes the default OTLP exporter. To deactivate that default exporter and only have this GCP extension exporting data, please set the following property in the application.properties:

quarkus.opentelemetry.tracer.exporter.otlp.enabled=false

Google Cloud Project preparation

Local development/testing

If you are running in a GCP environment, the exporter will automatically authenticate using the environment’s service account.

For local development/testing please follow the instructions from google-cloud-java library.

Configuration

Enable GCP exporting by adding following properties in the application.properties:

quarkus.opentelemetry.tracer.exporter.gcp.enabled=true

Cloud Trace doesn’t sample every request. If you are using App Engine, requests are sampled at a rate of 0.1 requests per second for each App Engine instance. If you use the Cloud Trace API, then you can configure custom rates. Some packages, such as the Java OpenCensus package, support configuring the sampling rate.

Cloud Run

Goolge’s recommendation is to use BatchSpanProcessor for all deployments except Cloud Run. Cloud Run doesn’t support background processes and SimpleSpanProcessor must be used. You can enable usage of SimpleSpanProcessor by adding to application.properties:

quarkus.opentelemetry.tracer.exporter.gcp.cloudrun=true

Cloud Run doesn’t sample the traces for every request. When used with Cloud Run, requests are sampled at a maximum rate of 0.1 requests per second for each container instance. You can force a request to be traced

Cloud Run does not support configuration of the Cloud Run sample rate.

Extension Configuration Reference