示例#1
0
        /// <summary>
        /// Casts the provided timer to the timer implementation of this provider.
        /// </summary>
        /// <exception cref="ArgumentException">If the timer was not created by the AppMetrics
        /// provider (<see cref="CreateDriverMetricsProvider(App.Metrics.IMetricsRoot)"/>).</exception>
        public static IAppMetricsTimer ToAppMetricsTimer(this IDriverTimer timer)
        {
            MetricsExtensions.ThrowIfNull(timer, nameof(timer));

            if (timer is IAppMetricsTimer appMetricsTimer)
            {
                return(appMetricsTimer);
            }

            throw new ArgumentException("Timer was not created by the AppMetricsDriverProvider, " +
                                        $"it's type is {timer.GetType().Name} and doesn't implement IAppMetricsTimer.");
        }
 public MetricsOperationObserver(INodeMetrics nodeMetrics, bool enabledNodeTimerMetrics)
 {
     _enabledNodeTimerMetrics = enabledNodeTimerMetrics;
     _operationTimer          = nodeMetrics.CqlMessages;
 }
示例#3
0
 public MetricsRequestObserver(IMetricsManager manager, IDriverTimer requestTimer)
 {
     _manager      = manager;
     _requestTimer = requestTimer;
 }