private static void AddTotalRequestsTelemetry(long numberOfRequests, IHttpRequestTelemetry requestTelemetry)
        {
            var dataPoint = new HttpRequestTelemetryDataPoint {
                MetricName  = "Total Requests",
                Description = "Total number of requests the server has processed",
                Value       = numberOfRequests.ToString()
            };

            requestTelemetry.AddDataPoint(dataPoint);
        }
        private static void AddMinEncounteredTelemetry(long minResponseSizeEncountered, IHttpRequestTelemetry requestTelemetry)
        {
            var dataPoint = new HttpRequestTelemetryDataPoint {
                MetricName  = "Minimum Response Body Size",
                Description = "Min size of response body out of all requests encountered so far",
                Unit        = "bytes",
                Value       = minResponseSizeEncountered.ToString(CultureInfo.InvariantCulture)
            };

            requestTelemetry.AddDataPoint(dataPoint);
        }
        private static void AddMaxEncounteredTelemetry(long maxResponseSizeEncountered, IHttpRequestTelemetry requestTelemetry)
        {
            var dataPoint = new HttpRequestTelemetryDataPoint {
                MetricName  = "Maximum Response Body Size",
                Description = "Max size of response body out of all requests encountered so far",
                Unit        = "bytes",
                Value       = maxResponseSizeEncountered.ToString()
            };

            requestTelemetry.AddDataPoint(dataPoint);
        }
        private static void AddCurrentRequestResponseSizeTelemetry(long responseInformationResponseBodySizeInBytes, IHttpRequestTelemetry requestTelemetry)
        {
            var dataPoint = new HttpRequestTelemetryDataPoint {
                MetricName  = "Response Body Size",
                Description = "Size of response body for this request",
                Unit        = "bytes",
                Value       = responseInformationResponseBodySizeInBytes.ToString()
            };

            requestTelemetry.AddDataPoint(dataPoint);
        }
        private static void AddAverageResponseSizeTelemetry(long totalData, long totalRequests, IHttpRequestTelemetry requestTelemetry)
        {
            var dataPoint = new HttpRequestTelemetryDataPoint {
                MetricName  = "Average Response Body Size",
                Description = "Average size of response body for all requests so far",
                Unit        = "bytes",
                Value       = Math.Floor((double)totalData / totalRequests).ToString(CultureInfo.InvariantCulture)
            };

            requestTelemetry.AddDataPoint(dataPoint);
        }
        public void CollectResponseTelemetry(IHttpRequestInformation requestInformation,
                                             IHttpResponseInformation responseInformation,
                                             IHttpRequestTelemetry requestTelemetry)
        {
            var dataPoint = new HttpRequestTelemetryDataPoint
            {
                MetricName  = "Total Processing Time",
                Description = "Total time server spent processing the http request, in milliseconds",
                Unit        = "ms",
                Value       = (DateTime.Now - requestInformation.RequestStartTime).Milliseconds.ToString()
            };

            requestTelemetry.AddDataPoint(dataPoint);
        }
        public void CollectResponseTelemetry(IHttpRequestInformation requestInformation,
                                             IHttpResponseInformation responseInformation,
                                             IHttpRequestTelemetry requestTelemetry)
        {
            var dataPoint = new HttpRequestTelemetryDataPoint
            {
                MetricName  = "Telemetry Processing Overhead Time",
                Description = "Total time the agent spent processing telemetry, in milliseconds",
                Unit        = "ms",
                Value       =
                    requestInformation.TelemetryProcessingOverheadTime.TotalMilliseconds.ToString(CultureInfo
                                                                                                  .InvariantCulture)
            };

            requestTelemetry.AddDataPoint(dataPoint);
        }