10.2. Configure tracing at cache level
Once the tracing is configured at server level, it will be automatically enabled by default for all caches. A cache configuration level of tracing allows on the other hand to enable or disable it at cache level and at runtime.
Tracing categories
Several categories are potentially traced:
- Container. That are all the main cache operations, such as replace, put, clear, getForReplace, remove operations and size. With the exception of all the getting operation.
- Cluster. Operations that are replicated to another node in the same cluster.
- X-Site. Operations that are replicated to another external site.
- Persistence. All the operations involving persistence via a cache store and/or cache loader.
Each of category can be enabled/disabled at start time or runtime listing them in the categories list attribute. By default only the container category is enabled.
There is also the Security category, to trace security audit events. This category is configured globally, not only at cache level, since their events can have different scopes (cache, container or server), not only cache scope.
Enable/disable tracing for a given cache
XML
<replicated-cache>
<tracing enabled="true" categories="container cluster x-site persistence" />
</replicated-cache>
JSON
{
"distributed-cache": {
"tracing": {
"enabled" : true,
"categories": [
"container",
"cluster",
"x-site",
"persistence"
]
}
}
}
YAML
distributedCache:
tracing:
enabled: true
categories:
- "container"
- "cluster"
- "x-site"
- "persistence"
Enable/disable tracing at runtime
The cache-level tracing attribute enable is a mutable attribute, it means it can be changed at runtime without the need to restart the Infinispan cluster.
To change a mutable attribute both HotRod and REST APIs can be used.
HotRod
remoteCacheManager.administration()
.updateConfigurationAttribute(CACHE_A, "tracing.enabled", "false");
REST
restClient.cache(CACHE_A)
.updateConfigurationAttribute("tracing.enabled", "false");