Ejemplo n.º 1
0
        public static void RecordClientRequestRate(this IMetrics metrics, string routeTemplate, string clientId)
        {
            var tags = new MetricTags(new[] { Constants.DefaultTagKeys.ClientId, Constants.DefaultTagKeys.Route }, new[] { clientId, routeTemplate });

            metrics.Measure.Meter.Mark(OAuthRequestMetricsRegistry.Meters.RequestRate, tags);
        }
Ejemplo n.º 2
0
        private static ITimer EndpointRequestTimer(this IMetrics metrics, string routeTemplate)
        {
            var tags = new MetricTags(Constants.DefaultTagKeys.Route, routeTemplate);

            return(metrics.Provider.Timer.Instance(HttpRequestMetricsRegistry.Timers.EndpointRequestTransactionDuration, tags));
        }
Ejemplo n.º 3
0
        /// <summary>
        ///     Records a metric for the size of a HTTP PUT requests.
        /// </summary>
        /// <param name="metrics">The metrics.</param>
        /// <param name="value">The value.</param>
        /// <param name="clientId">The OAuth2 client identifier to tag the histogram values.</param>
        /// <param name="routeTemplate">The route template of the endpoint.</param>
        public static void UpdateClientPutRequestSize(this IMetrics metrics, long value, string clientId, string routeTemplate)
        {
            var tags = new MetricTags(new[] { Constants.DefaultTagKeys.ClientId, Constants.DefaultTagKeys.Route }, new[] { clientId, routeTemplate });

            metrics.Measure.Histogram.Update(OAuthRequestMetricsRegistry.Histograms.PutRequestSizeHistogram, tags, value);
        }
Ejemplo n.º 4
0
        private static void CountOverallErrorRequestsByHttpStatusCode(IMetrics metrics, int httpStatusCode)
        {
            var errorCounterTags = new MetricTags(Constants.DefaultTagKeys.HttpStatusCode, httpStatusCode.ToString());

            metrics.Measure.Counter.Increment(HttpRequestMetricsRegistry.Counters.TotalErrorRequestCount, errorCounterTags);
        }
Ejemplo n.º 5
0
        /// <summary>
        ///     Records a metric for the size of a HTTP PUT requests.
        /// </summary>
        /// <param name="metrics">The metrics.</param>
        /// <param name="bucketHistogramOptions">The bucket histogram options</param>
        /// <param name="value">The value.</param>
        /// <param name="clientId">The OAuth2 client identifier to tag the histogram values.</param>
        /// <param name="routeTemplate">The route template of the endpoint.</param>
        public static void UpdateClientPutRequestSize(this IMetrics metrics, BucketHistogramOptions bucketHistogramOptions, long value, string clientId, string routeTemplate)
        {
            var tags = new MetricTags(new[] { MiddlewareConstants.DefaultTagKeys.ClientId, MiddlewareConstants.DefaultTagKeys.Route }, new[] { clientId, routeTemplate });

            metrics.Measure.BucketHistogram.Update(bucketHistogramOptions, tags, value);
        }