Example #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="UngroupedBatcher"/> class.
        /// </summary>
        /// <param name="exporter">Metric exporter instance.</param>
        /// <param name="aggregationInterval">Interval at which metrics are pushed to Exporter.</param>
        public UngroupedBatcher(MetricExporter exporter, TimeSpan aggregationInterval)
        {
            _exporter = exporter ?? throw new ArgumentNullException(nameof(exporter));

            // TODO make this thread safe.
            _longMetrics         = new List <Metric <long> >();
            _doubleMetrics       = new List <Metric <double> >();
            _aggregationInterval = aggregationInterval;
            _cts    = new CancellationTokenSource();
            _worker = Task.Factory.StartNew(
                s => Worker((CancellationToken)s), _cts.Token).ContinueWith((task) => Console.WriteLine("error"), TaskContinuationOptions.OnlyOnFaulted);
        }
Example #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="UngroupedBatcher"/> class.
 /// </summary>
 /// <param name="exporter">Metric exporter instance.</param>
 public UngroupedBatcher(MetricExporter exporter)
     : this(exporter, TimeSpan.FromSeconds(5))
 {
 }