diff --git a/common/src/main/java/org/keycloak/common/Profile.java b/common/src/main/java/org/keycloak/common/Profile.java index adeb6d0ddd3..50858f8137d 100755 --- a/common/src/main/java/org/keycloak/common/Profile.java +++ b/common/src/main/java/org/keycloak/common/Profile.java @@ -129,7 +129,7 @@ public class Profile { OID4VC_VCI("Support for the OID4VCI protocol as part of OID4VC.", Type.EXPERIMENTAL), - OPENTELEMETRY("OpenTelemetry Tracing", Type.DEFAULT), + OPENTELEMETRY("OpenTelemetry support", Type.DEFAULT), DECLARATIVE_UI("declarative ui spi", Type.EXPERIMENTAL), diff --git a/docs/documentation/release_notes/topics/26_5_0.adoc b/docs/documentation/release_notes/topics/26_5_0.adoc index 5d545ce3110..347c5fa1e9c 100644 --- a/docs/documentation/release_notes/topics/26_5_0.adoc +++ b/docs/documentation/release_notes/topics/26_5_0.adoc @@ -129,3 +129,13 @@ MDC enables Keycloak to enrich log entries with contextual information such as r For more details, see the https://www.keycloak.org/server/logging#_adding_context_for_log_messages[Adding context for log messages] guide. +== New centralized telemetry options + +{project_name} now provides centralized telemetry configuration options that can be shared across all telemetry (OpenTelemetry) components - traces, with future support planned for logs and metrics. +Individual components can override these global settings when needed. + +New options: `telemetry-endpoint`, `telemetry-protocol`, `telemetry-service-name`, and `telemetry-resource-attributes`. + +*Deprecation:* The `tracing-service-name` and `tracing-resource-attributes` options are now deprecated in favor of `telemetry-service-name` and `telemetry-resource-attributes`. + +For more details, see the link:{telemetryguide_link}[{telemetryguide_name}] guide. diff --git a/docs/documentation/tests/src/test/resources/ignored-links b/docs/documentation/tests/src/test/resources/ignored-links index cb1ec188fb2..846846770eb 100644 --- a/docs/documentation/tests/src/test/resources/ignored-links +++ b/docs/documentation/tests/src/test/resources/ignored-links @@ -44,4 +44,7 @@ https://saml.xml.org* # To be removed once KC 26.4.2 is released https://www.keycloak.org/server/db#multiple-datasources https://www.keycloak.org/server/logging#http-access-logging -https://www.keycloak.org/server/logging#mdc \ No newline at end of file +https://www.keycloak.org/server/logging#mdc + +# To be removed once KC 26.5.0 is release +https://www.keycloak.org/observability/telemetry \ No newline at end of file diff --git a/docs/documentation/topics/templates/document-attributes.adoc b/docs/documentation/topics/templates/document-attributes.adoc index cfd03c49302..81778533e85 100644 --- a/docs/documentation/topics/templates/document-attributes.adoc +++ b/docs/documentation/topics/templates/document-attributes.adoc @@ -89,6 +89,8 @@ :operatorguide_link: https://www.keycloak.org/guides#operator :tracingguide_name: Root cause analysis with tracing :tracingguide_link: https://www.keycloak.org/observability/tracing +:telemetryguide_name: Centralize your observability stack with OpenTelemetry +:telemetryguide_link: https://www.keycloak.org/observability/telemetry :upgradingguide_name: Upgrading Guide :upgradingguide_name_short: Upgrading :upgradingguide_link: {project_doc_base_url}/upgrading/ diff --git a/docs/documentation/upgrading/topics/changes/changes-26_5_0.adoc b/docs/documentation/upgrading/topics/changes/changes-26_5_0.adoc index b66a22c5fb4..1aa322cc99e 100644 --- a/docs/documentation/upgrading/topics/changes/changes-26_5_0.adoc +++ b/docs/documentation/upgrading/topics/changes/changes-26_5_0.adoc @@ -181,6 +181,20 @@ It is still triggered in this {project_name} version, but will be removed in a f Fine-Grained Admin Permissions (FGAP) v1 is now deprecated. This version no longer receives enhancements and improvements and will be removed in future release. Please migrate to FGAP v2 to ensure continued support. +=== Tracing options `tracing-service-name` and `tracing-resource-attributes` + +The `tracing-service-name` and `tracing-resource-attributes` options are now deprecated in favor of the new centralized telemetry options `telemetry-service-name` and `telemetry-resource-attributes`. +The service name and resource attributes are not directly related to the OpenTelemetry Tracing itself, but to the whole OpenTelemetry settings. + +The deprecated options will continue to work, but the new telemetry options take precedence. + +Migration path: +[source] +---- +tracing-service-name --> telemetry-service-name +tracing-resource-attributes --> telemetry-resource-attributes +---- + // ------------------------ Removed features ------------------------ // == Removed features diff --git a/docs/guides/observability/pinned-guides b/docs/guides/observability/pinned-guides index d9a9a2b39c6..114904a52e9 100644 --- a/docs/guides/observability/pinned-guides +++ b/docs/guides/observability/pinned-guides @@ -1,3 +1,4 @@ +telemetry health configuration-metrics event-metrics diff --git a/docs/guides/observability/telemetry.adoc b/docs/guides/observability/telemetry.adoc new file mode 100644 index 00000000000..62f24fbd5b1 --- /dev/null +++ b/docs/guides/observability/telemetry.adoc @@ -0,0 +1,65 @@ +<#import "/templates/guide.adoc" as tmpl> +<#import "/templates/kc.adoc" as kc> +<#import "/templates/options.adoc" as opts> +<#import "/templates/links.adoc" as links> + +<@tmpl.guide +title="Centralize your observability stack with OpenTelemetry" +summary="Learn about OpenTelemetry integration for centralized observability and telemetry data."> + +https://opentelemetry.io/docs/what-is-opentelemetry/[OpenTelemetry] (OTel) is an open-source observability framework designed to provide consistent and reliable ways to collect telemetry data across distributed systems. +It is a project under the https://www.cncf.io/projects/opentelemetry/[Cloud Native Computing Foundation (CNCF)] as an incubating project. +Its goal is to provide a unified standard and toolset for instrumenting, generating, and exporting telemetry data from modern applications, making it easier to monitor, debug, and understand complex services. + +The goal of {project_name} is to support OpenTelemetry Logs, Metrics, and Traces to create a centralized observability stack without any additional deployment overhead. + +== General options +{project_name} provides support for global settings of telemetry data export. +It means that you can configure connection parameters to a single https://opentelemetry.io/docs/collector/[OpenTelemetry collector] that will be used for all supported components. + +In order to have OpenTelemetry enabled, at least one component needs to be turned on, for example <>. + +NOTE: The OpenTelemetry feature is _enabled_ by default. Disable the feature in order to disable OpenTelemetry components. + +=== Endpoint +You can configure the OpenTelemetry collector's global endpoint that is shared across all components by using the `telemetry-endpoint` option. +The default value is `+http://localhost:4317+`. + +You can change the endpoint via CLI as follows: + +<@kc.start parameters="--telemetry-endpoint=http://my-otel-endpoint:4317"/> + +=== Service name +You can configure the global OpenTelemetry service name used for identifying the exporter of the telemetry data. +The default service name is `keycloak`, specified via the `telemetry-service-name` property, which takes precedence over `service.name` defined in the `telemetry-resource-attributes` property. + +You can change the service name via CLI as follows: + +<@kc.start parameters="--telemetry-service-name=my-keycloak-iam"/> + +=== Protocol +You can configure the global OpenTelemetry transport protocol used as a communication channel between {project_name} and the OpenTelemetry collector. +The default value is `grpc`. + +{project_name} supports these communication protocols: + +<@opts.expectedValues option="telemetry-protocol"/> + +You can change the protocol via CLI as follows: + +<@kc.start parameters="--telemetry-protocol=http/protobuf"/> + +== Traces + +See the https://www.keycloak.org/observability/tracing[Root cause analysis with tracing guide]. + +You can override the global OpenTelemetry settings via the Tracing options if you want to export traces to a different OpenTelemetry collector. + +<@opts.printRelevantOptions includedOptions="telemetry-*"> + +=== Traces +<@opts.includeOptions includedOptions="tracing-enabled tracing-endpoint tracing-protocol tracing-service-name tracing-resource-attributes"/> + + + + diff --git a/docs/guides/observability/tracing.adoc b/docs/guides/observability/tracing.adoc index bf2dba3706d..1083de08af1 100644 --- a/docs/guides/observability/tracing.adoc +++ b/docs/guides/observability/tracing.adoc @@ -26,6 +26,8 @@ The default service name is `keycloak`, specified via the `tracing-service-name` For more information about resource attributes that can be provided via the `tracing-resource-attributes` property, see the https://quarkus.io/guides/opentelemetry#resource[Quarkus OpenTelemetry Resource] guide. +WARNING: Properties `tracing-service-name` and `tracing-resource-attributes` are *deprecated*, and you should use the `telemetry-service-name` and `telemetry-resource-attributes`, respectively. + NOTE: Tracing can be enabled only when the `opentelemetry` feature is *enabled* (by default). For more tracing settings, see all possible configurations below. diff --git a/quarkus/config-api/src/main/java/org/keycloak/config/OptionCategory.java b/quarkus/config-api/src/main/java/org/keycloak/config/OptionCategory.java index f85b11b9006..7c2b5896060 100644 --- a/quarkus/config-api/src/main/java/org/keycloak/config/OptionCategory.java +++ b/quarkus/config-api/src/main/java/org/keycloak/config/OptionCategory.java @@ -17,8 +17,9 @@ public enum OptionCategory { PROXY("Proxy", 90, ConfigSupportLevel.SUPPORTED), VAULT("Vault", 100, ConfigSupportLevel.SUPPORTED), LOGGING("Logging", 110, ConfigSupportLevel.SUPPORTED), - TRACING("Tracing", 111, ConfigSupportLevel.SUPPORTED), - EVENTS("Events", 112, ConfigSupportLevel.SUPPORTED), + TELEMETRY("Telemetry (OpenTelemetry)", 112, ConfigSupportLevel.SUPPORTED), + TRACING("Tracing", 113, ConfigSupportLevel.SUPPORTED), + EVENTS("Events", 114, ConfigSupportLevel.SUPPORTED), TRUSTSTORE("Truststore", 115, ConfigSupportLevel.SUPPORTED), SECURITY("Security", 120, ConfigSupportLevel.SUPPORTED), EXPORT("Export", 130, ConfigSupportLevel.SUPPORTED), diff --git a/quarkus/config-api/src/main/java/org/keycloak/config/TelemetryOptions.java b/quarkus/config-api/src/main/java/org/keycloak/config/TelemetryOptions.java new file mode 100644 index 00000000000..4421385e820 --- /dev/null +++ b/quarkus/config-api/src/main/java/org/keycloak/config/TelemetryOptions.java @@ -0,0 +1,36 @@ +package org.keycloak.config; + +import java.util.List; + +public class TelemetryOptions { + + public static final Option TELEMETRY_ENABLED = new OptionBuilder<>("telemetry-enabled", Boolean.class) + .category(OptionCategory.TELEMETRY) + .buildTime(true) + .hidden() + .build(); + + public static final Option TELEMETRY_ENDPOINT = new OptionBuilder<>("telemetry-endpoint", String.class) + .category(OptionCategory.TELEMETRY) + .description("OpenTelemetry endpoint to connect to.") + .defaultValue("http://localhost:4317") + .build(); + + public static final Option TELEMETRY_SERVICE_NAME = new OptionBuilder<>("telemetry-service-name", String.class) + .category(OptionCategory.TELEMETRY) + .description("OpenTelemetry service name. Takes precedence over 'service.name' defined in the 'telemetry-resource-attributes' property.") + .defaultValue("keycloak") + .build(); + + public static final Option TELEMETRY_PROTOCOL = new OptionBuilder<>("telemetry-protocol", String.class) + .category(OptionCategory.TELEMETRY) + .description("OpenTelemetry protocol used for the communication between server and OpenTelemetry collector.") + .defaultValue("grpc") + .expectedValues("grpc", "http/protobuf") + .build(); + + public static final Option> TELEMETRY_RESOURCE_ATTRIBUTES = OptionBuilder.listOptionBuilder("telemetry-resource-attributes", String.class) + .category(OptionCategory.TELEMETRY) + .description("OpenTelemetry resource attributes characterize the telemetry producer. Values in format 'key1=val1,key2=val2'.") + .build(); +} diff --git a/quarkus/config-api/src/main/java/org/keycloak/config/TracingOptions.java b/quarkus/config-api/src/main/java/org/keycloak/config/TracingOptions.java index 5204009f782..dd2b89a2722 100644 --- a/quarkus/config-api/src/main/java/org/keycloak/config/TracingOptions.java +++ b/quarkus/config-api/src/main/java/org/keycloak/config/TracingOptions.java @@ -33,7 +33,7 @@ public class TracingOptions { public static final Option TRACING_ENDPOINT = new OptionBuilder<>("tracing-endpoint", String.class) .category(OptionCategory.TRACING) - .description("OpenTelemetry endpoint to connect to.") + .description("OpenTelemetry endpoint to connect to for traces. If not given, the value is inherited from the '%s' option.".formatted(TelemetryOptions.TELEMETRY_ENDPOINT.getKey())) .defaultValue("http://localhost:4317") .build(); @@ -44,19 +44,32 @@ public class TracingOptions { .buildTime(true) .build(); + /** + * @deprecated use the {@link TelemetryOptions#TELEMETRY_SERVICE_NAME} + */ + @Deprecated public static final Option TRACING_SERVICE_NAME = new OptionBuilder<>("tracing-service-name", String.class) .category(OptionCategory.TRACING) - .description("OpenTelemetry service name. Takes precedence over 'service.name' defined in the 'tracing-resource-attributes' property.") + .deprecated() + .deprecatedMetadata(DeprecatedMetadata.deprecateOption("Service name is not directly related to Tracing and you should use the Telemetry option which takes precedence.", TelemetryOptions.TELEMETRY_SERVICE_NAME.getKey())) + .description("OpenTelemetry service name. Takes precedence over 'service.name' defined in the 'tracing-resource-attributes' property. If not given, the value is inherited from the '%s' option.".formatted(TelemetryOptions.TELEMETRY_SERVICE_NAME.getKey())) .defaultValue("keycloak") .build(); + /** + * @deprecated use the {@link TelemetryOptions#TELEMETRY_RESOURCE_ATTRIBUTES} + */ + @Deprecated public static final Option> TRACING_RESOURCE_ATTRIBUTES = OptionBuilder.listOptionBuilder("tracing-resource-attributes", String.class) .category(OptionCategory.TRACING) - .description("OpenTelemetry resource attributes present in the exported trace to characterize the telemetry producer. Values in format 'key1=val1,key2=val2'. For more information, check the Tracing guide.") + .deprecated() + .deprecatedMetadata(DeprecatedMetadata.deprecateOption("Resource attributes are not directly related to Tracing and you should use the Telemetry option which takes precedence.", TelemetryOptions.TELEMETRY_RESOURCE_ATTRIBUTES.getKey())) + .description("OpenTelemetry resource attributes present in the exported trace to characterize the telemetry producer. Values in format 'key1=val1,key2=val2'. If not given, the value is inherited from the '%s' option. For more information, check the Tracing guide.".formatted(TelemetryOptions.TELEMETRY_RESOURCE_ATTRIBUTES.getKey())) .build(); + public static final Option TRACING_PROTOCOL = new OptionBuilder<>("tracing-protocol", String.class) .category(OptionCategory.TRACING) - .description("OpenTelemetry protocol used for the telemetry data.") + .description("OpenTelemetry protocol used for the telemetry data. If not given, the value is inherited from the '%s' option.".formatted(TelemetryOptions.TELEMETRY_PROTOCOL.getKey())) .defaultValue("grpc") .expectedValues("grpc", "http/protobuf") .build(); diff --git a/quarkus/runtime/src/main/java/org/keycloak/quarkus/runtime/configuration/mappers/PropertyMappers.java b/quarkus/runtime/src/main/java/org/keycloak/quarkus/runtime/configuration/mappers/PropertyMappers.java index 5d79b802a02..49e6c225c5c 100644 --- a/quarkus/runtime/src/main/java/org/keycloak/quarkus/runtime/configuration/mappers/PropertyMappers.java +++ b/quarkus/runtime/src/main/java/org/keycloak/quarkus/runtime/configuration/mappers/PropertyMappers.java @@ -54,7 +54,7 @@ public final class PropertyMappers { new FeaturePropertyMappers(), new ImportPropertyMappers(), new ManagementPropertyMappers(), new MetricsPropertyMappers(), new OpenApiPropertyMappers(), new LoggingPropertyMappers(), new ProxyPropertyMappers(), new VaultPropertyMappers(), new TracingPropertyMappers(), new TransactionPropertyMappers(), - new SecurityPropertyMappers(), new TruststorePropertyMappers()); + new SecurityPropertyMappers(), new TruststorePropertyMappers(), new TelemetryPropertyMappers()); } public static List getPropertyMapperGroupings() { diff --git a/quarkus/runtime/src/main/java/org/keycloak/quarkus/runtime/configuration/mappers/TelemetryPropertyMappers.java b/quarkus/runtime/src/main/java/org/keycloak/quarkus/runtime/configuration/mappers/TelemetryPropertyMappers.java new file mode 100644 index 00000000000..1f79eab1ffb --- /dev/null +++ b/quarkus/runtime/src/main/java/org/keycloak/quarkus/runtime/configuration/mappers/TelemetryPropertyMappers.java @@ -0,0 +1,94 @@ +package org.keycloak.quarkus.runtime.configuration.mappers; + +import java.net.MalformedURLException; +import java.net.URISyntaxException; +import java.net.URL; +import java.util.List; + +import org.keycloak.common.Profile; +import org.keycloak.config.TracingOptions; +import org.keycloak.quarkus.runtime.cli.PropertyException; +import org.keycloak.quarkus.runtime.configuration.Configuration; +import org.keycloak.utils.StringUtil; + +import io.smallrye.config.ConfigSourceInterceptorContext; + +import static org.keycloak.config.TelemetryOptions.TELEMETRY_ENABLED; +import static org.keycloak.config.TelemetryOptions.TELEMETRY_ENDPOINT; +import static org.keycloak.config.TelemetryOptions.TELEMETRY_PROTOCOL; +import static org.keycloak.config.TelemetryOptions.TELEMETRY_RESOURCE_ATTRIBUTES; +import static org.keycloak.config.TelemetryOptions.TELEMETRY_SERVICE_NAME; +import static org.keycloak.quarkus.runtime.configuration.mappers.PropertyMapper.fromOption; + +public class TelemetryPropertyMappers implements PropertyMapperGrouping{ + private static final String OTEL_FEATURE_ENABLED_MSG = "'opentelemetry' feature is enabled"; + private static final String OTEL_COLLECTOR_ENABLED_MSG = "any of available OpenTelemetry components (Traces) is turned on"; + + @Override + public List> getPropertyMappers() { + return List.of( + fromOption(TELEMETRY_ENABLED) + .isEnabled(TelemetryPropertyMappers::isFeatureEnabled, OTEL_FEATURE_ENABLED_MSG) + .transformer(TelemetryPropertyMappers::checkIfDependantsAreEnabled) + .to("quarkus.otel.enabled") + .build(), + fromOption(TELEMETRY_ENDPOINT) + .isEnabled(TelemetryPropertyMappers::isTelemetryEnabled, OTEL_COLLECTOR_ENABLED_MSG) + .to("quarkus.otel.exporter.otlp.endpoint") + .paramLabel("url") + .validator(TelemetryPropertyMappers::validateEndpoint) + .build(), + fromOption(TELEMETRY_SERVICE_NAME) + .mapFrom(TracingOptions.TRACING_SERVICE_NAME) // the tracing option is deprecated, but we need to be backward compatible + .isEnabled(TelemetryPropertyMappers::isTelemetryEnabled, OTEL_COLLECTOR_ENABLED_MSG) + .to("quarkus.otel.service.name") + .paramLabel("name") + .build(), + fromOption(TELEMETRY_PROTOCOL) + .isEnabled(TelemetryPropertyMappers::isTelemetryEnabled, OTEL_COLLECTOR_ENABLED_MSG) + .to("quarkus.otel.exporter.otlp.protocol") + .paramLabel("protocol") + .build(), + fromOption(TELEMETRY_RESOURCE_ATTRIBUTES) + .mapFrom(TracingOptions.TRACING_RESOURCE_ATTRIBUTES) // the tracing option is deprecated, but we need to be backward compatible + .isEnabled(TelemetryPropertyMappers::isTelemetryEnabled, OTEL_COLLECTOR_ENABLED_MSG) + .to("quarkus.otel.resource.attributes") + .paramLabel("attributes") + .build() + ); + } + + private static String checkIfDependantsAreEnabled(String value, ConfigSourceInterceptorContext context) { + if (Configuration.isTrue(TracingOptions.TRACING_ENABLED)) { + return Boolean.TRUE.toString(); + } + return Boolean.FALSE.toString(); + } + + private static boolean isFeatureEnabled() { + return Profile.isFeatureEnabled(Profile.Feature.OPENTELEMETRY); + } + + public static boolean isTelemetryEnabled() { + return Configuration.isTrue("quarkus.otel.enabled"); + } + + static void validateEndpoint(String value) { + if (StringUtil.isBlank(value)) { + throw new PropertyException("Specified Endpoint URL must not be empty."); + } + + if (!isValidUrl(value)) { + throw new PropertyException("Specified Endpoint URL is invalid."); + } + } + + static boolean isValidUrl(String url) { + try { + new URL(url).toURI(); + return true; + } catch (MalformedURLException | URISyntaxException e) { + return false; + } + } +} diff --git a/quarkus/runtime/src/main/java/org/keycloak/quarkus/runtime/configuration/mappers/TracingPropertyMappers.java b/quarkus/runtime/src/main/java/org/keycloak/quarkus/runtime/configuration/mappers/TracingPropertyMappers.java index c4218a4faa4..bb4023bc941 100644 --- a/quarkus/runtime/src/main/java/org/keycloak/quarkus/runtime/configuration/mappers/TracingPropertyMappers.java +++ b/quarkus/runtime/src/main/java/org/keycloak/quarkus/runtime/configuration/mappers/TracingPropertyMappers.java @@ -17,15 +17,13 @@ package org.keycloak.quarkus.runtime.configuration.mappers; -import java.net.MalformedURLException; -import java.net.URISyntaxException; -import java.net.URL; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.stream.Collectors; import org.keycloak.common.Profile; +import org.keycloak.config.TelemetryOptions; import org.keycloak.config.TracingOptions; import org.keycloak.quarkus.runtime.cli.PropertyException; import org.keycloak.quarkus.runtime.configuration.Configuration; @@ -62,26 +60,28 @@ public class TracingPropertyMappers implements PropertyMapperGrouping { return List.of( fromOption(TRACING_ENABLED) .isEnabled(TracingPropertyMappers::isFeatureEnabled, OTEL_FEATURE_ENABLED_MSG) - .to("quarkus.otel.enabled") // enable/disable whole OTel, tracing is enabled by default + .to("quarkus.otel.traces.enabled") .build(), fromOption(TRACING_ENDPOINT) .isEnabled(TracingPropertyMappers::isTracingEnabled, TRACING_ENABLED_MSG) + .mapFrom(TelemetryOptions.TELEMETRY_ENDPOINT) .to("quarkus.otel.exporter.otlp.traces.endpoint") .paramLabel("url") - .validator(TracingPropertyMappers::validateEndpoint) + .validator(TelemetryPropertyMappers::validateEndpoint) .build(), fromOption(TRACING_SERVICE_NAME) + // mapped to 'telemetry-service-name' .isEnabled(TracingPropertyMappers::isTracingEnabled, TRACING_ENABLED_MSG) - .to("quarkus.otel.service.name") .paramLabel("name") .build(), fromOption(TRACING_RESOURCE_ATTRIBUTES) + // mapped to 'telemetry-resource-attributes' .isEnabled(TracingPropertyMappers::isTracingEnabled, TRACING_ENABLED_MSG) - .to("quarkus.otel.resource.attributes") .paramLabel("attributes") .build(), fromOption(TRACING_PROTOCOL) .isEnabled(TracingPropertyMappers::isTracingEnabled, TRACING_ENABLED_MSG) + .mapFrom(TelemetryOptions.TELEMETRY_PROTOCOL) .to("quarkus.otel.exporter.otlp.traces.protocol") .paramLabel("protocol") .build(), @@ -125,16 +125,6 @@ public class TracingPropertyMappers implements PropertyMapperGrouping { ); } - private static void validateEndpoint(String value) { - if (StringUtil.isBlank(value)) { - throw new PropertyException("URL specified in 'tracing-endpoint' option must not be empty."); - } - - if (!isValidUrl(value)) { - throw new PropertyException("URL specified in 'tracing-endpoint' option is invalid."); - } - } - private static void validateRatio(String value) { if (StringUtil.isBlank(value)) { throw new PropertyException("Ratio in 'tracing-sampler-ratio' option must not be empty."); @@ -184,13 +174,4 @@ public class TracingPropertyMappers implements PropertyMapperGrouping { public static boolean isTracingAndEmbeddedInfinispanEnabled() { return Configuration.isTrue(TRACING_ENABLED) && CachingPropertyMappers.cacheSetToInfinispan(); } - - private static boolean isValidUrl(String url) { - try { - new URL(url).toURI(); - return true; - } catch (MalformedURLException | URISyntaxException e) { - return false; - } - } } diff --git a/quarkus/runtime/src/test/java/org/keycloak/quarkus/runtime/cli/PicocliTest.java b/quarkus/runtime/src/test/java/org/keycloak/quarkus/runtime/cli/PicocliTest.java index 818f5491271..0731748814e 100644 --- a/quarkus/runtime/src/test/java/org/keycloak/quarkus/runtime/cli/PicocliTest.java +++ b/quarkus/runtime/src/test/java/org/keycloak/quarkus/runtime/cli/PicocliTest.java @@ -47,6 +47,7 @@ import picocli.CommandLine; import picocli.CommandLine.Help; import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.anyOf; import static org.hamcrest.Matchers.containsString; import static org.hamcrest.Matchers.is; import static org.hamcrest.Matchers.not; @@ -1231,4 +1232,142 @@ public class PicocliTest extends AbstractConfigurationTest { assertEquals(CommandLine.ExitCode.USAGE, nonRunningPicocli.exitCode); assertThat(nonRunningPicocli.getErrString(), containsString("Wrong value for feature 'dpop': wrong. You can specify either 'enabled', 'disabled', or specific version (lowercase) that will be enabled")); } + + @Test + public void otelTracing() { + // tracing options + NonRunningPicocli nonRunningPicocli = pseudoLaunch("start-dev", "--tracing-enabled=true", "--tracing-service-name=service"); + assertEquals(CommandLine.ExitCode.OK, nonRunningPicocli.exitCode); + assertThat(nonRunningPicocli.config.getConfigValue("quarkus.otel.enabled").getValue(), is("true")); + assertThat(nonRunningPicocli.config.getConfigValue("quarkus.otel.traces.enabled").getValue(), is("true")); + assertThat(nonRunningPicocli.config.getConfigValue("quarkus.otel.service.name").getValue(), is("service")); + assertThat(nonRunningPicocli.getOutString(), containsString("The following used options or option values are DEPRECATED")); + assertThat(nonRunningPicocli.getOutString(), containsString("tracing-service-name: Service name is not directly related to Tracing and you should use the Telemetry option which takes precedence. Use telemetry-service-name")); + onAfter(); + + // tracing enabled option + telemetry + nonRunningPicocli = pseudoLaunch("start-dev", "--tracing-enabled=true", "--telemetry-endpoint=http://endpoint:3232"); + assertEquals(CommandLine.ExitCode.OK, nonRunningPicocli.exitCode); + assertThat(nonRunningPicocli.config.getConfigValue("quarkus.otel.enabled").getValue(), is("true")); + assertThat(nonRunningPicocli.config.getConfigValue("quarkus.otel.traces.enabled").getValue(), is("true")); + assertThat(nonRunningPicocli.config.getConfigValue("quarkus.otel.exporter.otlp.traces.endpoint").getValue(), is("http://endpoint:3232")); + onAfter(); + + // combined service name + nonRunningPicocli = pseudoLaunch("start-dev", "--tracing-enabled=true", "--telemetry-service-name=service123", "--tracing-service-name=service456"); + assertEquals(CommandLine.ExitCode.OK, nonRunningPicocli.exitCode); + assertThat(nonRunningPicocli.config.getConfigValue("quarkus.otel.enabled").getValue(), is("true")); + assertThat(nonRunningPicocli.config.getConfigValue("quarkus.otel.traces.enabled").getValue(), is("true")); + assertThat(nonRunningPicocli.config.getConfigValue("quarkus.otel.service.name").getValue(), is("service123")); + onAfter(); + + // combined service name + disabled tracing + nonRunningPicocli = pseudoLaunch("start-dev", "--telemetry-service-name=service123", "--tracing-service-name=service456"); + assertEquals(CommandLine.ExitCode.USAGE, nonRunningPicocli.exitCode); + assertThat(nonRunningPicocli.getErrString(), anyOf( + containsString("Disabled option: '--tracing-service-name'. Available only when Tracing is enabled"), + containsString("Disabled option: '--telemetry-service-name'. Available only when any of available OpenTelemetry components (Traces) is turned on") + )); + assertThat(nonRunningPicocli.config.getConfigValue("quarkus.otel.enabled").getValue(), is("false")); + assertThat(nonRunningPicocli.config.getConfigValue("quarkus.otel.traces.enabled").getValue(), is("false")); + assertThat(nonRunningPicocli.config.getConfigValue("quarkus.otel.service.name").getValue(), is(nullValue())); + onAfter(); + + // disabled tracing + nonRunningPicocli = pseudoLaunch("start-dev", "--telemetry-service-name=service123"); + assertEquals(CommandLine.ExitCode.USAGE, nonRunningPicocli.exitCode); + assertThat(nonRunningPicocli.getErrString(), containsString("Disabled option: '--telemetry-service-name'. Available only when any of available OpenTelemetry components (Traces) is turned on")); + assertThat(nonRunningPicocli.config.getConfigValue("quarkus.otel.enabled").getValue(), is("false")); + assertThat(nonRunningPicocli.config.getConfigValue("quarkus.otel.traces.enabled").getValue(), is("false")); + assertThat(nonRunningPicocli.config.getConfigValue("quarkus.otel.service.name").getValue(), is(nullValue())); + onAfter(); + + // combined resource attributes + nonRunningPicocli = pseudoLaunch("start-dev", "--tracing-enabled=true", "--telemetry-resource-attributes=otel1=val1", "--tracing-resource-attributes=tracing1=val2"); + assertEquals(CommandLine.ExitCode.OK, nonRunningPicocli.exitCode); + assertThat(nonRunningPicocli.config.getConfigValue("quarkus.otel.enabled").getValue(), is("true")); + assertThat(nonRunningPicocli.config.getConfigValue("quarkus.otel.traces.enabled").getValue(), is("true")); + assertThat(nonRunningPicocli.config.getConfigValue("quarkus.otel.resource.attributes").getValue(), is("otel1=val1")); // Telemetry option takes precedence + assertThat(nonRunningPicocli.getOutString(), containsString("The following used options or option values are DEPRECATED")); + assertThat(nonRunningPicocli.getOutString(), containsString("tracing-resource-attributes: Resource attributes are not directly related to Tracing and you should use the Telemetry option which takes precedence. Use telemetry-resource-attributes.")); + onAfter(); + + // combined resource attributes + nonRunningPicocli = pseudoLaunch("start-dev", "--tracing-enabled=true", "--telemetry-resource-attributes=otel1=val1", "--tracing-resource-attributes=tracing1=val2"); + assertEquals(CommandLine.ExitCode.OK, nonRunningPicocli.exitCode); + assertThat(nonRunningPicocli.config.getConfigValue("quarkus.otel.enabled").getValue(), is("true")); + assertThat(nonRunningPicocli.config.getConfigValue("quarkus.otel.traces.enabled").getValue(), is("true")); + assertThat(nonRunningPicocli.config.getConfigValue("quarkus.otel.resource.attributes").getValue(), is("otel1=val1")); // Telemetry option takes precedence + assertThat(nonRunningPicocli.getOutString(), containsString("The following used options or option values are DEPRECATED")); + assertThat(nonRunningPicocli.getOutString(), containsString("tracing-resource-attributes: Resource attributes are not directly related to Tracing and you should use the Telemetry option which takes precedence. Use telemetry-resource-attributes.")); + onAfter(); + + // wrong protocol + nonRunningPicocli = pseudoLaunch("start-dev", "--tracing-enabled=true", "--telemetry-protocol=wrong"); + assertEquals(CommandLine.ExitCode.USAGE, nonRunningPicocli.exitCode); + assertThat(nonRunningPicocli.getErrString(), containsString("Invalid value for option '--telemetry-protocol': wrong. Expected values are: grpc, http/protobuf")); + onAfter(); + + // combined protocol + nonRunningPicocli = pseudoLaunch("start-dev", "--tracing-enabled=true", "--telemetry-protocol=grpc", "--tracing-protocol=http/protobuf"); + assertEquals(CommandLine.ExitCode.OK, nonRunningPicocli.exitCode); + assertThat(nonRunningPicocli.config.getConfigValue("quarkus.otel.enabled").getValue(), is("true")); + assertThat(nonRunningPicocli.config.getConfigValue("quarkus.otel.exporter.otlp.protocol").getValue(), is("grpc")); + assertThat(nonRunningPicocli.config.getConfigValue("quarkus.otel.exporter.otlp.traces.protocol").getValue(), is("http/protobuf")); // Tracing options take precedence + onAfter(); + + // telemetry protocol + nonRunningPicocli = pseudoLaunch("start-dev", "--tracing-enabled=true", "--telemetry-protocol=http/protobuf"); + assertEquals(CommandLine.ExitCode.OK, nonRunningPicocli.exitCode); + assertThat(nonRunningPicocli.config.getConfigValue("quarkus.otel.enabled").getValue(), is("true")); + assertThat(nonRunningPicocli.config.getConfigValue("quarkus.otel.exporter.otlp.protocol").getValue(), is("http/protobuf")); + assertThat(nonRunningPicocli.config.getConfigValue("quarkus.otel.exporter.otlp.traces.protocol").getValue(), is("http/protobuf")); + onAfter(); + + // parent + child protocol + nonRunningPicocli = pseudoLaunch("start-dev", "--tracing-enabled=true", "--tracing-protocol=http/protobuf", "--telemetry-protocol=grpc"); + assertEquals(CommandLine.ExitCode.OK, nonRunningPicocli.exitCode); + assertThat(nonRunningPicocli.config.getConfigValue("quarkus.otel.enabled").getValue(), is("true")); + assertThat(nonRunningPicocli.config.getConfigValue("quarkus.otel.exporter.otlp.protocol").getValue(), is("grpc")); + assertThat(nonRunningPicocli.config.getConfigValue("quarkus.otel.exporter.otlp.traces.protocol").getValue(), is("http/protobuf")); + onAfter(); + + // wrong endpoint - telemetry option + nonRunningPicocli = pseudoLaunch("start-dev", "--tracing-enabled=true", "--telemetry-endpoint=not-url"); + assertEquals(CommandLine.ExitCode.USAGE, nonRunningPicocli.exitCode); + assertThat(nonRunningPicocli.getErrString(), containsString("Specified Endpoint URL is invalid")); + onAfter(); + + // wrong endpoint - tracing option + nonRunningPicocli = pseudoLaunch("start-dev", "--tracing-enabled=true", "--tracing-endpoint=not-url"); + assertEquals(CommandLine.ExitCode.USAGE, nonRunningPicocli.exitCode); + assertThat(nonRunningPicocli.getErrString(), containsString("Specified Endpoint URL is invalid")); + onAfter(); + + // combined endpoint + nonRunningPicocli = pseudoLaunch("start-dev", "--tracing-enabled=true", "--telemetry-endpoint=http://keycloak.org", "--tracing-endpoint=http://keycloak2.org"); + assertEquals(CommandLine.ExitCode.OK, nonRunningPicocli.exitCode); + assertThat(nonRunningPicocli.config.getConfigValue("quarkus.otel.exporter.otlp.endpoint").getValue(), is("http://keycloak.org")); // Tracing option takes precedence + assertThat(nonRunningPicocli.config.getConfigValue("quarkus.otel.exporter.otlp.traces.endpoint").getValue(), is("http://keycloak2.org")); // Tracing option takes precedence + onAfter(); + + // telemetry endpoint + nonRunningPicocli = pseudoLaunch("start-dev", "--tracing-enabled=true", "--telemetry-endpoint=http://keycloak.org"); + assertEquals(CommandLine.ExitCode.OK, nonRunningPicocli.exitCode); + assertThat(nonRunningPicocli.config.getConfigValue("quarkus.otel.exporter.otlp.traces.endpoint").getValue(), is("http://keycloak.org")); + onAfter(); + + // parent + child endpoint + nonRunningPicocli = pseudoLaunch("start-dev", "--tracing-enabled=true", "--telemetry-endpoint=http://keycloak-keycloak-keycloak.org:3455", "--tracing-endpoint=http://keycloak.org"); + assertEquals(CommandLine.ExitCode.OK, nonRunningPicocli.exitCode); + assertThat(nonRunningPicocli.config.getConfigValue("quarkus.otel.exporter.otlp.endpoint").getValue(), is("http://keycloak-keycloak-keycloak.org:3455")); + assertThat(nonRunningPicocli.config.getConfigValue("quarkus.otel.exporter.otlp.traces.endpoint").getValue(), is("http://keycloak.org")); + onAfter(); + + // parent endpoint + nonRunningPicocli = pseudoLaunch("start-dev", "--tracing-enabled=true", "--telemetry-endpoint=http://keycloak-keycloak-keycloak.org:3455"); + assertEquals(CommandLine.ExitCode.OK, nonRunningPicocli.exitCode); + assertThat(nonRunningPicocli.config.getConfigValue("quarkus.otel.exporter.otlp.endpoint").getValue(), is("http://keycloak-keycloak-keycloak.org:3455")); // value inherited + assertThat(nonRunningPicocli.config.getConfigValue("quarkus.otel.exporter.otlp.traces.endpoint").getValue(), is("http://keycloak-keycloak-keycloak.org:3455")); // value inherited + } } diff --git a/quarkus/runtime/src/test/java/org/keycloak/quarkus/runtime/configuration/TelemetryConfigurationTest.java b/quarkus/runtime/src/test/java/org/keycloak/quarkus/runtime/configuration/TelemetryConfigurationTest.java new file mode 100644 index 00000000000..23cf561039b --- /dev/null +++ b/quarkus/runtime/src/test/java/org/keycloak/quarkus/runtime/configuration/TelemetryConfigurationTest.java @@ -0,0 +1,71 @@ +package org.keycloak.quarkus.runtime.configuration; + +import java.util.Map; + +import org.junit.Test; + +public class TelemetryConfigurationTest extends AbstractConfigurationTest { + + @Test + public void rootDefaults() { + initConfig(); + assertConfig(Map.of( + "telemetry-enabled", "false", + "telemetry-endpoint", "http://localhost:4317", + "telemetry-service-name", "keycloak", + "telemetry-protocol", "grpc" + )); + assertConfigNull("telemetry-resource-attributes"); + assertExternalConfig(Map.of( + "quarkus.otel.enabled", "false", + "quarkus.otel.exporter.otlp.endpoint", "http://localhost:4317", + "quarkus.otel.service.name", "keycloak", + "quarkus.otel.exporter.otlp.traces.protocol", "grpc" + )); + assertExternalConfigNull("quarkus.otel.resource.attributes"); + } + + @Test + public void tracesDeprecated() { + // propagate to Quarkus props + ConfigArgsConfigSource.setCliArgs("--tracing-service-name=something", "--tracing-resource-attributes=val1=hello"); + initConfig(); + assertConfig(Map.of( + "tracing-service-name", "something", + "tracing-resource-attributes", "val1=hello" + )); + assertExternalConfig(Map.of( + "quarkus.otel.service.name", "something", + "quarkus.otel.resource.attributes", "val1=hello" + )); + onAfter(); + + // use recommended OTel properties + ConfigArgsConfigSource.setCliArgs("--telemetry-service-name=something2", "--telemetry-resource-attributes=val2=hello2"); + initConfig(); + assertConfig(Map.of( + "telemetry-service-name", "something2", + "telemetry-resource-attributes", "val2=hello2" + )); + assertExternalConfig(Map.of( + "quarkus.otel.service.name", "something2", + "quarkus.otel.resource.attributes", "val2=hello2" + )); + onAfter(); + + // check priority of options + ConfigArgsConfigSource.setCliArgs("--telemetry-service-name=something3", "--telemetry-resource-attributes=val3=hello3", + "--tracing-service-name=something", "--tracing-resource-attributes=val1=hello"); + initConfig(); + assertConfig(Map.of( + "telemetry-service-name", "something3", + "telemetry-resource-attributes", "val3=hello3", + "tracing-service-name", "something", + "tracing-resource-attributes", "val1=hello" + )); + assertExternalConfig(Map.of( + "quarkus.otel.service.name", "something3", + "quarkus.otel.resource.attributes", "val3=hello3" + )); + } +} diff --git a/quarkus/tests/integration/src/test/java/org/keycloak/it/cli/dist/TracingDistTest.java b/quarkus/tests/integration/src/test/java/org/keycloak/it/cli/dist/TracingDistTest.java index c2e2c67c501..f49d3164fea 100644 --- a/quarkus/tests/integration/src/test/java/org/keycloak/it/cli/dist/TracingDistTest.java +++ b/quarkus/tests/integration/src/test/java/org/keycloak/it/cli/dist/TracingDistTest.java @@ -33,18 +33,18 @@ import org.junit.jupiter.api.TestMethodOrder; @RawDistOnly(reason = "Containers are immutable") public class TracingDistTest { - private void assertTracingEnabled(CLIResult result) { + static void assertTracingEnabled(CLIResult result) { result.assertMessage("opentelemetry"); result.assertMessage("service.name=\"keycloak\""); } - private void assertTracingDisabled(CLIResult result) { + static void assertTracingDisabled(CLIResult result) { result.assertMessage("opentelemetry"); result.assertNoMessage("service.name=\"keycloak\""); assertSamplingDisabled(result); } - private void assertSamplingDisabled(CLIResult result) { + private static void assertSamplingDisabled(CLIResult result) { result.assertNoMessage("Failed to export spans."); result.assertNoMessage("Connection refused: localhost/127.0.0.1:4317"); } @@ -130,7 +130,7 @@ public class TracingDistTest { void emptyEndpoint(LaunchResult result) { CLIResult cliResult = (CLIResult) result; - cliResult.assertError("URL specified in 'tracing-endpoint' option must not be empty."); + cliResult.assertError("Specified Endpoint URL must not be empty."); } @Test @@ -138,7 +138,7 @@ public class TracingDistTest { void invalidUrl(LaunchResult result) { CLIResult cliResult = (CLIResult) result; - cliResult.assertError("URL specified in 'tracing-endpoint' option is invalid."); + cliResult.assertError("Specified Endpoint URL is invalid."); } @Test @@ -188,6 +188,7 @@ public class TracingDistTest { void differentServiceName(LaunchResult result) { CLIResult cliResult = (CLIResult) result; + cliResult.assertMessage("- tracing-service-name: Service name is not directly related to Tracing and you should use the Telemetry option which takes precedence. Use telemetry-service-name."); cliResult.assertMessage("opentelemetry"); cliResult.assertMessage("service.name=\"my-service\""); @@ -211,7 +212,7 @@ public class TracingDistTest { CLIResult cliResult = (CLIResult) result; assertTracingEnabled(cliResult); - + cliResult.assertMessage("- tracing-resource-attributes: Resource attributes are not directly related to Tracing and you should use the Telemetry option which takes precedence. Use telemetry-resource-attributes."); cliResult.assertMessage("some.key1=\"some.val1\""); cliResult.assertMessage("some.key2=\"some.val2\""); diff --git a/quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/dist/approvals/cli/help/HelpCommandDistTest.testExportHelpAll.approved.txt b/quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/dist/approvals/cli/help/HelpCommandDistTest.testExportHelpAll.approved.txt index 7d0a8861b39..39804f0875c 100644 --- a/quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/dist/approvals/cli/help/HelpCommandDistTest.testExportHelpAll.approved.txt +++ b/quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/dist/approvals/cli/help/HelpCommandDistTest.testExportHelpAll.approved.txt @@ -309,6 +309,26 @@ Logging: Set the Syslog type used to format the sent message. Possible values are: rfc5424, rfc3164. Default: rfc5424. Available only when Syslog is activated. +Telemetry (OpenTelemetry): + +--telemetry-endpoint + OpenTelemetry endpoint to connect to. Default: http://localhost:4317. + Available only when any of available OpenTelemetry components (Traces) is + turned on. +--telemetry-protocol + OpenTelemetry protocol used for the communication between server and + OpenTelemetry collector. Possible values are: grpc, http/protobuf. Default: + grpc. Available only when any of available OpenTelemetry components (Traces) + is turned on. +--telemetry-resource-attributes + OpenTelemetry resource attributes characterize the telemetry producer. Values + in format 'key1=val1,key2=val2'. Available only when any of available + OpenTelemetry components (Traces) is turned on. +--telemetry-service-name + OpenTelemetry service name. Takes precedence over 'service.name' defined in + the 'telemetry-resource-attributes' property. Default: keycloak. Available + only when any of available OpenTelemetry components (Traces) is turned on. + Tracing: --tracing-compression @@ -319,8 +339,9 @@ Tracing: Enables the OpenTelemetry tracing. Default: false. Available only when 'opentelemetry' feature is enabled. --tracing-endpoint - OpenTelemetry endpoint to connect to. Default: http://localhost:4317. - Available only when Tracing is enabled. + OpenTelemetry endpoint to connect to for traces. If not given, the value is + inherited from the 'telemetry-endpoint' option. Default: http://localhost: + 4317. Available only when Tracing is enabled. --tracing-header-
OpenTelemetry header that will be part of the exporter request (mainly useful for providing Authorization header). Check the documentation on how to set @@ -333,13 +354,18 @@ Tracing: Enables the OpenTelemetry JDBC tracing. Default: true. Available only when Tracing is enabled. --tracing-protocol - OpenTelemetry protocol used for the telemetry data. Possible values are: grpc, + OpenTelemetry protocol used for the telemetry data. If not given, the value is + inherited from the 'telemetry-protocol' option. Possible values are: grpc, http/protobuf. Default: grpc. Available only when Tracing is enabled. --tracing-resource-attributes - OpenTelemetry resource attributes present in the exported trace to + DEPRECATED. OpenTelemetry resource attributes present in the exported trace to characterize the telemetry producer. Values in format 'key1=val1,key2=val2'. - For more information, check the Tracing guide. Available only when Tracing - is enabled. + If not given, the value is inherited from the + 'telemetry-resource-attributes' option. For more information, check the + Tracing guide. Available only when Tracing is enabled. Resource attributes + are not directly related to Tracing and you should use the Telemetry option + which takes precedence. Use the following option instead: + telemetry-resource-attributes. --tracing-sampler-ratio OpenTelemetry sampler ratio. Probability that a span will be sampled. Expected double value in interval [0,1]. Default: 1.0. Available only when Tracing is @@ -350,9 +376,12 @@ Tracing: parentbased_traceidratio. Default: traceidratio. Available only when Tracing is enabled. --tracing-service-name - OpenTelemetry service name. Takes precedence over 'service.name' defined in - the 'tracing-resource-attributes' property. Default: keycloak. Available - only when Tracing is enabled. + DEPRECATED. OpenTelemetry service name. Takes precedence over 'service.name' + defined in the 'tracing-resource-attributes' property. If not given, the + value is inherited from the 'telemetry-service-name' option. Default: + keycloak. Available only when Tracing is enabled. Service name is not + directly related to Tracing and you should use the Telemetry option which + takes precedence. Use the following option instead: telemetry-service-name. Events: diff --git a/quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/dist/approvals/cli/help/HelpCommandDistTest.testImportHelpAll.approved.txt b/quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/dist/approvals/cli/help/HelpCommandDistTest.testImportHelpAll.approved.txt index 7a3f124749c..14863b9a37c 100644 --- a/quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/dist/approvals/cli/help/HelpCommandDistTest.testImportHelpAll.approved.txt +++ b/quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/dist/approvals/cli/help/HelpCommandDistTest.testImportHelpAll.approved.txt @@ -309,6 +309,26 @@ Logging: Set the Syslog type used to format the sent message. Possible values are: rfc5424, rfc3164. Default: rfc5424. Available only when Syslog is activated. +Telemetry (OpenTelemetry): + +--telemetry-endpoint + OpenTelemetry endpoint to connect to. Default: http://localhost:4317. + Available only when any of available OpenTelemetry components (Traces) is + turned on. +--telemetry-protocol + OpenTelemetry protocol used for the communication between server and + OpenTelemetry collector. Possible values are: grpc, http/protobuf. Default: + grpc. Available only when any of available OpenTelemetry components (Traces) + is turned on. +--telemetry-resource-attributes + OpenTelemetry resource attributes characterize the telemetry producer. Values + in format 'key1=val1,key2=val2'. Available only when any of available + OpenTelemetry components (Traces) is turned on. +--telemetry-service-name + OpenTelemetry service name. Takes precedence over 'service.name' defined in + the 'telemetry-resource-attributes' property. Default: keycloak. Available + only when any of available OpenTelemetry components (Traces) is turned on. + Tracing: --tracing-compression @@ -319,8 +339,9 @@ Tracing: Enables the OpenTelemetry tracing. Default: false. Available only when 'opentelemetry' feature is enabled. --tracing-endpoint - OpenTelemetry endpoint to connect to. Default: http://localhost:4317. - Available only when Tracing is enabled. + OpenTelemetry endpoint to connect to for traces. If not given, the value is + inherited from the 'telemetry-endpoint' option. Default: http://localhost: + 4317. Available only when Tracing is enabled. --tracing-header-
OpenTelemetry header that will be part of the exporter request (mainly useful for providing Authorization header). Check the documentation on how to set @@ -333,13 +354,18 @@ Tracing: Enables the OpenTelemetry JDBC tracing. Default: true. Available only when Tracing is enabled. --tracing-protocol - OpenTelemetry protocol used for the telemetry data. Possible values are: grpc, + OpenTelemetry protocol used for the telemetry data. If not given, the value is + inherited from the 'telemetry-protocol' option. Possible values are: grpc, http/protobuf. Default: grpc. Available only when Tracing is enabled. --tracing-resource-attributes - OpenTelemetry resource attributes present in the exported trace to + DEPRECATED. OpenTelemetry resource attributes present in the exported trace to characterize the telemetry producer. Values in format 'key1=val1,key2=val2'. - For more information, check the Tracing guide. Available only when Tracing - is enabled. + If not given, the value is inherited from the + 'telemetry-resource-attributes' option. For more information, check the + Tracing guide. Available only when Tracing is enabled. Resource attributes + are not directly related to Tracing and you should use the Telemetry option + which takes precedence. Use the following option instead: + telemetry-resource-attributes. --tracing-sampler-ratio OpenTelemetry sampler ratio. Probability that a span will be sampled. Expected double value in interval [0,1]. Default: 1.0. Available only when Tracing is @@ -350,9 +376,12 @@ Tracing: parentbased_traceidratio. Default: traceidratio. Available only when Tracing is enabled. --tracing-service-name - OpenTelemetry service name. Takes precedence over 'service.name' defined in - the 'tracing-resource-attributes' property. Default: keycloak. Available - only when Tracing is enabled. + DEPRECATED. OpenTelemetry service name. Takes precedence over 'service.name' + defined in the 'tracing-resource-attributes' property. If not given, the + value is inherited from the 'telemetry-service-name' option. Default: + keycloak. Available only when Tracing is enabled. Service name is not + directly related to Tracing and you should use the Telemetry option which + takes precedence. Use the following option instead: telemetry-service-name. Events: diff --git a/quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/dist/approvals/cli/help/HelpCommandDistTest.testStartDevHelpAll.approved.txt b/quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/dist/approvals/cli/help/HelpCommandDistTest.testStartDevHelpAll.approved.txt index f7215ae92ad..dc9842c42d8 100644 --- a/quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/dist/approvals/cli/help/HelpCommandDistTest.testStartDevHelpAll.approved.txt +++ b/quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/dist/approvals/cli/help/HelpCommandDistTest.testStartDevHelpAll.approved.txt @@ -636,6 +636,26 @@ Logging: Set the Syslog type used to format the sent message. Possible values are: rfc5424, rfc3164. Default: rfc5424. Available only when Syslog is activated. +Telemetry (OpenTelemetry): + +--telemetry-endpoint + OpenTelemetry endpoint to connect to. Default: http://localhost:4317. + Available only when any of available OpenTelemetry components (Traces) is + turned on. +--telemetry-protocol + OpenTelemetry protocol used for the communication between server and + OpenTelemetry collector. Possible values are: grpc, http/protobuf. Default: + grpc. Available only when any of available OpenTelemetry components (Traces) + is turned on. +--telemetry-resource-attributes + OpenTelemetry resource attributes characterize the telemetry producer. Values + in format 'key1=val1,key2=val2'. Available only when any of available + OpenTelemetry components (Traces) is turned on. +--telemetry-service-name + OpenTelemetry service name. Takes precedence over 'service.name' defined in + the 'telemetry-resource-attributes' property. Default: keycloak. Available + only when any of available OpenTelemetry components (Traces) is turned on. + Tracing: --tracing-compression @@ -646,8 +666,9 @@ Tracing: Enables the OpenTelemetry tracing. Default: false. Available only when 'opentelemetry' feature is enabled. --tracing-endpoint - OpenTelemetry endpoint to connect to. Default: http://localhost:4317. - Available only when Tracing is enabled. + OpenTelemetry endpoint to connect to for traces. If not given, the value is + inherited from the 'telemetry-endpoint' option. Default: http://localhost: + 4317. Available only when Tracing is enabled. --tracing-header-
OpenTelemetry header that will be part of the exporter request (mainly useful for providing Authorization header). Check the documentation on how to set @@ -660,13 +681,18 @@ Tracing: Enables the OpenTelemetry JDBC tracing. Default: true. Available only when Tracing is enabled. --tracing-protocol - OpenTelemetry protocol used for the telemetry data. Possible values are: grpc, + OpenTelemetry protocol used for the telemetry data. If not given, the value is + inherited from the 'telemetry-protocol' option. Possible values are: grpc, http/protobuf. Default: grpc. Available only when Tracing is enabled. --tracing-resource-attributes - OpenTelemetry resource attributes present in the exported trace to + DEPRECATED. OpenTelemetry resource attributes present in the exported trace to characterize the telemetry producer. Values in format 'key1=val1,key2=val2'. - For more information, check the Tracing guide. Available only when Tracing - is enabled. + If not given, the value is inherited from the + 'telemetry-resource-attributes' option. For more information, check the + Tracing guide. Available only when Tracing is enabled. Resource attributes + are not directly related to Tracing and you should use the Telemetry option + which takes precedence. Use the following option instead: + telemetry-resource-attributes. --tracing-sampler-ratio OpenTelemetry sampler ratio. Probability that a span will be sampled. Expected double value in interval [0,1]. Default: 1.0. Available only when Tracing is @@ -677,9 +703,12 @@ Tracing: parentbased_traceidratio. Default: traceidratio. Available only when Tracing is enabled. --tracing-service-name - OpenTelemetry service name. Takes precedence over 'service.name' defined in - the 'tracing-resource-attributes' property. Default: keycloak. Available - only when Tracing is enabled. + DEPRECATED. OpenTelemetry service name. Takes precedence over 'service.name' + defined in the 'tracing-resource-attributes' property. If not given, the + value is inherited from the 'telemetry-service-name' option. Default: + keycloak. Available only when Tracing is enabled. Service name is not + directly related to Tracing and you should use the Telemetry option which + takes precedence. Use the following option instead: telemetry-service-name. Events: diff --git a/quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/dist/approvals/cli/help/HelpCommandDistTest.testStartHelpAll.approved.txt b/quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/dist/approvals/cli/help/HelpCommandDistTest.testStartHelpAll.approved.txt index 64a0fbe80f7..02de71b5a3d 100644 --- a/quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/dist/approvals/cli/help/HelpCommandDistTest.testStartHelpAll.approved.txt +++ b/quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/dist/approvals/cli/help/HelpCommandDistTest.testStartHelpAll.approved.txt @@ -637,6 +637,26 @@ Logging: Set the Syslog type used to format the sent message. Possible values are: rfc5424, rfc3164. Default: rfc5424. Available only when Syslog is activated. +Telemetry (OpenTelemetry): + +--telemetry-endpoint + OpenTelemetry endpoint to connect to. Default: http://localhost:4317. + Available only when any of available OpenTelemetry components (Traces) is + turned on. +--telemetry-protocol + OpenTelemetry protocol used for the communication between server and + OpenTelemetry collector. Possible values are: grpc, http/protobuf. Default: + grpc. Available only when any of available OpenTelemetry components (Traces) + is turned on. +--telemetry-resource-attributes + OpenTelemetry resource attributes characterize the telemetry producer. Values + in format 'key1=val1,key2=val2'. Available only when any of available + OpenTelemetry components (Traces) is turned on. +--telemetry-service-name + OpenTelemetry service name. Takes precedence over 'service.name' defined in + the 'telemetry-resource-attributes' property. Default: keycloak. Available + only when any of available OpenTelemetry components (Traces) is turned on. + Tracing: --tracing-compression @@ -647,8 +667,9 @@ Tracing: Enables the OpenTelemetry tracing. Default: false. Available only when 'opentelemetry' feature is enabled. --tracing-endpoint - OpenTelemetry endpoint to connect to. Default: http://localhost:4317. - Available only when Tracing is enabled. + OpenTelemetry endpoint to connect to for traces. If not given, the value is + inherited from the 'telemetry-endpoint' option. Default: http://localhost: + 4317. Available only when Tracing is enabled. --tracing-header-
OpenTelemetry header that will be part of the exporter request (mainly useful for providing Authorization header). Check the documentation on how to set @@ -661,13 +682,18 @@ Tracing: Enables the OpenTelemetry JDBC tracing. Default: true. Available only when Tracing is enabled. --tracing-protocol - OpenTelemetry protocol used for the telemetry data. Possible values are: grpc, + OpenTelemetry protocol used for the telemetry data. If not given, the value is + inherited from the 'telemetry-protocol' option. Possible values are: grpc, http/protobuf. Default: grpc. Available only when Tracing is enabled. --tracing-resource-attributes - OpenTelemetry resource attributes present in the exported trace to + DEPRECATED. OpenTelemetry resource attributes present in the exported trace to characterize the telemetry producer. Values in format 'key1=val1,key2=val2'. - For more information, check the Tracing guide. Available only when Tracing - is enabled. + If not given, the value is inherited from the + 'telemetry-resource-attributes' option. For more information, check the + Tracing guide. Available only when Tracing is enabled. Resource attributes + are not directly related to Tracing and you should use the Telemetry option + which takes precedence. Use the following option instead: + telemetry-resource-attributes. --tracing-sampler-ratio OpenTelemetry sampler ratio. Probability that a span will be sampled. Expected double value in interval [0,1]. Default: 1.0. Available only when Tracing is @@ -678,9 +704,12 @@ Tracing: parentbased_traceidratio. Default: traceidratio. Available only when Tracing is enabled. --tracing-service-name - OpenTelemetry service name. Takes precedence over 'service.name' defined in - the 'tracing-resource-attributes' property. Default: keycloak. Available - only when Tracing is enabled. + DEPRECATED. OpenTelemetry service name. Takes precedence over 'service.name' + defined in the 'tracing-resource-attributes' property. If not given, the + value is inherited from the 'telemetry-service-name' option. Default: + keycloak. Available only when Tracing is enabled. Service name is not + directly related to Tracing and you should use the Telemetry option which + takes precedence. Use the following option instead: telemetry-service-name. Events: diff --git a/quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/dist/approvals/cli/help/HelpCommandDistTest.testStartOptimizedHelpAll.approved.txt b/quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/dist/approvals/cli/help/HelpCommandDistTest.testStartOptimizedHelpAll.approved.txt index 8bb275b6d4a..239819af9fe 100644 --- a/quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/dist/approvals/cli/help/HelpCommandDistTest.testStartOptimizedHelpAll.approved.txt +++ b/quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/dist/approvals/cli/help/HelpCommandDistTest.testStartOptimizedHelpAll.approved.txt @@ -563,6 +563,26 @@ Logging: Set the Syslog type used to format the sent message. Possible values are: rfc5424, rfc3164. Default: rfc5424. Available only when Syslog is activated. +Telemetry (OpenTelemetry): + +--telemetry-endpoint + OpenTelemetry endpoint to connect to. Default: http://localhost:4317. + Available only when any of available OpenTelemetry components (Traces) is + turned on. +--telemetry-protocol + OpenTelemetry protocol used for the communication between server and + OpenTelemetry collector. Possible values are: grpc, http/protobuf. Default: + grpc. Available only when any of available OpenTelemetry components (Traces) + is turned on. +--telemetry-resource-attributes + OpenTelemetry resource attributes characterize the telemetry producer. Values + in format 'key1=val1,key2=val2'. Available only when any of available + OpenTelemetry components (Traces) is turned on. +--telemetry-service-name + OpenTelemetry service name. Takes precedence over 'service.name' defined in + the 'telemetry-resource-attributes' property. Default: keycloak. Available + only when any of available OpenTelemetry components (Traces) is turned on. + Tracing: --tracing-compression @@ -570,8 +590,9 @@ Tracing: compression is disabled. Possible values are: gzip, none. Default: none. Available only when Tracing is enabled. --tracing-endpoint - OpenTelemetry endpoint to connect to. Default: http://localhost:4317. - Available only when Tracing is enabled. + OpenTelemetry endpoint to connect to for traces. If not given, the value is + inherited from the 'telemetry-endpoint' option. Default: http://localhost: + 4317. Available only when Tracing is enabled. --tracing-header-
OpenTelemetry header that will be part of the exporter request (mainly useful for providing Authorization header). Check the documentation on how to set @@ -581,21 +602,29 @@ Tracing: Enables the OpenTelemetry tracing for embedded Infinispan. Default: true. Available only when tracing and embedded Infinispan is enabled. --tracing-protocol - OpenTelemetry protocol used for the telemetry data. Possible values are: grpc, + OpenTelemetry protocol used for the telemetry data. If not given, the value is + inherited from the 'telemetry-protocol' option. Possible values are: grpc, http/protobuf. Default: grpc. Available only when Tracing is enabled. --tracing-resource-attributes - OpenTelemetry resource attributes present in the exported trace to + DEPRECATED. OpenTelemetry resource attributes present in the exported trace to characterize the telemetry producer. Values in format 'key1=val1,key2=val2'. - For more information, check the Tracing guide. Available only when Tracing - is enabled. + If not given, the value is inherited from the + 'telemetry-resource-attributes' option. For more information, check the + Tracing guide. Available only when Tracing is enabled. Resource attributes + are not directly related to Tracing and you should use the Telemetry option + which takes precedence. Use the following option instead: + telemetry-resource-attributes. --tracing-sampler-ratio OpenTelemetry sampler ratio. Probability that a span will be sampled. Expected double value in interval [0,1]. Default: 1.0. Available only when Tracing is enabled. --tracing-service-name - OpenTelemetry service name. Takes precedence over 'service.name' defined in - the 'tracing-resource-attributes' property. Default: keycloak. Available - only when Tracing is enabled. + DEPRECATED. OpenTelemetry service name. Takes precedence over 'service.name' + defined in the 'tracing-resource-attributes' property. If not given, the + value is inherited from the 'telemetry-service-name' option. Default: + keycloak. Available only when Tracing is enabled. Service name is not + directly related to Tracing and you should use the Telemetry option which + takes precedence. Use the following option instead: telemetry-service-name. Events: diff --git a/quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/dist/approvals/cli/help/HelpCommandDistTest.testUpdateCompatibilityCheckHelpAll.approved.txt b/quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/dist/approvals/cli/help/HelpCommandDistTest.testUpdateCompatibilityCheckHelpAll.approved.txt index b43e9bab26d..f6229b70625 100644 --- a/quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/dist/approvals/cli/help/HelpCommandDistTest.testUpdateCompatibilityCheckHelpAll.approved.txt +++ b/quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/dist/approvals/cli/help/HelpCommandDistTest.testUpdateCompatibilityCheckHelpAll.approved.txt @@ -636,6 +636,26 @@ Logging: Set the Syslog type used to format the sent message. Possible values are: rfc5424, rfc3164. Default: rfc5424. Available only when Syslog is activated. +Telemetry (OpenTelemetry): + +--telemetry-endpoint + OpenTelemetry endpoint to connect to. Default: http://localhost:4317. + Available only when any of available OpenTelemetry components (Traces) is + turned on. +--telemetry-protocol + OpenTelemetry protocol used for the communication between server and + OpenTelemetry collector. Possible values are: grpc, http/protobuf. Default: + grpc. Available only when any of available OpenTelemetry components (Traces) + is turned on. +--telemetry-resource-attributes + OpenTelemetry resource attributes characterize the telemetry producer. Values + in format 'key1=val1,key2=val2'. Available only when any of available + OpenTelemetry components (Traces) is turned on. +--telemetry-service-name + OpenTelemetry service name. Takes precedence over 'service.name' defined in + the 'telemetry-resource-attributes' property. Default: keycloak. Available + only when any of available OpenTelemetry components (Traces) is turned on. + Tracing: --tracing-compression @@ -646,8 +666,9 @@ Tracing: Enables the OpenTelemetry tracing. Default: false. Available only when 'opentelemetry' feature is enabled. --tracing-endpoint - OpenTelemetry endpoint to connect to. Default: http://localhost:4317. - Available only when Tracing is enabled. + OpenTelemetry endpoint to connect to for traces. If not given, the value is + inherited from the 'telemetry-endpoint' option. Default: http://localhost: + 4317. Available only when Tracing is enabled. --tracing-header-
OpenTelemetry header that will be part of the exporter request (mainly useful for providing Authorization header). Check the documentation on how to set @@ -660,13 +681,18 @@ Tracing: Enables the OpenTelemetry JDBC tracing. Default: true. Available only when Tracing is enabled. --tracing-protocol - OpenTelemetry protocol used for the telemetry data. Possible values are: grpc, + OpenTelemetry protocol used for the telemetry data. If not given, the value is + inherited from the 'telemetry-protocol' option. Possible values are: grpc, http/protobuf. Default: grpc. Available only when Tracing is enabled. --tracing-resource-attributes - OpenTelemetry resource attributes present in the exported trace to + DEPRECATED. OpenTelemetry resource attributes present in the exported trace to characterize the telemetry producer. Values in format 'key1=val1,key2=val2'. - For more information, check the Tracing guide. Available only when Tracing - is enabled. + If not given, the value is inherited from the + 'telemetry-resource-attributes' option. For more information, check the + Tracing guide. Available only when Tracing is enabled. Resource attributes + are not directly related to Tracing and you should use the Telemetry option + which takes precedence. Use the following option instead: + telemetry-resource-attributes. --tracing-sampler-ratio OpenTelemetry sampler ratio. Probability that a span will be sampled. Expected double value in interval [0,1]. Default: 1.0. Available only when Tracing is @@ -677,9 +703,12 @@ Tracing: parentbased_traceidratio. Default: traceidratio. Available only when Tracing is enabled. --tracing-service-name - OpenTelemetry service name. Takes precedence over 'service.name' defined in - the 'tracing-resource-attributes' property. Default: keycloak. Available - only when Tracing is enabled. + DEPRECATED. OpenTelemetry service name. Takes precedence over 'service.name' + defined in the 'tracing-resource-attributes' property. If not given, the + value is inherited from the 'telemetry-service-name' option. Default: + keycloak. Available only when Tracing is enabled. Service name is not + directly related to Tracing and you should use the Telemetry option which + takes precedence. Use the following option instead: telemetry-service-name. Events: diff --git a/quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/dist/approvals/cli/help/HelpCommandDistTest.testUpdateCompatibilityMetadataHelpAll.approved.txt b/quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/dist/approvals/cli/help/HelpCommandDistTest.testUpdateCompatibilityMetadataHelpAll.approved.txt index 0db6342d53a..b72405826d2 100644 --- a/quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/dist/approvals/cli/help/HelpCommandDistTest.testUpdateCompatibilityMetadataHelpAll.approved.txt +++ b/quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/dist/approvals/cli/help/HelpCommandDistTest.testUpdateCompatibilityMetadataHelpAll.approved.txt @@ -634,6 +634,26 @@ Logging: Set the Syslog type used to format the sent message. Possible values are: rfc5424, rfc3164. Default: rfc5424. Available only when Syslog is activated. +Telemetry (OpenTelemetry): + +--telemetry-endpoint + OpenTelemetry endpoint to connect to. Default: http://localhost:4317. + Available only when any of available OpenTelemetry components (Traces) is + turned on. +--telemetry-protocol + OpenTelemetry protocol used for the communication between server and + OpenTelemetry collector. Possible values are: grpc, http/protobuf. Default: + grpc. Available only when any of available OpenTelemetry components (Traces) + is turned on. +--telemetry-resource-attributes + OpenTelemetry resource attributes characterize the telemetry producer. Values + in format 'key1=val1,key2=val2'. Available only when any of available + OpenTelemetry components (Traces) is turned on. +--telemetry-service-name + OpenTelemetry service name. Takes precedence over 'service.name' defined in + the 'telemetry-resource-attributes' property. Default: keycloak. Available + only when any of available OpenTelemetry components (Traces) is turned on. + Tracing: --tracing-compression @@ -644,8 +664,9 @@ Tracing: Enables the OpenTelemetry tracing. Default: false. Available only when 'opentelemetry' feature is enabled. --tracing-endpoint - OpenTelemetry endpoint to connect to. Default: http://localhost:4317. - Available only when Tracing is enabled. + OpenTelemetry endpoint to connect to for traces. If not given, the value is + inherited from the 'telemetry-endpoint' option. Default: http://localhost: + 4317. Available only when Tracing is enabled. --tracing-header-
OpenTelemetry header that will be part of the exporter request (mainly useful for providing Authorization header). Check the documentation on how to set @@ -658,13 +679,18 @@ Tracing: Enables the OpenTelemetry JDBC tracing. Default: true. Available only when Tracing is enabled. --tracing-protocol - OpenTelemetry protocol used for the telemetry data. Possible values are: grpc, + OpenTelemetry protocol used for the telemetry data. If not given, the value is + inherited from the 'telemetry-protocol' option. Possible values are: grpc, http/protobuf. Default: grpc. Available only when Tracing is enabled. --tracing-resource-attributes - OpenTelemetry resource attributes present in the exported trace to + DEPRECATED. OpenTelemetry resource attributes present in the exported trace to characterize the telemetry producer. Values in format 'key1=val1,key2=val2'. - For more information, check the Tracing guide. Available only when Tracing - is enabled. + If not given, the value is inherited from the + 'telemetry-resource-attributes' option. For more information, check the + Tracing guide. Available only when Tracing is enabled. Resource attributes + are not directly related to Tracing and you should use the Telemetry option + which takes precedence. Use the following option instead: + telemetry-resource-attributes. --tracing-sampler-ratio OpenTelemetry sampler ratio. Probability that a span will be sampled. Expected double value in interval [0,1]. Default: 1.0. Available only when Tracing is @@ -675,9 +701,12 @@ Tracing: parentbased_traceidratio. Default: traceidratio. Available only when Tracing is enabled. --tracing-service-name - OpenTelemetry service name. Takes precedence over 'service.name' defined in - the 'tracing-resource-attributes' property. Default: keycloak. Available - only when Tracing is enabled. + DEPRECATED. OpenTelemetry service name. Takes precedence over 'service.name' + defined in the 'tracing-resource-attributes' property. If not given, the + value is inherited from the 'telemetry-service-name' option. Default: + keycloak. Available only when Tracing is enabled. Service name is not + directly related to Tracing and you should use the Telemetry option which + takes precedence. Use the following option instead: telemetry-service-name. Events: