[id='configuring-tracing_{context}']
= Configuring {brandname} tracing

Configure OpenTelemetry tracing, to enable monitoring and tracing of cache operations.

.Procedure

. Open your {brandname} configuration for editing.
. Add the `tracing` element or object to the cache container.
. Define the endpoint URL of the OpenTelemetry collector with the `collector_endpoint` attribute or field. It is mandatory to enable tracing. `4318` is typically the `http/protobuf` OTLP standard port.
. Enable or disable tracing globally with the `enable` attribute or field.
. Enable or disable security event tracing with the `security` attribute or field.
. Optionally change the tracing exporter protocol changing the `exporter_protocol` attribute or field. By default, it is `otlp` (OpenTelemetry protocol).
. Optionally change the tracing service name associated with the generated tracing span changing the `service_name` attribute or field. By default, it is `infinispan-server`.
. Save and close your client configuration.

.Next steps
To apply any global tracing configuration changes, stop the server and repeat the procedure.

[discrete]
== Tracing configuration
{brandname} applies the tracing configuration globally to all caches.

.XML
[source,xml,options="nowrap",subs=attributes+,role="primary"]
----
include::xml/tracing_cache_container.xml[]
----

.JSON
[source,json,options="nowrap",subs=attributes+,role="secondary"]
----
include::json/tracing_cache_container.json[]
----

.YAML
[source,yaml,options="nowrap",subs=attributes+,role="secondary"]
----
include::yaml/tracing_cache_container.yaml[]
----

== Further Tracing Options

To configure further tracing options it is possible to pass system properties or to set environment variables to the {brandname} server at startup
to configure directly the link:https://github.com/open-telemetry/opentelemetry-java/blob/main/sdk-extensions/autoconfigure/README.md[OpenTelemetry SDK Autoconfigure]
that is used by the {brandname} server to configure the OpenTelemetry tracing.

.Procedure

* Pass the system properties to {brandname} Server at startup.
+
Use `-D<property-name>=<property-value>` arguments like in the following example:
+
[source,options="nowrap",subs=attributes+]
----
bin/server.sh -Dotel.exporter.otlp.timeout=10000
----

[role="_additional-resources"]
.Additional resources
* link:https://github.com/open-telemetry/opentelemetry-java/blob/main/sdk-extensions/autoconfigure/README.md[OpenTelemetry SDK Autoconfigure]

[discrete]
== Tracing data format
The {brandname} Server, by default, exports tracing data using the OTLP `http/protobuf` protocol.

.tracing.properties
[source,options="nowrap",subs=attributes+]
----
otel.exporter.otlp.protocol = http/protobuf
----

To use a different protocol, you must copy  JAR files or dependencies to the `$ISPN_HOME/server/lib` directory of your {brandname} Server installation.