コード例 #1
0
        public void Meter_can_use_custom_field_names()
        {
            // Arrange
            var          fieldValues = Enum.GetValues(typeof(MeterFields));
            const string customField = "custom";

            // Act
            foreach (MeterFields field in fieldValues)
            {
                // ignore set item fields
                if (field == MeterFields.SetItem || field == MeterFields.SetItemPercent)
                {
                    continue;
                }

                var data   = new Dictionary <string, object>();
                var value  = _meterValue();
                var fields = new MetricFields();
                fields.Meter[field] = customField;
                value.AddMeterValues(data, fields.Meter);

                // Assert
                data.ContainsKey(Fields.Meter[field]).Should().BeFalse($"{field} has been removed");
                data.ContainsKey(customField).Should().BeTrue($"{field} has been replaced with {customField}");
            }
        }
コード例 #2
0
        public void Histogram_can_use_custom_field_names_and_should_provide_corresponding_values()
        {
            // Arrange
            var value  = _histogramValue();
            var data   = new Dictionary <string, object>();
            var fields = new MetricFields();

            fields.Histogram.Set(HistogramFields.UserLastValue, "userLastValue");
            fields.Histogram.Set(HistogramFields.UserMinValue, "userMinValue");
            fields.Histogram.Set(HistogramFields.UserMaxValue, "userMaxValue");
            fields.Histogram.Set(HistogramFields.P75, "75th_percentile");

            // Act
            value.AddHistogramValues(data, fields.Histogram);

            // Assert
            data.ContainsKey(Fields.Histogram[HistogramFields.UserLastValue]).Should().BeFalse();
            data["userLastValue"].Should().Be("3");
            data.ContainsKey(Fields.Histogram[HistogramFields.UserMaxValue]).Should().BeFalse();
            data["userMaxValue"].Should().Be("5");
            data.ContainsKey(Fields.Histogram[HistogramFields.UserMinValue]).Should().BeFalse();
            data["userMinValue"].Should().Be("8");
            data.ContainsKey(Fields.Histogram[HistogramFields.P75]).Should().BeFalse();
            data["75th_percentile"].Should().Be(11.0);
        }
コード例 #3
0
        private async Task <string> Serialize(
            IEnumerable <MetricsDataValueSource> dataValueSource,
            double sampleRate = 1.0)
        {
            var settings = new MetricsStatsDOptions
            {
                DefaultSampleRate   = sampleRate,
                MetricNameFormatter = new DefaultDogStatsDMetricStringSerializer()
            };
            var serializer = new MetricSnapshotSerializer();
            var fields     = new MetricFields();

            await using (var ms = new MemoryStream())
            {
                await using (var packer =
                                 new MetricSnapshotStatsDStringWriter(
                                     ms,
                                     new StatsDPointSampler(settings),
                                     settings))
                {
                    foreach (var source in dataValueSource)
                    {
                        serializer.Serialize(packer, source, fields);
                    }
                }
                return(Encoding.UTF8.GetString(ms.ToArray()));
            }
        }
コード例 #4
0
        public void Meter_should_ignore_values_where_specified()
        {
            // Arrange
            var setItemFields = new[] { MeterFields.SetItem, MeterFields.SetItemPercent };
            var meterFields   = Enum.GetValues(typeof(MeterFields));

            // Act
            foreach (MeterFields field in meterFields)
            {
                if (field == MeterFields.SetItem || field == MeterFields.SetItemPercent)
                {
                    continue;
                }

                var data   = new Dictionary <string, object>();
                var value  = _meterValue();
                var fields = new MetricFields();
                fields.Meter.Remove(field);
                value.AddMeterValues(data, fields.Meter);

                // Assert
                data.Count.Should().Be(meterFields.Length - setItemFields.Length - 1);
                data.ContainsKey(Fields.Meter[field]).Should().BeFalse();
            }
        }
コード例 #5
0
 public MetricsStatsDStringOutputFormatter(
     MetricsStatsDOptions options,
     MetricFields metricFields)
 {
     _options     = options ?? throw new ArgumentNullException(nameof(options));
     MetricFields = metricFields ?? new MetricFields();
     _samplers    = new StatsDPointSampler(_options);
 }
コード例 #6
0
 public MetricsHostedMetricsJsonOutputFormatter(
     TimeSpan flushInterval,
     MetricsHostedMetricsOptions options,
     MetricFields metricFields)
 {
     _flushInterval = flushInterval;
     _options       = options ?? throw new ArgumentNullException(nameof(options));
     MetricFields   = metricFields;
 }
