/// <summary> /// Initializes a new instance of the <see cref="AdaptiveSamplingTelemetryProcessor"/> class. /// <param name="settings">Sampling percentage estimator settings.</param> /// <param name="callback">Callback invoked every time sampling percentage is evaluated.</param> /// <param name="next">Next TelemetryProcessor in call chain.</param> /// </summary> public AdaptiveSamplingTelemetryProcessor( SamplingPercentageEstimatorSettings settings, AdaptiveSamplingPercentageEvaluatedCallback callback, ITelemetryProcessor next) { this.estimatorSettings = settings; this.evaluationCallback = callback; // make estimatortelemetry processor work after sampling was done this.estimatorProcessor = new SamplingPercentageEstimatorTelemetryProcessor(settings, this.SamplingPercentageChanged, next); this.samplingProcessor = new SamplingTelemetryProcessor(this.estimatorProcessor); }
/// <summary> /// Disposes the object. /// </summary> /// <param name="disposing">True if disposing.</param> protected virtual void Dispose(bool disposing) { if (disposing) { if (this.estimatorProcessor != null) { this.estimatorProcessor.Dispose(); this.estimatorProcessor = null; } } }