@@ -490,44 +490,95 @@ object TraceConfig {
490
490
491
491
/** Metrics configuration
492
492
*
493
+ * @param factory
494
+ * Metrics Factory configuration.
495
+ * @param idGenerator
496
+ * This section configures how metric ids are generated. A metric id is a unique combination of a metric name and metric tags.
493
497
* @param session
494
498
* The session-level metrics (all disabled by default).
495
499
* @param node
496
500
* The node-level metrics (all disabled by default).
497
501
*/
498
- final case class MetricsConfig (session : Option [SessionConfig ], node : Option [NodeConfig ])
502
+ final case class MetricsConfig (
503
+ factory : Option [MetricsFactoryConfig ],
504
+ idGenerator : Option [IdGeneratorConfig ],
505
+ session : Option [SessionConfig ],
506
+ node : Option [NodeConfig ]
507
+ )
499
508
500
509
object MetricsConfig {
501
- val Default : MetricsConfig = MetricsConfig (None , None )
510
+ val Default : MetricsConfig = MetricsConfig (None , None , None , None )
502
511
}
503
512
513
+ /** Metrics Factory configuration.
514
+ *
515
+ * @param `class`
516
+ * The class for the metrics factory.
517
+ *
518
+ * Note: specifying a metrics factory is not enough to enable metrics; for the driver to actually start collecting metrics, you also need
519
+ * to specify which metrics to collect. See the following options for more information:
520
+ * - advanced.metrics.session.enabled
521
+ * - advanced.metrics.node.enabled
522
+ */
523
+ final case class MetricsFactoryConfig (`class` : String = " DefaultMetricsFactory" )
524
+
525
+ /** Metric ID generator configuration.
526
+ *
527
+ * The driver ships with two built-in implementations:
528
+ * - DefaultMetricIdGenerator: generates identifiers composed solely of (unique) metric names; It is mostly suitable for use with metrics
529
+ * libraries that do not support tags, like Dropwizard.
530
+ * - TaggingMetricIdGenerator: generates identifiers composed of name and tags. It is mostly suitable for use with metrics libraries that
531
+ * support tags, like Micrometer or MicroProfile Metrics.
532
+ *
533
+ * @param `class`
534
+ * The class name of a component implementing `MetricIdGenerator`. If it is not qualified, the driver assumes that it resides in the
535
+ * `package com.datastax.oss.driver.internal.core.metrics`.
536
+ * @param prefix
537
+ * An optional prefix to prepend to each generated metric name. The prefix should not start nor end with a dot or any other path
538
+ * separator; the following are two valid examples: "cassandra" or "myapp.prod.cassandra".
539
+ */
540
+ final case class IdGeneratorConfig (`class` : String = " DefaultMetricIdGenerator" , prefix : Option [String ] = None )
541
+
504
542
/** The session-level metrics (all disabled by default).
505
543
*
506
544
* @param enabled
507
545
* The session-level metrics (all disabled by default).
508
546
* @param cqlRequests
509
547
* Extra configuration (for the metrics that need it). Required if the 'cql-requests' metric is enabled
510
548
* @param throttling
511
- * Configures request throttling metrics..
549
+ * Configures request throttling metrics.
550
+ * @param continuousCqlRequests
551
+ * Required: if the 'continuous-cql-requests' metric is enabled, and Dropwizard or Micrometer is used.
552
+ * @param graphRequests
553
+ * Required: if the 'graph-requests' metric is enabled, and Dropwizard or Micrometer is used.
512
554
*/
513
555
final case class SessionConfig (
514
- enabled : List [Int ] = List .empty,
556
+ enabled : List [String ] = List .empty,
515
557
cqlRequests : Option [CqlRequestsConfig ],
516
- throttling : Option [ThrottlingConfig ]
558
+ throttling : Option [ThrottlingConfig ],
559
+ continuousCqlRequests : Option [ContinuousCqlRequests ],
560
+ graphRequests : Option [GraphRequests ]
517
561
)
518
562
519
563
/** Extra metrics configuration
520
564
*
521
565
* @param highestLatency
522
- * The largest latency that we expect to record.
566
+ * The largest latency that we expect to record.\
567
+ * @param lowestLatency
568
+ * The lowest latency that we expect to record.
523
569
* @param significantDigits
524
570
* The number of significant decimal digits to which internal structures will maintain value resolution and separation (for example, 3
525
571
* means that recordings up to 1 second will be recorded with a resolution of 1 millisecond or better). This must be between 0 and 5. If
526
572
* the value is out of range, it defaults to 3 and a warning is logged.
527
573
* @param refreshInterval
528
574
* The interval at which percentile data is refreshed.
529
575
*/
530
- final case class CqlRequestsConfig (highestLatency : Duration = 3 .seconds, significantDigits : Int = 3 , refreshInterval : Duration = 5 .minutes)
576
+ final case class CqlRequestsConfig (
577
+ highestLatency : Duration = 3 .seconds,
578
+ lowestLatency : Duration = 1 .millisecond,
579
+ significantDigits : Int = 3 ,
580
+ refreshInterval : Duration = 5 .minutes
581
+ )
531
582
532
583
/** How long requests are being throttled
533
584
*
@@ -538,18 +589,59 @@ final case class CqlRequestsConfig(highestLatency: Duration = 3.seconds, signifi
538
589
final case class ThrottlingConfig (delay : Option [DelayConfig ])
539
590
540
591
/** Throttling delay metric. */
541
- final case class DelayConfig (highestLatency : Duration = 3 .seconds, significantDigits : Int = 3 , refreshInterval : Duration = 5 .minutes)
592
+ final case class DelayConfig (
593
+ highestLatency : Duration = 3 .seconds,
594
+ lowestLatency : Duration = 1 .millisecond,
595
+ significantDigits : Int = 3 ,
596
+ refreshInterval : Duration = 5 .minutes
597
+ )
598
+
599
+ final case class ContinuousCqlRequests (
600
+ highestLatency : Duration = 120 .seconds,
601
+ lowestLatency : Duration = 10 .millisecond,
602
+ significantDigits : Int = 3 ,
603
+ refreshInterval : Duration = 5 .minutes
604
+ )
605
+
606
+ final case class GraphRequests (
607
+ highestLatency : Duration = 12 .seconds,
608
+ lowestLatency : Duration = 1 .millisecond,
609
+ significantDigits : Int = 3 ,
610
+ refreshInterval : Duration = 5 .minutes
611
+ )
542
612
543
613
/** Node-level metric.
544
614
*
545
615
* @param enabled
546
616
* node-level metrics
547
- * @param cqlRequests
617
+ * @param cqlMessages
548
618
* Required: if the 'cql-messages' metric is enabled
549
- */
550
- final case class NodeConfig (enabled : List [Int ], cqlRequests : Option [CqlMessagesConfig ])
619
+ * @param graphMessages
620
+ * Required: if the 'graph-messages' metric is enabled, and Dropwizard or Micrometer is used.
621
+ * @param expireAfter
622
+ * The time after which the node level metrics will be evicted. The lowest allowed value is 5 minutes. If you try to set it lower, the
623
+ * driver will log a warning and use 5 minutes.
624
+ */
625
+ final case class NodeConfig (
626
+ enabled : List [String ],
627
+ cqlMessages : Option [CqlMessagesConfig ],
628
+ graphMessages : Option [GraphMessagesConfig ],
629
+ expireAfter : Duration = 1 .hour
630
+ )
551
631
552
- final case class CqlMessagesConfig (highestLatency : Duration = 3 .seconds, significantDigits : Int = 3 , refreshInterval : Duration = 5 .minutes)
632
+ final case class CqlMessagesConfig (
633
+ highestLatency : Duration = 3 .seconds,
634
+ lowestLatency : Duration = 1 .millisecond,
635
+ significantDigits : Int = 3 ,
636
+ refreshInterval : Duration = 5 .minutes
637
+ )
638
+
639
+ final case class GraphMessagesConfig (
640
+ highestLatency : Duration = 3 .seconds,
641
+ lowestLatency : Duration = 1 .millisecond,
642
+ significantDigits : Int = 3 ,
643
+ refreshInterval : Duration = 5 .minutes
644
+ )
553
645
554
646
/** Socket configuration.
555
647
*
0 commit comments