コード例 #7
0
 public MetricsStatsDStringOutputFormatter(
     MetricsStatsDOptions options,
     MetricFields metricFields)
 {
     _options     = options ?? throw new ArgumentNullException(nameof(options));
     MetricFields = metricFields ?? new MetricFields();
     _samplers    = new StatsDPointSampler(_options);
     _nullWriter  = new MetricSnapshotStatsDStringWriter(null, _samplers, _options);
     _serializer  = new MetricSnapshotSerializer();
 }
コード例 #8
0
        private static void BuildMetricPayload <TMetric>(
            string context,
            MetricValueSourceBase <TMetric> valueSource,
            IMetricSnapshotWriter writer,
            MetricFields fields,
            DateTime timestamp)
        {
            if (typeof(TMetric) == typeof(double))
            {
                BuildGaugePayload(context, valueSource as MetricValueSourceBase <double>, writer, fields.Gauge, timestamp);
                return;
            }

            if (typeof(TMetric) == typeof(CounterValue))
            {
                BuildCounterPayload(context, valueSource as MetricValueSourceBase <CounterValue>, writer, fields.Counter, timestamp);
                return;
            }

            if (typeof(TMetric) == typeof(MeterValue))
            {
                BuildMeterPayload(context, valueSource as MetricValueSourceBase <MeterValue>, writer, fields.Meter, timestamp);
                return;
            }

            if (typeof(TMetric) == typeof(TimerValue))
            {
                BuildTimerPayload(context, valueSource as MetricValueSourceBase <TimerValue>, writer, fields.Meter, fields.Histogram, timestamp);
                return;
            }

            if (typeof(TMetric) == typeof(BucketTimerValue))
            {
                BuildBucketTimerPayload(context, valueSource as MetricValueSourceBase <BucketTimerValue>, writer, fields.Histogram.ToDictionary(x => x.Key.ToString(), x => x.Value), timestamp);
                return;
            }

            if (typeof(TMetric) == typeof(HistogramValue))
            {
                BuildHistogramPayload(context, valueSource as MetricValueSourceBase <HistogramValue>, writer, fields.Histogram, timestamp);
                return;
            }

            if (typeof(TMetric) == typeof(BucketHistogramValue))
            {
                BuildBucketHistogramPayload(context, valueSource as MetricValueSourceBase <BucketHistogramValue>, writer, fields.BucketHistogram.ToDictionary(x => x.Key.ToString(), x => x.Value), timestamp);
                return;
            }

            if (typeof(TMetric) == typeof(ApdexValue))
            {
                BuildApdexPayload(context, valueSource as MetricValueSourceBase <ApdexValue>, writer, fields.Apdex, timestamp);
            }
        }
コード例 #9
0
        /// <summary>
        ///     Add the <see cref="MetricsStatsDStringOutputFormatter" /> allowing metrics to optionally be reported to Datadog
        /// </summary>
        /// <param name="metricFormattingBuilder">
        ///     The <see cref="IMetricsOutputFormattingBuilder" /> used to configure Datadog formatting
        ///     options.
        /// </param>
        /// <param name="fields">The metric fields to report as well as their names.</param>
        /// <returns>
        ///     An <see cref="IMetricsBuilder" /> that can be used to further configure App Metrics.
        /// </returns>
        public static IMetricsBuilder AsStatsDString(
            this IMetricsOutputFormattingBuilder metricFormattingBuilder,
            MetricFields fields = null)
        {
            if (metricFormattingBuilder == null)
            {
                throw new ArgumentNullException(nameof(metricFormattingBuilder));
            }

            var formatter = new MetricsStatsDStringOutputFormatter(fields);

            return(metricFormattingBuilder.Using(formatter, false));
        }
コード例 #10
0
        private async Task AssertExpectedLineProtocolString(MetricsDataValueSource dataValueSource, string expected)
        {
            var settings   = new MetricsInfluxDbLineProtocolOptions();
            var serializer = new MetricSnapshotSerializer();
            var fields     = new MetricFields();

            await using var sw = new StringWriter();
            await using (var packer = new MetricSnapshotInfluxDbLineProtocolWriter(sw, settings.MetricNameFormatter))
            {
                serializer.Serialize(packer, dataValueSource, fields);
            }

            sw.ToString().Should().Be(expected);
        }
