Skip to content

Commit

Permalink
Merge pull request quarkusio#41098 from karesti/tracing-option-wont-work
Browse files Browse the repository at this point in the history
Clean up tracing option from dev services for 15.0
  • Loading branch information
gsmet authored Jun 11, 2024
2 parents f6de420 + 2686009 commit 07063c1
Show file tree
Hide file tree
Showing 3 changed files with 77 additions and 14 deletions.
63 changes: 57 additions & 6 deletions docs/src/main/asciidoc/infinispan-dev-services.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -118,11 +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 tracing in Dev Services, you need to add extra settings 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]
----
<infinispan>
<cache-container statistics="true">
<tracing collector-endpoint="http://jaeger:4318"
enabled="true"
exporter-protocol="OTLP"
service-name="infinispan-server"
security="false" />
</cache-container>
</infinispan>
----

[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 to name the Jaeger service or get the IP running the following command to configure the exporter endpoint.

[source,bash]
----
Expand Down Expand Up @@ -155,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`
You can disable the sharing with `quarkus.infinispan-client.devservices.shared=false`
Original file line number Diff line number Diff line change
Expand Up @@ -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<RunningDevService> infinispanServerSupplier = () -> {
QuarkusInfinispanContainer infinispanContainer = new QuarkusInfinispanContainer(clientName, devServicesConfig,
Expand Down Expand Up @@ -283,14 +283,24 @@ public QuarkusInfinispanContainer(String clientName, InfinispanDevServicesConfig
return " -c " + userConfigFile;
}).collect(Collectors.joining())).orElse("");

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 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 https://quarkus.io/guides/infinispan-dev-services for more information");
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])));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<Boolean> 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<String> exporterOtlpEndpoint;

/**
Expand Down

0 comments on commit 07063c1

Please sign in to comment.