The Metrics.NET library provides a way of instrumenting applications with custom metrics (timers, histograms, counters etc) that can be reported in various ways and can provide insights on what is happening inside a running application.
Apache License 2.0
639
stars
110
forks
source link
metrics is always insert into db with last histogram data #95
when I set the interval 5 seconds to sync,always using last histogram data,sush as count, max, min .
I just want to get the latest 1 minute data, not contains the data before.
my init:
`
var host = ConfigurationManager.AppSettings["Metrics.InfluxDb.Host"];
var port = ushort.Parse(ConfigurationManager.AppSettings["Metrics.InfluxDb.Port"]);
var database = ConfigurationManager.AppSettings["Metrics.InfluxDb.DB"];
var userName = ConfigurationManager.AppSettings["Metrics.InfluxDb.UserName"];
var password = ConfigurationManager.AppSettings["Metrics.InfluxDb.Password"];
var intervalSeconds = double.Parse(ConfigurationManager.AppSettings["Metrics.InfluxDb.Interval.Seconds"]);
var environment = ConfigurationManager.AppSettings["Environment"];
var batchSize = int.Parse(ConfigurationManager.AppSettings["Metrics.InfluxDb.BatchSize"]);
then , I change the default value in HistogramMetric.cs
public HistogramValue GetValue(bool resetMetric = true) { var value = new HistogramValue(this.last.Value, this.last.UserValue, this.reservoir.GetSnapshot(resetMetric)); if (resetMetric) { this.Reset(); } return value; }
It is ok now, but I cannot believe it Please help me, thanks.
when I set the interval 5 seconds to sync,always using last histogram data,sush as count, max, min . I just want to get the latest 1 minute data, not contains the data before.
my init: `
var host = ConfigurationManager.AppSettings["Metrics.InfluxDb.Host"]; var port = ushort.Parse(ConfigurationManager.AppSettings["Metrics.InfluxDb.Port"]); var database = ConfigurationManager.AppSettings["Metrics.InfluxDb.DB"]; var userName = ConfigurationManager.AppSettings["Metrics.InfluxDb.UserName"]; var password = ConfigurationManager.AppSettings["Metrics.InfluxDb.Password"]; var intervalSeconds = double.Parse(ConfigurationManager.AppSettings["Metrics.InfluxDb.Interval.Seconds"]); var environment = ConfigurationManager.AppSettings["Environment"]; var batchSize = int.Parse(ConfigurationManager.AppSettings["Metrics.InfluxDb.BatchSize"]);
`
then , I change the default value in HistogramMetric.cs
public HistogramValue GetValue(bool resetMetric = true) { var value = new HistogramValue(this.last.Value, this.last.UserValue, this.reservoir.GetSnapshot(resetMetric)); if (resetMetric) { this.Reset(); } return value; }
It is ok now, but I cannot believe it Please help me, thanks.