From b8538a95c74b3e30b31b88c35059f914f9535c45 Mon Sep 17 00:00:00 2001 From: Katia Aresti Date: Mon, 10 Jun 2024 17:28:39 +0200 Subject: [PATCH] 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; /**