/// <summary> /// Initializes a new instance of the <see cref="ElasticSearchReporterSettings" /> class. /// </summary> public ElasticSearchReporterSettings() { var customHistogramDataKeys = new Dictionary <HistogramValueDataKeys, string> { { HistogramValueDataKeys.Count, "countHist" }, { HistogramValueDataKeys.UserLastValue, "userLast" }, { HistogramValueDataKeys.UserMinValue, "userMin" }, { HistogramValueDataKeys.UserMaxValue, "userMax" } }; var customMeterDataKeys = new Dictionary <MeterValueDataKeys, string> { { MeterValueDataKeys.Count, "countMeter" }, { MeterValueDataKeys.RateMean, "rateMean" } }; DataKeys = new MetricValueDataKeys(histogram: customHistogramDataKeys, meter: customMeterDataKeys); ElasticSearchSettings = new ElasticSearchSettings(new Uri("http://*****:*****@char) => current.Replace(@char, "_")).ToLowerInvariant() : SpecialChars.Aggregate($"{metricContext}__{metricName}", (current, @char) => current.Replace(@char, "_")).ToLowerInvariant(); MetricTagValueFormatter = tagValue => { return(SpecialChars.Aggregate(tagValue, (current, @char) => current.Replace(@char, "_")).ToLowerInvariant()); }; }
/// <summary> /// Initializes a new instance of the <see cref="ElasticSearchReporterSettings" /> class. /// </summary> public ElasticSearchReporterSettings() { DataKeys = new MetricValueDataKeys( EsConstants.ElasticsearchDefaults.CustomHistogramDataKeys, EsConstants.ElasticsearchDefaults.CustomMeterDataKeys); ElasticSearchSettings = new ElasticSearchSettings(new Uri("http://localhost:9200"), "metrics"); HttpPolicy = new HttpPolicy { FailuresBeforeBackoff = Constants.DefaultFailuresBeforeBackoff, BackoffPeriod = Constants.DefaultBackoffPeriod, Timeout = Constants.DefaultTimeout }; ReportInterval = TimeSpan.FromSeconds(5); MetricNameFormatter = EsConstants.ElasticsearchDefaults.MetricNameFormatter; MetricTagValueFormatter = EsConstants.ElasticsearchDefaults.MetricTagValueFormatter; }