@@ -490,44 +490,95 @@ object TraceConfig {
490490
491491/** Metrics configuration
492492 *
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.
493497 * @param session
494498 * The session-level metrics (all disabled by default).
495499 * @param node
496500 * The node-level metrics (all disabled by default).
497501 */
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+ )
499508
500509object MetricsConfig {
501- val Default : MetricsConfig = MetricsConfig (None , None )
510+ val Default : MetricsConfig = MetricsConfig (None , None , None , None )
502511}
503512
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+
504542/** The session-level metrics (all disabled by default).
505543 *
506544 * @param enabled
507545 * The session-level metrics (all disabled by default).
508546 * @param cqlRequests
509547 * Extra configuration (for the metrics that need it). Required if the 'cql-requests' metric is enabled
510548 * @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.
512554 */
513555final case class SessionConfig (
514- enabled : List [Int ] = List .empty,
556+ enabled : List [String ] = List .empty,
515557 cqlRequests : Option [CqlRequestsConfig ],
516- throttling : Option [ThrottlingConfig ]
558+ throttling : Option [ThrottlingConfig ],
559+ continuousCqlRequests : Option [ContinuousCqlRequests ],
560+ graphRequests : Option [GraphRequests ]
517561)
518562
519563/** Extra metrics configuration
520564 *
521565 * @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.
523569 * @param significantDigits
524570 * The number of significant decimal digits to which internal structures will maintain value resolution and separation (for example, 3
525571 * 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
526572 * the value is out of range, it defaults to 3 and a warning is logged.
527573 * @param refreshInterval
528574 * The interval at which percentile data is refreshed.
529575 */
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+ )
531582
532583/** How long requests are being throttled
533584 *
@@ -538,18 +589,59 @@ final case class CqlRequestsConfig(highestLatency: Duration = 3.seconds, signifi
538589final case class ThrottlingConfig (delay : Option [DelayConfig ])
539590
540591/** 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+ )
542612
543613/** Node-level metric.
544614 *
545615 * @param enabled
546616 * node-level metrics
547- * @param cqlRequests
617+ * @param cqlMessages
548618 * 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+ )
551631
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+ )
553645
554646/** Socket configuration.
555647 *
0 commit comments