4

Infinispan 14 OpenTelemetry tracing integration

 1 year ago
source link: https://infinispan.org/blog/2022/07/18/infinispan-14-opentelemetry-tracing
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Blogs Infinispan 14 OpenTelemetry tracing integration

Infinispan 14 OpenTelemetry tracing integration

fax4ever.jpg

By Fabio Massimo Ercoli

Dear Infinispan community,

With the Infinispan 14 development release 04, we started to support tracing with OpenTelemetry.

If configured, Infinispan Server produces cache events tracing spans and sends them to a remote tracing collector server, such as Jaeger or Zipkin.

Moreover, if a Java client application with the HotRot or the Rest client produces some tracing spans, these spans can be correlated as parent spans of the corresponding spans events produced by the Infinispan Server.

Set up tracing on Infinispan Server

The new version of Infinispan Server comes with a gRPC OpenTelemetry Protocol (OTLP) Exporter, which is now supported by the majority of tracing servers.

For instance, with the newer Jaeger server versions, you can enable data collection through the OTLP protocol with the following option:

The server opens a port to import gRPC OTLP tracing data at port 4317.

Configure tracing on the Infinispan Server by setting system properties or environment variables:

The first property is Infinispan specific and enables the tracing capability of the Infinispan Server. The further properties belong to the OpenTelemetry SDK Autoconfigure project that Infinispan uses to configure the tracing exporter. In this case, OTLP gRPC Exporter protocol is used and the server runs on the same machine as the Infinispan Server.

Starting the server with these parameters:

The following log is produced when the server starts:

This indicates that the OpenTelemetrySdk is correctly configured.

Tracing from a HotRod client application

Any OpenTelemetry tracing context present on HotRot client applications will be automatically propagated by the new Hot Rod v4 client to the server tracing context.

For instance, for a client that defines some tracing spans containing cache operations, such as the following:

The client span sub-bulk-1 will be correlated to any related server spans, in this case the three put operations.

Opening the Jaeger console, we can see that client and server spans are correctly aggregated:

Tracing output

You can find a complete application example here: https://github.com/fax4ever/infinispan-play/tree/main/tracing-hotrod-client

Tracing from a REST client application

You can achieve the same with a REST client by putting manually in the HTTP headers the requests to provide information about the current tracing context using a standard OpenTelemetry instance of W3CTraceContextPropagator.

Opening the Jaeger console, you can see that client and server spans are correctly aggregated:

Tracing output

You can find a complete application example here: https://github.com/fax4ever/infinispan-play/tree/main/tracing-rest-client

Get it, Use it, Ask us!

We’re hard at work on new features, improvements and fixes, so watch this space for more announcements!

Please, download and test the latest release.

The source code is hosted on GitHub. If you need to report a bug or request a new feature, look for a similar one on our JIRA issues tracker. If you don’t find any, create a new issue.

If you have questions, are experiencing a bug or want advice on using Infinispan, you can use StackOverflow. We will do our best to answer you as soon as we can.

The Infinispan community uses Zulip for real-time communications. Join us using either a web-browser or a dedicated application on the Infinispan chat.

fax4ever.jpg
Fabio Massimo Ercoli

Member of the Infinispan @core team at Red Hat. Accountable for indexing, query, serialization, transcoding, metrics and tracing for the hybrid cloud. Former Hibernate @core team, working on NoSql & searching. Former Red Hat consultant, working on intense data applications and solutions. An open source enthusiast and continuous learner.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK