diff --git a/extensions/opentelemetry/runtime/src/main/java/io/quarkus/opentelemetry/runtime/config/runtime/exporter/OtlpExporterConfig.java b/extensions/opentelemetry/runtime/src/main/java/io/quarkus/opentelemetry/runtime/config/runtime/exporter/OtlpExporterConfig.java index 0c9075b32c9bf..14b8e93ea5013 100644 --- a/extensions/opentelemetry/runtime/src/main/java/io/quarkus/opentelemetry/runtime/config/runtime/exporter/OtlpExporterConfig.java +++ b/extensions/opentelemetry/runtime/src/main/java/io/quarkus/opentelemetry/runtime/config/runtime/exporter/OtlpExporterConfig.java @@ -7,33 +7,58 @@ import io.quarkus.runtime.annotations.ConfigGroup; import io.smallrye.config.WithDefault; +import io.smallrye.config.WithName; @ConfigGroup public interface OtlpExporterConfig { + String DEFAULT_GRPC_BASE_URI = "http://localhost:4317/"; + String DEFAULT_HTTP_BASE_URI = "http://localhost:4318/"; + String DEFAULT_TIMEOUT_SECS = "10"; /** - * OTLP Exporter specific. Will override otel.exporter.otlp.endpoint, if set. + * Sets the OTLP endpoint to send telemetry data. If unset, defaults to + * {@value OtlpExporterRuntimeConfig#DEFAULT_GRPC_BASE_URI}. *

+ * There is a generic property, that will apply to all signals and a signal specific one, following the pattern: + * `quarkus.otel.exporter.otlp..endpoint` where is one of the supported signal types, + * like `traces` or `metrics`. + *

+ * If protocol is `http/protobuf` the version and signal will be appended to the path (e.g. v1/traces or v1/metrics) + * and the default port will be {@value OtlpExporterRuntimeConfig#DEFAULT_HTTP_BASE_URI}. */ + @WithDefault(DEFAULT_GRPC_BASE_URI) Optional endpoint(); /** - * Key-value pairs to be used as headers associated with gRPC requests. + * Key-value pairs to be used as headers associated with exporter requests. * The format is similar to the {@code OTEL_EXPORTER_OTLP_HEADERS} environment variable, * a list of key-value pairs separated by the "=" character. i.e.: key1=value1,key2=value2 + *

+ * There is a generic property, that will apply to all signals and a signal specific one, following the pattern: + * `quarkus.otel.exporter.otlp..headers` where is one of the supported signal types, + * like `traces` or `metrics`. */ Optional> headers(); /** * Sets the method used to compress payloads. If unset, compression is disabled. Currently * supported compression methods include `gzip` and `none`. + *

+ * There is a generic property, that will apply to all signals and a signal specific one, following the pattern: + * `quarkus.otel.exporter.otlp..compression` where is one of the supported signal types, + * like `traces` or `metrics`. */ Optional compression(); /** - * Sets the maximum time to wait for the collector to process an exported batch of spans. If + * Sets the maximum time to wait for the collector to process an exported batch of telemetry data. If * unset, defaults to {@value OtlpExporterRuntimeConfig#DEFAULT_TIMEOUT_SECS}s. + *

+ * There is a generic property, that will apply to all signals and a signal specific one, following the pattern: + * `quarkus.otel.exporter.otlp..timeout` where is one of the supported signal types, + * like `traces` or `metrics`. */ + @WithDefault("10s") Duration timeout(); /** @@ -41,17 +66,34 @@ public interface OtlpExporterConfig { * server. Depending on the exporter, the available protocols will be different. *

* Currently, only {@code grpc} and {@code http/protobuf} are allowed. + *

+ * Please mind that changing the protocol requires changing the port in the endpoint as well. + *

+ * There is a generic property, that will apply to all signals and a signal specific one, following the pattern: + * `quarkus.otel.exporter.otlp..protocol` where is one of the supported signal types, + * like `traces` or `metrics`. */ + @WithDefault(OtlpExporterConfig.Protocol.GRPC) Optional protocol(); /** * Key/cert configuration in the PEM format. + *

+ * There is a generic property, that will apply to all signals and a signal specific one, following the pattern: + * `quarkus.otel.exporter.otlp..key-cert` where is one of the supported signal types, + * like `traces` or `metrics`. */ + @WithName("key-cert") KeyCert keyCert(); /** * Trust configuration in the PEM format. + *

+ * There is a generic property, that will apply to all signals and a signal specific one, following the pattern: + * `quarkus.otel.exporter.otlp..trust-cert` where is one of the supported signal types, + * like `traces` or `metrics`. */ + @WithName("trust-cert") TrustCert trustCert(); /** @@ -60,38 +102,72 @@ public interface OtlpExporterConfig { * If not set and the default TLS configuration is configured ({@code quarkus.tls.*}) then that will be used. * If a name is configured, it uses the configuration from {@code quarkus.tls..*} * If a name is configured, but no TLS configuration is found with that name then an error will be thrown. + *

+ * There is a generic property, that will apply to all signals and a signal specific one, following the pattern: + * `quarkus.otel.exporter.otlp..tls-configuration-name` where is one of the supported signal + * types, + * like `traces` or `metrics`. */ Optional tlsConfigurationName(); /** - * Set proxy options + * Set proxy options. + *

+ * There is a generic property, that will apply to all signals and a signal specific one, following the pattern: + * `quarkus.otel.exporter.otlp..proxy-options` where is one of the supported signal types, + * like `traces` or `metrics`. */ ProxyConfig proxyOptions(); interface ProxyConfig { /** * If proxy connection must be used. + *

+ * There is a generic property, that will apply to all signals and a signal specific one, following the pattern: + * `quarkus.otel.exporter.otlp..proxy-options.enabled` where is one of the supported signal + * types, + * like `traces` or `metrics`. */ @WithDefault("false") boolean enabled(); /** * Set proxy username. + *

+ * There is a generic property, that will apply to all signals and a signal specific one, following the pattern: + * `quarkus.otel.exporter.otlp..proxy-options.username` where is one of the supported signal + * types, + * like `traces` or `metrics`. */ Optional username(); /** * Set proxy password. + *

+ * There is a generic property, that will apply to all signals and a signal specific one, following the pattern: + * `quarkus.otel.exporter.otlp..proxy-options.password` where is one of the supported signal + * types, + * like `traces` or `metrics`. */ Optional password(); /** * Set proxy port. + *

+ * There is a generic property, that will apply to all signals and a signal specific one, following the pattern: + * `quarkus.otel.exporter.otlp..proxy-options.port` where is one of the supported signal + * types, + * like `traces` or `metrics`. */ OptionalInt port(); /** * Set proxy host. + *

+ * There is a generic property, that will apply to all signals and a signal specific one, following the pattern: + * `quarkus.otel.exporter.otlp..proxy-options.host` where is one of the supported signal + * types, + * like `traces` or `metrics`. */ Optional host(); } diff --git a/extensions/opentelemetry/runtime/src/main/java/io/quarkus/opentelemetry/runtime/config/runtime/exporter/OtlpExporterRuntimeConfig.java b/extensions/opentelemetry/runtime/src/main/java/io/quarkus/opentelemetry/runtime/config/runtime/exporter/OtlpExporterRuntimeConfig.java index 111e6550e014b..30979461fa39c 100644 --- a/extensions/opentelemetry/runtime/src/main/java/io/quarkus/opentelemetry/runtime/config/runtime/exporter/OtlpExporterRuntimeConfig.java +++ b/extensions/opentelemetry/runtime/src/main/java/io/quarkus/opentelemetry/runtime/config/runtime/exporter/OtlpExporterRuntimeConfig.java @@ -1,14 +1,8 @@ package io.quarkus.opentelemetry.runtime.config.runtime.exporter; -import java.time.Duration; -import java.util.List; -import java.util.Optional; - import io.quarkus.runtime.annotations.ConfigPhase; import io.quarkus.runtime.annotations.ConfigRoot; import io.smallrye.config.ConfigMapping; -import io.smallrye.config.WithDefault; -import io.smallrye.config.WithName; /** * From endpoint(); - - /** - * Key-value pairs to be used as headers associated with gRPC requests. - * The format is similar to the {@code OTEL_EXPORTER_OTLP_HEADERS} environment variable, - * a list of key-value pairs separated by the "=" character. i.e.: key1=value1,key2=value2 - */ - @Override - Optional> headers(); - - /** - * Sets the method used to compress payloads. If unset, compression is disabled. Currently - * supported compression methods include `gzip` and `none`. - */ - @Override - Optional compression(); - - /** - * Sets the maximum time to wait for the collector to process an exported batch of spans. If - * unset, defaults to {@value OtlpExporterRuntimeConfig#DEFAULT_TIMEOUT_SECS}s. - */ - @Override - @WithDefault("10s") - Duration timeout(); - - /** - * 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 {@code grpc} and {@code http/protobuf} are allowed. - */ - @Override - @WithDefault(OtlpExporterConfig.Protocol.GRPC) - Optional protocol(); - - /** - * Key/cert configuration in the PEM format. - */ - @Override - @WithName("key-cert") - OtlpExporterConfig.KeyCert keyCert(); - - /** - * Trust configuration in the PEM format. - */ - @Override - @WithName("trust-cert") - OtlpExporterConfig.TrustCert trustCert(); - - /** - * The name of the TLS configuration to use. - *

- * If not set and the default TLS configuration is configured ({@code quarkus.tls.*}) then that will be used. - * If a name is configured, it uses the configuration from {@code quarkus.tls..*} - * If a name is configured, but no TLS configuration is found with that name then an error will be thrown. - */ - @Override - Optional tlsConfigurationName(); - - /** - * Set proxy options - */ - @Override - OtlpExporterConfig.ProxyConfig proxyOptions(); /** * OTLP traces exporter configuration.