コード例 #11
0
        private async Task AssertExpectedLineProtocolString(MetricsDataValueSource dataValueSource, TimeSpan flushInterval, string expected)
        {
            var settings   = new DatadogOptions();
            var serializer = new MetricSnapshotSerializer();
            var fields     = new MetricFields();

            await using var ms = new MemoryStream();
            await using (var packer = new MetricSnapshotDatadogJsonWriter(ms, flushInterval))
            {
                serializer.Serialize(packer, dataValueSource, fields);
            }

            Encoding.UTF8.GetString(ms.ToArray()).Should().Be(expected);
        }
コード例 #12
0
        public void Meter_set_items_should_ignore_values_where_specified()
        {
            // Arrange
            var data   = new Dictionary <string, object>();
            var value  = _meterSetItemsValue();
            var fields = new MetricFields();

            fields.Meter.Remove(MeterFields.SetItem);

            // Act
            value.AddMeterSetItemValues(data, fields.Meter);

            // Assert
            data.Count.Should().Be(0, "SetItems field was removed");
        }
コード例 #13
0
        public void Can_exclude_meter_set_items()
        {
            // Arrange
            var data = new Dictionary <string, object>();

            // Act
            var value  = _meterSetItemsValue();
            var fields = new MetricFields();

            fields.Meter.Exclude(MeterFields.SetItem);
            value.AddMeterSetItemValues(data, fields.Meter);

            // Assert
            data.Count.Should().Be(0, "SetItem field was ignored");
        }
コード例 #14
0
        public void Meter_set_item_percent_can_be_ignored()
        {
            // Arrange
            var data = new Dictionary <string, object>();

            // Act
            var value  = _meterSetItemsValue();
            var fields = new MetricFields();

            fields.Meter.Exclude(MeterFields.SetItemPercent);
            value.AddMeterSetItemValues(data, fields.Meter);

            // Assert
            data.ContainsKey(Fields.Meter[MeterFields.SetItemPercent]).Should().BeFalse($"{MeterFields.SetItemPercent} has been removed");
        }
コード例 #15
0
        private async Task AssertExpectedLineProtocolString(MetricsDataValueSource dataValueSource, string expected)
        {
            var settings   = new MetricsGraphitePlainTextProtocolOptions();
            var serializer = new MetricSnapshotSerializer();
            var fields     = new MetricFields();

            fields.DefaultGraphiteMetricFieldNames();

            await using var sw = new StringWriter();
            await using (var packer = new MetricSnapshotGraphitePlainTextProtocolWriter(sw, settings.MetricPointTextWriter))
            {
                serializer.Serialize(packer, dataValueSource, fields);
            }

            sw.ToString().Should().Be(expected);
        }
コード例 #16
0
        public void Histogram_removing_all_fields_shouldnt_throw_or_provide_data()
        {
            // Arrange
            var value  = _histogramValue();
            var data   = new Dictionary <string, object>();
            var fields = new MetricFields();

            fields.Histogram.Exclude();

            // Act
            Action sut = () => value.AddHistogramValues(data, fields.Histogram);

            // Assert
            sut.Should().NotThrow();
            data.Count.Should().Be(0);
        }
コード例 #17
0
        public void Meter_set_item_percent_can_use_custom_field_name()
        {
            // Arrange
            var          data        = new Dictionary <string, object>();
            const string customField = "custom";

            // Act
            var value  = _meterSetItemsValue();
            var fields = new MetricFields();

            fields.Meter[MeterFields.SetItemPercent] = customField;
            value.AddMeterSetItemValues(data, fields.Meter);

            // Assert
            data.ContainsKey(Fields.Meter[MeterFields.SetItemPercent]).Should().BeFalse($"{MeterFields.SetItemPercent} has been removed");
            data.ContainsKey(customField).Should().BeTrue($"{MeterFields.SetItemPercent} has been replaced with {customField}");
        }
コード例 #18
0
        public void Histogram_should_ignore_values_where_specified()
        {
            // Arrange
            var fieldValues = Enum.GetValues(typeof(HistogramFields));

            // Act
            foreach (HistogramFields key in fieldValues)
            {
                var value  = _histogramValue();
                var data   = new Dictionary <string, object>();
                var fields = new MetricFields();
                fields.Histogram.Remove(key);
                value.AddHistogramValues(data, fields.Histogram);

                // Assert
                data.Count.Should().Be(fieldValues.Length - 1);
                data.ContainsKey(Fields.Histogram[key]).Should().BeFalse();
            }
        }
