Пример #1
0
 /// <summary>
 /// Constructs UngroupedBatcher.
 /// </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)
 {
     this.exporter = exporter ?? throw new ArgumentNullException(nameof(exporter));
     // TODO make this thread safe.
     this.metrics             = new List <Metric>();
     this.aggregationInterval = aggregationInterval;
     this.cts    = new CancellationTokenSource();
     this.worker = Task.Factory.StartNew(
         s => this.Worker((CancellationToken)s), this.cts.Token).ContinueWith((task) => Console.WriteLine("error"), TaskContinuationOptions.OnlyOnFaulted);
 }
Пример #2
0
 public PushMetricController(
     Dictionary <MeterRegistryKey, MeterSdk> meters,
     MetricProcessor metricProcessor,
     MetricExporter metricExporter,
     TimeSpan pushInterval,
     CancellationTokenSource cts)
 {
     this.meters          = meters;
     this.metricProcessor = metricProcessor;
     this.metricExporter  = metricExporter;
     this.pushInterval    = pushInterval;
     this.worker          = Task.Factory.StartNew(
         s => this.Worker((CancellationToken)s), cts.Token);
 }
Пример #3
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))
 {
 }
Пример #4
0
 /// <summary>
 /// Constructs aggregating processor.
 /// </summary>
 /// <param name="metricName">Name of metric.</param>
 /// <param name="exporter">Metric exporter instance.</param>
 public AggregatingMetricProcessor(string metricName, MetricExporter <T> exporter)
 {
     this.metric   = new Metric <T>(metricName);
     this.exporter = exporter ?? throw new ArgumentNullException(nameof(exporter));
 }