OpenTelemetry Tracing

What You Will Learn

How to enable OpenTelemetry tracing on an Infinispan cache at runtime and send cache operations that produce traces viewable in Jaeger.

Prerequisites

  • Java 17+

  • An Infinispan Server running with OpenTelemetry configured (use the provided docker-compose setup in this module, which starts both Infinispan and Jaeger)

Step 1: Connect to Infinispan

Use the standard Hot Rod client to connect:

      ConfigurationBuilder builder = TutorialsConnectorHelper.connectionConfig();

      try (RemoteCacheManager client = TutorialsConnectorHelper.connect(builder)) {
         RemoteCache<String, String> cache = client.getCache(TUTORIAL_CACHE_NAME);

Step 2: Enable Tracing at Runtime

Enable tracing on the cache by updating its configuration attribute:

         // Enabled tracing at runtime by changing the configuration.
         client.administration()
                 .updateConfigurationAttribute(cache.getName(), "tracing.enabled", "true");

This enables tracing dynamically without restarting the server.

Step 3: Perform Cache Operations

Execute cache operations that will generate traces:

         for (int i = 0; i < 300; i++) {
            cache.put("i" + i, i + "");
         }

Step 4: View Traces in Jaeger

Open the Jaeger UI (typically at http://localhost:16686) and select the Infinispan service to view the traces generated by the cache operations.

Step 5: Run the Tutorial

mvn package exec:java

What’s Next