Пример #1
0
        public void Begin()
        {
            _metricMultiplexer = new MetricsHandler <TData>(Metrics, MetricsPostProcess);
            _row = new FlexiRow <DimensionKey, MetricsHandler <TData> >(() => _metricMultiplexer.Create());

            _dimensionsKeyBuilder = new DimensionsHandler <TData>(Dimensions);
        }
Пример #2
0
        private void Output()
        {
            MetricsHandler <IResult> current = _metrics;

            _metrics = _metrics.Create();


            OutputAction(current.Export());
        }
Пример #3
0
        public void Begin()
        {
            _metrics = _metrics.Create();

            _timer           = new Timer(_interval.TotalMilliseconds);
            _timer.AutoReset = true;
            _timer.Elapsed  += (sender, args) => Output();

            _timer.Start();
        }
Пример #4
0
        /// <summary>
        /// Sets a <see cref="MetricsHandler"/> to receive Bond metrics.
        /// </summary>
        /// <param name="newHandler">The handler to add.</param>
        /// <exception cref="InvalidOperationException">
        /// Thrown when there is another handler registered.
        /// </exception>
        public static void SetHandler(MetricsHandler newHandler)
        {
            if (newHandler == null)
            {
                throw new ArgumentException($"Attempted to set a null {nameof(MetricsHandler)}");
            }

            if (handler != null)
            {
                throw new InvalidOperationException($"Attempted to set a {nameof(MetricsHandler)} when there already was one");
            }

            handler = newHandler;
        }
Пример #5
0
        public static void UseMetricsActuator(IConfiguration configuration, ILoggerFactory loggerFactory)
        {
            var options = new MetricsOptions(configuration);

            var hostObserver = new AspNetHostingObserver(options, OpenCensusStats.Instance, OpenCensusTags.Instance, CreateLogger <AspNetHostingObserver>(loggerFactory));
            var clrObserver  = new CLRRuntimeObserver(options, OpenCensusStats.Instance, OpenCensusTags.Instance, CreateLogger <CLRRuntimeObserver>(loggerFactory));

            DiagnosticsManager.Instance.Observers.Add((IDiagnosticObserver)hostObserver);
            DiagnosticsManager.Instance.Observers.Add((IDiagnosticObserver)clrObserver);

            var clrSource = new CLRRuntimeSource();

            DiagnosticsManager.Instance.Sources.Add(clrSource);
            var ep      = new MetricsEndpoint(options, OpenCensusStats.Instance, CreateLogger <MetricsEndpoint>(loggerFactory));
            var handler = new MetricsHandler(ep, SecurityService, CreateLogger <MetricsHandler>(loggerFactory));

            ConfiguredHandlers.Add(handler);
        }
Пример #6
0
 /// <summary>
 /// Removes the existing <see cref="MetricsHandler"/>.
 /// </summary>
 /// <remarks>
 /// May be called even if there is no existing handler.
 /// </remarks>
 public static void RemoveHandler()
 {
     handler = null;
 }
Пример #7
0
 public KpiPrinterAggregator(TimeSpan interval, params IMetric <IResult>[] metrics)
 {
     _metrics  = new MetricsHandler <IResult>(metrics);
     _interval = interval;
 }