コード例 #19
0
        public void Meter_can_use_custom_field_names_and_should_provide_corresponding_values()
        {
            // Arrange
            var data   = new Dictionary <string, object>();
            var value  = _meterValue();
            var fields = new MetricFields();

            fields.Meter.Set(MeterFields.Rate1M, "1_min_rate");
            fields.Meter.Set(MeterFields.RateMean, "mean_rate");

            // Act
            value.AddMeterValues(data, fields.Meter);

            // Assert
            data.ContainsKey(Fields.Meter[MeterFields.RateMean]).Should().BeFalse();
            data["mean_rate"].Should().Be(2.0);
            data.ContainsKey(Fields.Meter[MeterFields.Rate1M]).Should().BeFalse();
            data["1_min_rate"].Should().Be(3.0);
        }
コード例 #20
0
        public static void DefaultGraphiteMetricFieldNames(this MetricFields fields)
        {
            fields.Apdex.Set(ApdexFields.Frustrating, "Frustrating");
            fields.Apdex.Set(ApdexFields.Samples, "Samples");
            fields.Apdex.Set(ApdexFields.Score, "Score");
            fields.Apdex.Set(ApdexFields.Tolerating, "Tolerating");
            fields.Apdex.Set(ApdexFields.Satisfied, "Satisfied");

            fields.Counter.Set(CounterFields.Total, "Total");
            fields.Counter.Set(CounterFields.Value, "Value");
            fields.Counter.Set(CounterFields.SetItem, "-SetItem");
            fields.Counter.Set(CounterFields.SetItemPercent, "Percent");

            fields.Gauge.Set(GaugeFields.Value, "Value");

            fields.Histogram.Set(HistogramFields.Count, "Count");
            fields.Histogram.Set(HistogramFields.UserLastValue, "User-Last");
            fields.Histogram.Set(HistogramFields.UserMinValue, "User-Min");
            fields.Histogram.Set(HistogramFields.UserMaxValue, "User-Max");
            fields.Histogram.Set(HistogramFields.LastValue, "Last");
            fields.Histogram.Set(HistogramFields.Samples, "Samples");
            fields.Histogram.Set(HistogramFields.Min, "Min");
            fields.Histogram.Set(HistogramFields.Max, "Max");
            fields.Histogram.Set(HistogramFields.Mean, "Mean");
            fields.Histogram.Set(HistogramFields.Median, "Median");
            fields.Histogram.Set(HistogramFields.P75, "Percentile-75");
            fields.Histogram.Set(HistogramFields.P95, "Percentile-95");
            fields.Histogram.Set(HistogramFields.P98, "Percentile-98");
            fields.Histogram.Set(HistogramFields.P99, "Percentile-99");
            fields.Histogram.Set(HistogramFields.P999, "Percentile-999");
            fields.Histogram.Set(HistogramFields.Samples, "Samples");
            fields.Histogram.Set(HistogramFields.StdDev, "StdDev");
            fields.Histogram.Set(HistogramFields.Sum, "Sum");

            fields.Meter.Set(MeterFields.Count, "Total");
            fields.Meter.Set(MeterFields.RateMean, "Rate-Mean");
            fields.Meter.Set(MeterFields.SetItem, "-SetItem");
            fields.Meter.Set(MeterFields.SetItemPercent, "Percent");
            fields.Meter.Set(MeterFields.Rate1M, "Rate-1-Min");
            fields.Meter.Set(MeterFields.Rate5M, "Rate-5-Min");
            fields.Meter.Set(MeterFields.Rate15M, "Rate-15-Min");
        }
コード例 #21
0
        public void Apdex_can_use_custom_field_names_and_should_provide_corresponding_values()
        {
            // Arrange
            var          keys      = Enum.GetValues(typeof(ApdexFields));
            const string customKey = "custom";

            // Act
            foreach (ApdexFields key in keys)
            {
                var value  = _apdexValue();
                var data   = new Dictionary <string, object>();
                var fields = new MetricFields();
                fields.Apdex[key] = customKey;
                value.AddApdexValues(data, fields.Apdex);

                // Assert
                data.ContainsKey(Fields.Apdex[key]).Should().BeFalse();
                data.ContainsKey(customKey).Should().BeTrue();
            }
        }
コード例 #22
0
        public void Histogram_can_use_custom_field_names()
        {
            // Arrange
            var          fieldValues = Enum.GetValues(typeof(HistogramFields));
            const string customKey   = "custom";

            // Act
            foreach (HistogramFields field in fieldValues)
            {
                var value  = _histogramValue();
                var data   = new Dictionary <string, object>();
                var fields = new MetricFields();
                fields.Histogram[field] = customKey;
                value.AddHistogramValues(data, fields.Histogram);

                // Assert
                data.ContainsKey(Fields.Histogram[field]).Should().BeFalse();
                data.ContainsKey(customKey).Should().BeTrue();
            }
        }
