Skip to content

Commit 1f60c94

Browse files
authored
JAVA-2930: Allow Micrometer to record histograms for timers (#1542)
1 parent ef56d56 commit 1f60c94

File tree

12 files changed

+552
-111
lines changed

12 files changed

+552
-111
lines changed

changelog/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
### 4.11.0 (in progress)
66

7+
- [improvement] JAVA-2930: Allow Micrometer to record histograms for timers
78
- [improvement] JAVA-2914: Transform node filter into a more flexible node distance evaluator
89
- [improvement] JAVA-2929: Revisit node-level metric eviction
910
- [new feature] JAVA-2830: Add mapper support for Java streams

core/src/main/java/com/datastax/dse/driver/api/core/config/DseDriverOption.java

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,47 @@ public enum DseDriverOption implements DriverOption {
247247
* <p>Value-type: {@link java.time.Duration Duration}
248248
*/
249249
METRICS_NODE_GRAPH_MESSAGES_INTERVAL("advanced.metrics.node.graph-messages.refresh-interval"),
250+
251+
/**
252+
* The shortest latency that we expect to record for continuous requests.
253+
*
254+
* <p>Value-type: {@link java.time.Duration Duration}
255+
*/
256+
CONTINUOUS_PAGING_METRICS_SESSION_CQL_REQUESTS_LOWEST(
257+
"advanced.metrics.session.continuous-cql-requests.lowest-latency"),
258+
/**
259+
* Optional service-level objectives to meet, as a list of latencies to track.
260+
*
261+
* <p>Value-type: {@link java.time.Duration Duration}
262+
*/
263+
CONTINUOUS_PAGING_METRICS_SESSION_CQL_REQUESTS_SLO(
264+
"advanced.metrics.session.continuous-cql-requests.slo"),
265+
266+
/**
267+
* The shortest latency that we expect to record for graph requests.
268+
*
269+
* <p>Value-type: {@link java.time.Duration Duration}
270+
*/
271+
METRICS_SESSION_GRAPH_REQUESTS_LOWEST("advanced.metrics.session.graph-requests.lowest-latency"),
272+
/**
273+
* Optional service-level objectives to meet, as a list of latencies to track.
274+
*
275+
* <p>Value-type: {@link java.time.Duration Duration}
276+
*/
277+
METRICS_SESSION_GRAPH_REQUESTS_SLO("advanced.metrics.session.graph-requests.slo"),
278+
279+
/**
280+
* The shortest latency that we expect to record for graph requests.
281+
*
282+
* <p>Value-type: {@link java.time.Duration Duration}
283+
*/
284+
METRICS_NODE_GRAPH_MESSAGES_LOWEST("advanced.metrics.node.graph-messages.lowest-latency"),
285+
/**
286+
* Optional service-level objectives to meet, as a list of latencies to track.
287+
*
288+
* <p>Value-type: {@link java.time.Duration Duration}
289+
*/
290+
METRICS_NODE_GRAPH_MESSAGES_SLO("advanced.metrics.node.graph-messages.slo"),
250291
;
251292

252293
private final String path;

core/src/main/java/com/datastax/oss/driver/api/core/config/DefaultDriverOption.java

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -863,6 +863,45 @@ public enum DefaultDriverOption implements DriverOption {
863863
* <p>Value-Type: {@link String}
864864
*/
865865
LOAD_BALANCING_DISTANCE_EVALUATOR_CLASS("basic.load-balancing-policy.evaluator.class"),
866+
867+
/**
868+
* The shortest latency that we expect to record for requests.
869+
*
870+
* <p>Value-type: {@link java.time.Duration Duration}
871+
*/
872+
METRICS_SESSION_CQL_REQUESTS_LOWEST("advanced.metrics.session.cql-requests.lowest-latency"),
873+
/**
874+
* Optional service-level objectives to meet, as a list of latencies to track.
875+
*
876+
* <p>Value-type: List of {@link java.time.Duration Duration}
877+
*/
878+
METRICS_SESSION_CQL_REQUESTS_SLO("advanced.metrics.session.cql-requests.slo"),
879+
880+
/**
881+
* The shortest latency that we expect to record for throttling.
882+
*
883+
* <p>Value-type: {@link java.time.Duration Duration}
884+
*/
885+
METRICS_SESSION_THROTTLING_LOWEST("advanced.metrics.session.throttling.delay.lowest-latency"),
886+
/**
887+
* Optional service-level objectives to meet, as a list of latencies to track.
888+
*
889+
* <p>Value-type: List of {@link java.time.Duration Duration}
890+
*/
891+
METRICS_SESSION_THROTTLING_SLO("advanced.metrics.session.throttling.delay.slo"),
892+
893+
/**
894+
* The shortest latency that we expect to record for requests.
895+
*
896+
* <p>Value-type: {@link java.time.Duration Duration}
897+
*/
898+
METRICS_NODE_CQL_MESSAGES_LOWEST("advanced.metrics.node.cql-messages.lowest-latency"),
899+
/**
900+
* Optional service-level objectives to meet, as a list of latencies to track.
901+
*
902+
* <p>Value-type: List of {@link java.time.Duration Duration}
903+
*/
904+
METRICS_NODE_CQL_MESSAGES_SLO("advanced.metrics.node.cql-messages.slo"),
866905
;
867906

868907
private final String path;

core/src/main/java/com/datastax/oss/driver/api/core/config/OptionsMap.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -310,28 +310,36 @@ protected static void fillWithDriverDefaults(OptionsMap map) {
310310
map.put(TypedDriverOption.MONITOR_REPORTING_ENABLED, true);
311311
map.put(TypedDriverOption.METRICS_SESSION_ENABLED, Collections.emptyList());
312312
map.put(TypedDriverOption.METRICS_SESSION_CQL_REQUESTS_HIGHEST, Duration.ofSeconds(3));
313+
map.put(TypedDriverOption.METRICS_SESSION_CQL_REQUESTS_LOWEST, Duration.ofMillis(1));
313314
map.put(TypedDriverOption.METRICS_SESSION_CQL_REQUESTS_DIGITS, 3);
314315
map.put(TypedDriverOption.METRICS_SESSION_CQL_REQUESTS_INTERVAL, Duration.ofMinutes(5));
315316
map.put(TypedDriverOption.METRICS_SESSION_THROTTLING_HIGHEST, Duration.ofSeconds(3));
317+
map.put(TypedDriverOption.METRICS_SESSION_THROTTLING_LOWEST, Duration.ofMillis(1));
316318
map.put(TypedDriverOption.METRICS_SESSION_THROTTLING_DIGITS, 3);
317319
map.put(TypedDriverOption.METRICS_SESSION_THROTTLING_INTERVAL, Duration.ofMinutes(5));
318320
map.put(
319321
TypedDriverOption.CONTINUOUS_PAGING_METRICS_SESSION_CQL_REQUESTS_HIGHEST,
320322
Duration.ofMinutes(2));
323+
map.put(
324+
TypedDriverOption.CONTINUOUS_PAGING_METRICS_SESSION_CQL_REQUESTS_LOWEST,
325+
Duration.ofMillis(10));
321326
map.put(TypedDriverOption.CONTINUOUS_PAGING_METRICS_SESSION_CQL_REQUESTS_DIGITS, 3);
322327
map.put(
323328
TypedDriverOption.CONTINUOUS_PAGING_METRICS_SESSION_CQL_REQUESTS_INTERVAL,
324329
Duration.ofMinutes(5));
325330
map.put(TypedDriverOption.METRICS_FACTORY_CLASS, "DefaultMetricsFactory");
326331
map.put(TypedDriverOption.METRICS_ID_GENERATOR_CLASS, "DefaultMetricIdGenerator");
327332
map.put(TypedDriverOption.METRICS_SESSION_GRAPH_REQUESTS_HIGHEST, Duration.ofSeconds(12));
333+
map.put(TypedDriverOption.METRICS_SESSION_GRAPH_REQUESTS_LOWEST, Duration.ofMillis(1));
328334
map.put(TypedDriverOption.METRICS_SESSION_GRAPH_REQUESTS_DIGITS, 3);
329335
map.put(TypedDriverOption.METRICS_SESSION_GRAPH_REQUESTS_INTERVAL, Duration.ofMinutes(5));
330336
map.put(TypedDriverOption.METRICS_NODE_ENABLED, Collections.emptyList());
331337
map.put(TypedDriverOption.METRICS_NODE_CQL_MESSAGES_HIGHEST, Duration.ofSeconds(3));
338+
map.put(TypedDriverOption.METRICS_NODE_CQL_MESSAGES_LOWEST, Duration.ofMillis(1));
332339
map.put(TypedDriverOption.METRICS_NODE_CQL_MESSAGES_DIGITS, 3);
333340
map.put(TypedDriverOption.METRICS_NODE_CQL_MESSAGES_INTERVAL, Duration.ofMinutes(5));
334341
map.put(TypedDriverOption.METRICS_NODE_GRAPH_MESSAGES_HIGHEST, Duration.ofSeconds(3));
342+
map.put(TypedDriverOption.METRICS_NODE_GRAPH_MESSAGES_LOWEST, Duration.ofMillis(1));
335343
map.put(TypedDriverOption.METRICS_NODE_GRAPH_MESSAGES_DIGITS, 3);
336344
map.put(TypedDriverOption.METRICS_NODE_GRAPH_MESSAGES_INTERVAL, Duration.ofMinutes(5));
337345
map.put(TypedDriverOption.METRICS_NODE_EXPIRE_AFTER, Duration.ofHours(1));

core/src/main/java/com/datastax/oss/driver/api/core/config/TypedDriverOption.java

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -363,6 +363,15 @@ public String toString() {
363363
public static final TypedDriverOption<Duration> METRICS_SESSION_CQL_REQUESTS_HIGHEST =
364364
new TypedDriverOption<>(
365365
DefaultDriverOption.METRICS_SESSION_CQL_REQUESTS_HIGHEST, GenericType.DURATION);
366+
/** The shortest latency that we expect to record for requests. */
367+
public static final TypedDriverOption<Duration> METRICS_SESSION_CQL_REQUESTS_LOWEST =
368+
new TypedDriverOption<>(
369+
DefaultDriverOption.METRICS_SESSION_CQL_REQUESTS_LOWEST, GenericType.DURATION);
370+
/** Optional service-level objectives to meet, as a list of latencies to track. */
371+
public static final TypedDriverOption<List<Duration>> METRICS_SESSION_CQL_REQUESTS_SLO =
372+
new TypedDriverOption<>(
373+
DefaultDriverOption.METRICS_SESSION_CQL_REQUESTS_SLO,
374+
GenericType.listOf(GenericType.DURATION));
366375
/**
367376
* The number of significant decimal digits to which internal structures will maintain for
368377
* requests.
@@ -378,6 +387,15 @@ public String toString() {
378387
public static final TypedDriverOption<Duration> METRICS_SESSION_THROTTLING_HIGHEST =
379388
new TypedDriverOption<>(
380389
DefaultDriverOption.METRICS_SESSION_THROTTLING_HIGHEST, GenericType.DURATION);
390+
/** The shortest latency that we expect to record for throttling. */
391+
public static final TypedDriverOption<Duration> METRICS_SESSION_THROTTLING_LOWEST =
392+
new TypedDriverOption<>(
393+
DefaultDriverOption.METRICS_SESSION_THROTTLING_LOWEST, GenericType.DURATION);
394+
/** Optional service-level objectives to meet, as a list of latencies to track. */
395+
public static final TypedDriverOption<List<Duration>> METRICS_SESSION_THROTTLING_SLO =
396+
new TypedDriverOption<>(
397+
DefaultDriverOption.METRICS_SESSION_THROTTLING_SLO,
398+
GenericType.listOf(GenericType.DURATION));
381399
/**
382400
* The number of significant decimal digits to which internal structures will maintain for
383401
* throttling.
@@ -393,6 +411,15 @@ public String toString() {
393411
public static final TypedDriverOption<Duration> METRICS_NODE_CQL_MESSAGES_HIGHEST =
394412
new TypedDriverOption<>(
395413
DefaultDriverOption.METRICS_NODE_CQL_MESSAGES_HIGHEST, GenericType.DURATION);
414+
/** The shortest latency that we expect to record for requests. */
415+
public static final TypedDriverOption<Duration> METRICS_NODE_CQL_MESSAGES_LOWEST =
416+
new TypedDriverOption<>(
417+
DefaultDriverOption.METRICS_NODE_CQL_MESSAGES_LOWEST, GenericType.DURATION);
418+
/** Optional service-level objectives to meet, as a list of latencies to track. */
419+
public static final TypedDriverOption<List<Duration>> METRICS_NODE_CQL_MESSAGES_SLO =
420+
new TypedDriverOption<>(
421+
DefaultDriverOption.METRICS_NODE_CQL_MESSAGES_SLO,
422+
GenericType.listOf(GenericType.DURATION));
396423
/**
397424
* The number of significant decimal digits to which internal structures will maintain for
398425
* requests.
@@ -621,6 +648,18 @@ public String toString() {
621648
new TypedDriverOption<>(
622649
DseDriverOption.CONTINUOUS_PAGING_METRICS_SESSION_CQL_REQUESTS_HIGHEST,
623650
GenericType.DURATION);
651+
/** The shortest latency that we expect to record for continuous requests. */
652+
public static final TypedDriverOption<Duration>
653+
CONTINUOUS_PAGING_METRICS_SESSION_CQL_REQUESTS_LOWEST =
654+
new TypedDriverOption<>(
655+
DseDriverOption.CONTINUOUS_PAGING_METRICS_SESSION_CQL_REQUESTS_LOWEST,
656+
GenericType.DURATION);
657+
/** Optional service-level objectives to meet, as a list of latencies to track. */
658+
public static final TypedDriverOption<List<Duration>>
659+
CONTINUOUS_PAGING_METRICS_SESSION_CQL_REQUESTS_SLO =
660+
new TypedDriverOption<>(
661+
DseDriverOption.CONTINUOUS_PAGING_METRICS_SESSION_CQL_REQUESTS_SLO,
662+
GenericType.listOf(GenericType.DURATION));
624663
/**
625664
* The number of significant decimal digits to which internal structures will maintain for
626665
* continuous requests.
@@ -686,6 +725,15 @@ public String toString() {
686725
public static final TypedDriverOption<Duration> METRICS_SESSION_GRAPH_REQUESTS_HIGHEST =
687726
new TypedDriverOption<>(
688727
DseDriverOption.METRICS_SESSION_GRAPH_REQUESTS_HIGHEST, GenericType.DURATION);
728+
/** The shortest latency that we expect to record for graph requests. */
729+
public static final TypedDriverOption<Duration> METRICS_SESSION_GRAPH_REQUESTS_LOWEST =
730+
new TypedDriverOption<>(
731+
DseDriverOption.METRICS_SESSION_GRAPH_REQUESTS_LOWEST, GenericType.DURATION);
732+
/** Optional service-level objectives to meet, as a list of latencies to track. */
733+
public static final TypedDriverOption<List<Duration>> METRICS_SESSION_GRAPH_REQUESTS_SLO =
734+
new TypedDriverOption<>(
735+
DseDriverOption.METRICS_SESSION_GRAPH_REQUESTS_SLO,
736+
GenericType.listOf(GenericType.DURATION));
689737
/**
690738
* The number of significant decimal digits to which internal structures will maintain for graph
691739
* requests.
@@ -701,6 +749,15 @@ public String toString() {
701749
public static final TypedDriverOption<Duration> METRICS_NODE_GRAPH_MESSAGES_HIGHEST =
702750
new TypedDriverOption<>(
703751
DseDriverOption.METRICS_NODE_GRAPH_MESSAGES_HIGHEST, GenericType.DURATION);
752+
/** The shortest latency that we expect to record for graph requests. */
753+
public static final TypedDriverOption<Duration> METRICS_NODE_GRAPH_MESSAGES_LOWEST =
754+
new TypedDriverOption<>(
755+
DseDriverOption.METRICS_NODE_GRAPH_MESSAGES_LOWEST, GenericType.DURATION);
756+
/** Optional service-level objectives to meet, as a list of latencies to track. */
757+
public static final TypedDriverOption<List<Duration>> METRICS_NODE_GRAPH_MESSAGES_SLO =
758+
new TypedDriverOption<>(
759+
DseDriverOption.METRICS_NODE_GRAPH_MESSAGES_SLO,
760+
GenericType.listOf(GenericType.DURATION));
704761
/**
705762
* The number of significant decimal digits to which internal structures will maintain for graph
706763
* requests.

0 commit comments

Comments
 (0)