@@ -14,15 +14,34 @@ To give insight into a request/response flow, the SDK provides a `RequestTracer`
1414By default, the SDK will emit information about requests that are over a configurable threshold every 10 seconds.
1515Note that if no requests are over the threshold no event / log will be emitted.
1616
17- It is possible to customize this behavior by modifying the configuration:
17+ It is possible to customize this behavior by modifying the configuration.
18+ The recommended way to configure the environment is via a callback when connecting to the cluster:
1819
1920[source,java]
2021----
21- include::devguide:example$java/Tracing.java[tag=tracing-configure,indent=0]
22+ var cluster = Cluster.connect(
23+ connectionString,
24+ clusterOptions(username, password)
25+ .environment(env -> env
26+ .thresholdLoggingTracerConfig(config -> config
27+ .enabled(true) // it's enabled by default, so this line is not strictly necessary
28+ .emitInterval(Duration.ofMinutes(1))
29+ .kvThreshold(Duration.ofSeconds(2))
30+ )
31+ )
32+ );
2233----
2334
2435In this case the emit interval is one minute and Key/Value requests will only be considered if their latency is greater or equal than two seconds.
2536
37+ // Don't think we'll need to call this out explicitly, but it's here if we need to uncomment it:
38+ //
39+ // TIP:
40+ // Using the `ClusterOptions.environment()`, as in the above snippet, ensures that the SDK manages the environment --
41+ // shutting down after disconnecting from the cluster.
42+ // If you create your own `own ClusterEnvironent` or `ClusterEnvironment.Builder` then you will need to manage the environment yourself.
43+
44+
2645The JSON blob emitted looks similar to the following (prettified here for readability):
2746
2847[source,json]
0 commit comments