コード例 #23
0
        public async Task Can_apply_ascii_metric_formatting()
        {
            // Arrange
            var counter = new CounterOptions {
                Context = "test", Name = "counter1"
            };
            var serializer = new MetricSnapshotSerializer();
            var fields     = new MetricFields();

            // Act
            _fixture.Metrics.Measure.Counter.Increment(counter);
            await using var sw = new StringWriter();
            await using (var writer = new MetricSnapshotTextWriter(sw))
            {
                serializer.Serialize(writer, _fixture.Metrics.Snapshot.Get(), fields);
            }

            // Assert
            sw.ToString().Should().Be(
                "# TIMESTAMP: 0\n# MEASUREMENT: [test] counter1\n# TAGS:\n                  mtype = counter\n                   unit = none\n# FIELDS:\n                  value = 1\n--------------------------------------------------------------\n");
        }
コード例 #24
0
 public static IMetricsRoot CreateMetrics(string graphiteUri, TimeSpan flushInterval, params string[] pathNodes)
 {
     return(AppMetrics.CreateDefaultBuilder()
            .Report.ToGraphite(g =>
     {
         g.FlushInterval = flushInterval;
         g.Graphite.BaseUri = new Uri(graphiteUri);
         var metricFields = new MetricFields();
         metricFields.Histogram.OnlyInclude(HistogramFields.Count, HistogramFields.Max, HistogramFields.Min,
                                            HistogramFields.P999, HistogramFields.Sum, HistogramFields.Mean);
         metricFields.Meter.OnlyInclude(MeterFields.Count, MeterFields.Rate5M, MeterFields.Rate1M, MeterFields.SetItem);
         metricFields.DefaultGraphiteMetricFieldNames();
         g.MetricsOutputFormatter
             = new MetricsGraphitePlainTextProtocolOutputFormatter(
                   new MetricsGraphitePlainTextProtocolOptions
         {
             MetricPointTextWriter = new CustomGraphitePointTextWriter(pathNodes)
         }, metricFields);
     })
            .Build());
 }
コード例 #25
0
        /// <summary>
        ///     Add the <see cref="MetricsStatsDStringOutputFormatter" /> allowing metrics to optionally be reported to Datadog
        /// </summary>
        /// <param name="metricFormattingBuilder">
        ///     The <see cref="IMetricsOutputFormattingBuilder" /> used to configure StatsD formatting
        ///     options.
        /// </param>
        /// <param name="setupAction">The StatsD formatting options to use.</param>
        /// <param name="fields">The metric fields to report as well as their names.</param>
        /// <returns>
        ///     An <see cref="IMetricsBuilder" /> that can be used to further configure App Metrics.
        /// </returns>
        public static IMetricsBuilder AsStatsDString(
            this IMetricsOutputFormattingBuilder metricFormattingBuilder,
            Action <MetricsStatsDOptions> setupAction,
            MetricFields fields = null)
        {
            if (metricFormattingBuilder == null)
            {
                throw new ArgumentNullException(nameof(metricFormattingBuilder));
            }

            if (setupAction == null)
            {
                throw new ArgumentNullException(nameof(setupAction));
            }

            var options = new MetricsStatsDOptions();

            setupAction(options);

            var formatter = new MetricsStatsDStringOutputFormatter(options, fields);

            return(metricFormattingBuilder.Using(formatter, false));
        }
コード例 #26
0
        public void Can_apply_ascii_metric_formatting_with_custom_name_formatter()
        {
            // Arrange
            var counter = new CounterOptions {
                Context = "test", Name = "counter1"
            };
            var serializer = new MetricSnapshotSerializer();
            var fields     = new MetricFields();

            // Act
            _fixture.Metrics.Measure.Counter.Increment(counter);
            using (var sw = new StringWriter())
            {
                using (var packer = new MetricSnapshotTextWriter(sw, metricNameFormatter: (context, name) => $"{context}---{name}"))
                {
                    serializer.Serialize(packer, _fixture.Metrics.Snapshot.Get(), fields);
                }

                // Assert
                sw.ToString().Should().Be(
                    "# TIMESTAMP: 0\n# MEASUREMENT: test---counter1\n# TAGS:\n                  mtype = counter\n                   unit = none\n# FIELDS:\n                  value = 1\n--------------------------------------------------------------\n");
            }
        }
