Пример #1
0
        private static IEnumerable <(GraphiteMetricName name, GraphiteValue value)> GetMeterItemsToSend(this MeterValue value, GraphiteMetricName name)
        {
            var rateUnit = value.RateUnit;

            name = name.WithRate(rateUnit);
            yield return(name.WithFolder("Rate-Mean"), value.MeanRate.ToGraphiteValue());

            yield return(name.WithFolder("Rate-1-min"), value.OneMinuteRate.ToGraphiteValue());

            yield return(name.WithFolder("Rate-5-min"), value.FiveMinuteRate.ToGraphiteValue());

            yield return(name.WithFolder("Rate-15-min"), value.FifteenMinuteRate.ToGraphiteValue());
        }
Пример #2
0
        public static IEnumerable <(GraphiteMetricName name, GraphiteValue value)> GetTimerItemsToSend(this TimerValueSource valueSource)
        {
            var name  = valueSource.ToGraphiteName(MetricType.Timer);
            var value = valueSource.Value;

            var durationUnit = valueSource.DurationUnit;

            yield return(name.WithFolder("Count"), value.Rate.Count.ToGraphiteValue());

            yield return(name.WithFolder("Active_Sessions"), value.ActiveSessions.ToGraphiteValue());

            foreach (var item in value.Rate.GetMeterItemsToSend(name))
            {
                yield return(item);
            }

            name = name.WithUnit(durationUnit.Unit());

            yield return(name.WithFolder("Duration-Last"), value.Histogram.LastValue.ToGraphiteValue());

            yield return(name.WithFolder("Duration-Min"), value.Histogram.Min.ToGraphiteValue());

            yield return(name.WithFolder("Duration-Mean"), value.Histogram.Mean.ToGraphiteValue());

            yield return(name.WithFolder("Duration-Max"), value.Histogram.Max.ToGraphiteValue());

            yield return(name.WithFolder("Duration-StdDev"), value.Histogram.StdDev.ToGraphiteValue());

            yield return(name.WithFolder("Duration-Median"), value.Histogram.Median.ToGraphiteValue());

            yield return(name.WithFolder("Duration-p75"), value.Histogram.Percentile75.ToGraphiteValue());

            yield return(name.WithFolder("Duration-p95"), value.Histogram.Percentile95.ToGraphiteValue());

            yield return(name.WithFolder("Duration-p98"), value.Histogram.Percentile98.ToGraphiteValue());

            yield return(name.WithFolder("Duration-p99"), value.Histogram.Percentile99.ToGraphiteValue());

            yield return(name.WithFolder("Duration-p999"), value.Histogram.Percentile999.ToGraphiteValue());
        }
Пример #3
0
 public static GraphiteMetricName ToGraphiteName <T>(this MetricValueSourceBase <T> valueSource, MetricType type) => GraphiteMetricName.From(type, valueSource.Unit).WithFolder(valueSource.Name);
Пример #4
0
 private void Send(string context, MetricTags tags, GraphiteMetricName name, GraphiteValue value)
 {
     _graphiteSender.Send(_metricNameFormatter.Format(context, tags, name), value.ToString());
 }