/// <summary>
        /// Histogram represents an aggregated counter on the stream of values. It can calculate min, mean, max and stdDeviation.
        /// </summary>
        /// <param name="telemetryClient">Telemetry client to associate the meter with.</param>
        /// <param name="name">Name of the histogram.</param>
        /// <param name="aggregations">Types of aggregations to perform.</param>
        /// <returns>Returns a histogram implementation.</returns>
        public static IHistogram Histogram(this TelemetryClient telemetryClient, string name, HistogramAggregations aggregations = HistogramAggregations.Mean | HistogramAggregations.MinMax)
        {
            var histogram = new HistogramImplementation(name, telemetryClient.Context, aggregations);

            var configuration = GetConfigurationFromClient(telemetryClient);
            configuration.RegisterCounter(histogram);

            return histogram;
        }
 public HistogramImplementation(string name, TelemetryContext context, HistogramAggregations aggregations)
     : base(name, context)
 {
     this.shouldCalculateMinMax = (aggregations & HistogramAggregations.MinMax) == HistogramAggregations.MinMax;
 }
Ejemplo n.º 3
0
        /// <summary>
        /// Histogram represents an aggregated counter on the stream of values. It can calculate min, mean, max and stdDeviation.
        /// </summary>
        /// <param name="telemetryClient">Telemetry client to associate the meter with.</param>
        /// <param name="name">Name of the histogram.</param>
        /// <param name="aggregations">Types of aggregations to perform.</param>
        /// <returns>Returns a histogram implementation.</returns>
        public static IHistogram Histogram(this TelemetryClient telemetryClient, string name, HistogramAggregations aggregations = HistogramAggregations.Mean | HistogramAggregations.MinMax)
        {
            var histogram = new HistogramImplementation(name, telemetryClient.Context, aggregations);

            var configuration = GetConfigurationFromClient(telemetryClient);

            configuration.RegisterCounter(histogram);

            return(histogram);
        }