コード例 #27
0
        public MetricSnapshotWavefrontWriter(
            IWavefrontSender wavefrontSender,
            string source,
            IDictionary <string, string> globalTags,
            ISet <HistogramGranularity> histogramGranularities,
            WavefrontSdkMetricsRegistry sdkMetricsRegistry,
            MetricFields fields)
        {
            this.wavefrontSender        = wavefrontSender;
            this.source                 = source;
            this.globalTags             = globalTags;
            this.histogramGranularities = histogramGranularities;
            this.fields                 = fields;

            gaugesReported        = sdkMetricsRegistry.Counter("gauges.reported");
            deltaCountersReported = sdkMetricsRegistry.Counter("delta_counters.reported");
            countersReported      = sdkMetricsRegistry.Counter("counters.reported");
            wfHistogramsReported  = sdkMetricsRegistry.Counter("wavefront_histograms.reported");
            histogramsReported    = sdkMetricsRegistry.Counter("histograms.reported");
            metersReported        = sdkMetricsRegistry.Counter("meters.reported");
            timersReported        = sdkMetricsRegistry.Counter("timers.reported");
            apdexesReported       = sdkMetricsRegistry.Counter("apdexes.reported");
            writerErrors          = sdkMetricsRegistry.Counter("writer.errors");
        }
コード例 #28
0
        public WavefrontReporter(MetricsReportingWavefrontOptions options)
        {
            if (options == null)
            {
                throw new ArgumentNullException(nameof(options));
            }
            if (options.WavefrontSender == null)
            {
                throw new ArgumentNullException(
                          nameof(MetricsReportingWavefrontOptions.WavefrontSender));
            }

            wavefrontSender = options.WavefrontSender;

            source = options.Source;

            if (options.ApplicationTags != null)
            {
                globalTags = new Dictionary <string, string>(options.ApplicationTags.ToPointTags());
            }
            else
            {
                globalTags = new Dictionary <string, string>();
            }

            histogramGranularities = new HashSet <HistogramGranularity>();
            if (options.WavefrontHistogram.ReportMinuteDistribution)
            {
                histogramGranularities.Add(HistogramGranularity.Minute);
            }
            if (options.WavefrontHistogram.ReportHourDistribution)
            {
                histogramGranularities.Add(HistogramGranularity.Hour);
            }
            if (options.WavefrontHistogram.ReportDayDistribution)
            {
                histogramGranularities.Add(HistogramGranularity.Day);
            }

            if (options.FlushInterval < TimeSpan.Zero)
            {
                throw new InvalidOperationException(
                          $"{nameof(MetricsReportingWavefrontOptions.FlushInterval)} " +
                          "must not be less than zero");
            }

            Filter = options.Filter;

            FlushInterval = options.FlushInterval > TimeSpan.Zero
                ? options.FlushInterval
                : AppMetricsConstants.Reporting.DefaultFlushInterval;

            // Formatting will be handled by the Wavefront sender.
            Formatter = null;

            metricFields = options.MetricFields ?? new MetricFields();

            var registryBuilder = new WavefrontSdkMetricsRegistry.Builder(wavefrontSender)
                                  .Prefix(Constants.SdkMetricPrefix + ".app_metrics")
                                  .Source(source)
                                  .Tags(globalTags);

            if (options.LoggerFactory != null)
            {
                registryBuilder.LoggerFactory(options.LoggerFactory);
            }
            sdkMetricsRegistry = registryBuilder.Build();

            reporterErrors = sdkMetricsRegistry.Counter("reporter.errors");

            double sdkVersion = Utils.GetSemVer(Assembly.GetExecutingAssembly());

            sdkMetricsRegistry.Gauge("version", () => sdkVersion);

            Logger.Info($"Using Wavefront Reporter {this}. FlushInterval: {FlushInterval}");
        }
コード例 #29
0
 public MetricsInfluxDbLineProtocolOutputFormatter(MetricsInfluxDbLineProtocolOptions options, MetricFields metricFields)
 {
     _options     = options ?? throw new ArgumentNullException(nameof(options));
     MetricFields = metricFields;
 }
コード例 #30
0
 public MetricsInfluxDbLineProtocolOutputFormatter(MetricFields metricFields)
 {
     _options     = new MetricsInfluxDbLineProtocolOptions();
     MetricFields = metricFields;
 }