From b8538a95c74b3e30b31b88c35059f914f9535c45 Mon Sep 17 00:00:00 2001 From: Katia Aresti Date: Mon, 10 Jun 2024 17:28:39 +0200 Subject: [PATCH 1/2] Clean up tracing option from dev services for 15.0 --- .../asciidoc/infinispan-dev-services.adoc | 60 +++++++++++++++++-- .../InfinispanDevServiceProcessor.java | 20 +++++-- .../runtime/InfinispanDevServicesConfig.java | 2 + 3 files changed, 72 insertions(+), 10 deletions(-) diff --git a/docs/src/main/asciidoc/infinispan-dev-services.adoc b/docs/src/main/asciidoc/infinispan-dev-services.adoc index 96c601bfcca76..01d1e179fd862 100644 --- a/docs/src/main/asciidoc/infinispan-dev-services.adoc +++ b/docs/src/main/asciidoc/infinispan-dev-services.adoc @@ -118,12 +118,62 @@ quarkus.infinispan-client.conn-2.devservices.enabled=true == Tracing with OpenTelemetry -Infinispan supports instrumentation of the server via OpenTelemetry. Enable tracing setting `quarkus.infinispan-client.devservices.tracing.enabled` to true. -The default otlp exporter endpoint is `http://localhost:4317`. -If you are running Jaeger in a container as explained in the xref:opentelemetry.adoc[OpenTelemetry guide], since the containers -are running in the default network, Infinispan container won't have access to localhost. -You need to get the IP running the following command and configure the `quarkus.infinispan-client.devservices.tracing.exporter.otlp.endpoint` property. +Infinispan supports server tracing using OpenTelemetry. Starting from Infinispan 15.0, you need +to configure tracing in the server's settings. +To enable this in Dev Services, you need to add extra settings to the running server using the +`quarkus.infinispan-client.devservices.config-files` property. +[source, yaml] +---- +infinispan: + cacheContainer: + tracing: + collector-endpoint: "http://jaeger:4318" <1> + enabled: true <2> + exporter-protocol: "OTLP" <3> + service-name: "infinispan-server" <4> + security: false <5> +---- +<1> Collector endpoint. Assuming a container service name 'jaeger' is running. +<2> Enables tracing +<3> Exporter protocol. OLTP is the OpenTelemetry protocol. +<4> The service name that will be registered in the tracing collector, Jaeger in this case +<5> Enables 'security' category tracing + +See below the equivalent in XML and JSON. + +[source, xml] +---- + + + + + +---- + +[source, json] +---- +{ + "infinispan" : { + "cache-container" : { + "statistics" : true, + "tracing" : { + "collector-endpoint" : "http://jaeger:4318", + "enabled" : true, + "exporter-protocol" : "OTLP", + "service-name" : "infinispan-server", + "security" : false + } + } + } +} +---- + +You need name the Jaeger service or get the IP running the following command and configure the exporter endpoint. [source,bash] ---- docker inspect -f '{{range.NetworkSettings.Networks}}{{.IPAddress}}{{end}}' jaeger diff --git a/extensions/infinispan-client/deployment/src/main/java/io/quarkus/infinispan/client/deployment/devservices/InfinispanDevServiceProcessor.java b/extensions/infinispan-client/deployment/src/main/java/io/quarkus/infinispan/client/deployment/devservices/InfinispanDevServiceProcessor.java index ae49676cb305f..0b9d5212cf86f 100644 --- a/extensions/infinispan-client/deployment/src/main/java/io/quarkus/infinispan/client/deployment/devservices/InfinispanDevServiceProcessor.java +++ b/extensions/infinispan-client/deployment/src/main/java/io/quarkus/infinispan/client/deployment/devservices/InfinispanDevServiceProcessor.java @@ -283,14 +283,24 @@ public QuarkusInfinispanContainer(String clientName, InfinispanDevServicesConfig return " -c " + userConfigFile; }).collect(Collectors.joining())).orElse(""); + if (config.tracing.isPresent()) { + log.warn( + "Starting with Infinispan 15.0, Infinispan support for instrumentation of the server via OpenTelemetry has evolved. Enabling tracing setting `quarkus.infinispan-client.devservices.tracing.enabled` to true won't work.\n" + + + "You need to use the `quarkus.infinispan-client.devservices.tracing.enabled` property and provide a JSON, XML or YAML file as follows. Check xref:infinispan-dev-services.adoc[Infinispan Dev Services guide]"); + log.warn("infinispan:\n" + + " cacheContainer:\n" + + " tracing:\n" + + " collector-endpoint: \"http://jaeger:4318\"\n" + + " enabled: true\n" + + " exporter-protocol: \"OTLP\"\n" + + " service-name: \"infinispan-server\"\n" + + " security: false"); + } + if (config.mcastPort.isPresent()) { command = command + " -Djgroups.mcast_port=" + config.mcastPort.getAsInt(); } - if (config.tracing.isPresent()) { - command = command + " -Dinfinispan.tracing.enabled=" + config.tracing.get(); - command = command + " -Dotel.exporter.otlp.endpoint=" + config.exporterOtlpEndpoint.get(); - command = command + " -Dotel.service.name=infinispan-server-service -Dotel.metrics.exporter=none"; - } config.artifacts.ifPresent(a -> withArtifacts(a.toArray(new String[0]))); diff --git a/extensions/infinispan-client/runtime/src/main/java/io/quarkus/infinispan/client/runtime/InfinispanDevServicesConfig.java b/extensions/infinispan-client/runtime/src/main/java/io/quarkus/infinispan/client/runtime/InfinispanDevServicesConfig.java index e4368b0126886..1a2a55c4a637e 100644 --- a/extensions/infinispan-client/runtime/src/main/java/io/quarkus/infinispan/client/runtime/InfinispanDevServicesConfig.java +++ b/extensions/infinispan-client/runtime/src/main/java/io/quarkus/infinispan/client/runtime/InfinispanDevServicesConfig.java @@ -113,12 +113,14 @@ public class InfinispanDevServicesConfig { * Runs the Infinispan Server container with tracing enabled. Traces are disabled by default */ @ConfigItem(name = "tracing.enabled", defaultValue = "false") + @Deprecated(forRemoval = true) public Optional tracing; /** * Sets Infinispan Server otlp endpoint. Default value is http://localhost:4317 */ @ConfigItem(name = "tracing.exporter.otlp.endpoint", defaultValue = "http://localhost:4317") + @Deprecated(forRemoval = true) public Optional exporterOtlpEndpoint; /** From 26860093b5fb79edccf0c6ed10bd23d50810f435 Mon Sep 17 00:00:00 2001 From: Guillaume Smet Date: Tue, 11 Jun 2024 16:12:29 +0200 Subject: [PATCH 2/2] Minor adjustments to doc and warning --- docs/src/main/asciidoc/infinispan-dev-services.adoc | 13 +++++++------ .../devservices/InfinispanDevServiceProcessor.java | 12 ++++++------ 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/docs/src/main/asciidoc/infinispan-dev-services.adoc b/docs/src/main/asciidoc/infinispan-dev-services.adoc index 01d1e179fd862..975799b4079f5 100644 --- a/docs/src/main/asciidoc/infinispan-dev-services.adoc +++ b/docs/src/main/asciidoc/infinispan-dev-services.adoc @@ -120,7 +120,7 @@ quarkus.infinispan-client.conn-2.devservices.enabled=true Infinispan supports server tracing using OpenTelemetry. Starting from Infinispan 15.0, you need to configure tracing in the server's settings. -To enable this in Dev Services, you need to add extra settings to the running server using the +To enable tracing in Dev Services, you need to add extra settings using the `quarkus.infinispan-client.devservices.config-files` property. [source, yaml] @@ -135,10 +135,10 @@ infinispan: security: false <5> ---- <1> Collector endpoint. Assuming a container service name 'jaeger' is running. -<2> Enables tracing +<2> Enables tracing. <3> Exporter protocol. OLTP is the OpenTelemetry protocol. -<4> The service name that will be registered in the tracing collector, Jaeger in this case -<5> Enables 'security' category tracing +<4> The service name that will be registered in the tracing collector, Jaeger in this case. +<5> Enables 'security' category tracing. See below the equivalent in XML and JSON. @@ -173,7 +173,8 @@ See below the equivalent in XML and JSON. } ---- -You need name the Jaeger service or get the IP running the following command and configure the exporter endpoint. +You need to name the Jaeger service or get the IP running the following command to configure the exporter endpoint. + [source,bash] ---- docker inspect -f '{{range.NetworkSettings.Networks}}{{.IPAddress}}{{end}}' jaeger @@ -205,4 +206,4 @@ It looks for a container with the same value, or starts a new one if none can be The default service name is `infinispan`. Sharing is enabled by default in dev mode, but disabled in test mode. -You can disable the sharing with `quarkus.infinispan-client.devservices.shared=false` \ No newline at end of file +You can disable the sharing with `quarkus.infinispan-client.devservices.shared=false` diff --git a/extensions/infinispan-client/deployment/src/main/java/io/quarkus/infinispan/client/deployment/devservices/InfinispanDevServiceProcessor.java b/extensions/infinispan-client/deployment/src/main/java/io/quarkus/infinispan/client/deployment/devservices/InfinispanDevServiceProcessor.java index 0b9d5212cf86f..91d451d6e1fc0 100644 --- a/extensions/infinispan-client/deployment/src/main/java/io/quarkus/infinispan/client/deployment/devservices/InfinispanDevServiceProcessor.java +++ b/extensions/infinispan-client/deployment/src/main/java/io/quarkus/infinispan/client/deployment/devservices/InfinispanDevServiceProcessor.java @@ -200,11 +200,11 @@ private RunningDevService startContainer(String clientName, DockerStatusBuildIte if (!dockerStatusBuildItem.isDockerAvailable()) { log.warn( - "Please configure 'quarkus.infinispan-client.hosts' or 'quarkus.infinispan-client.uri' or get a working docker instance"); + "Please configure 'quarkus.infinispan-client.hosts' or 'quarkus.infinispan-client.uri' or get a working Docker instance"); return null; } - log.infof("Starting Dev Service for connection %s", clientName); - log.infof("Apply Dev Services config %s", devServicesConfig); + log.infof("Starting Dev Services for connection %s", clientName); + log.infof("Applying Dev Services config %s", devServicesConfig); Supplier infinispanServerSupplier = () -> { QuarkusInfinispanContainer infinispanContainer = new QuarkusInfinispanContainer(clientName, devServicesConfig, @@ -283,11 +283,11 @@ public QuarkusInfinispanContainer(String clientName, InfinispanDevServicesConfig return " -c " + userConfigFile; }).collect(Collectors.joining())).orElse(""); - if (config.tracing.isPresent()) { + if (config.tracing.orElse(false)) { log.warn( - "Starting with Infinispan 15.0, Infinispan support for instrumentation of the server via OpenTelemetry has evolved. Enabling tracing setting `quarkus.infinispan-client.devservices.tracing.enabled` to true won't work.\n" + "Starting with Infinispan 15.0, Infinispan support for instrumentation of the server via OpenTelemetry has evolved. Enabling tracing by setting `quarkus.infinispan-client.devservices.tracing.enabled=true` doesn't work anymore.\n" + - "You need to use the `quarkus.infinispan-client.devservices.tracing.enabled` property and provide a JSON, XML or YAML file as follows. Check xref:infinispan-dev-services.adoc[Infinispan Dev Services guide]"); + "You need to use the `quarkus.infinispan-client.devservices.tracing.enabled` property and provide a JSON, XML or YAML file as follows. Check https://quarkus.io/guides/infinispan-dev-services for more information"); log.warn("infinispan:\n" + " cacheContainer:\n" + " tracing:\n" +