refactor: run InfluxDB reporter through AppMetrics instead of per-minute task
This commit is contained in:
parent
97c14b20b0
commit
38a3683fca
@ -238,7 +238,5 @@ public class Bot
|
|||||||
|
|
||||||
// Collect some stats, submit them to the metrics backend
|
// Collect some stats, submit them to the metrics backend
|
||||||
await _collector.CollectStats();
|
await _collector.CollectStats();
|
||||||
await Task.WhenAll(((IMetricsRoot)_metrics).ReportRunner.RunAllAsync());
|
|
||||||
_logger.Debug("Submitted metrics to backend");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -23,7 +23,7 @@ public class MetricsModule: Module
|
|||||||
{
|
{
|
||||||
var builder = AppMetrics.CreateDefaultBuilder();
|
var builder = AppMetrics.CreateDefaultBuilder();
|
||||||
if (config.InfluxUrl != null && config.InfluxDb != null)
|
if (config.InfluxUrl != null && config.InfluxDb != null)
|
||||||
builder.Report.ToInfluxDb(config.InfluxUrl, config.InfluxDb);
|
builder.Report.ToInfluxDb(config.InfluxUrl, config.InfluxDb, TimeSpan.FromMinutes(1));
|
||||||
if (_onlyContext != null)
|
if (_onlyContext != null)
|
||||||
builder.Filter.ByIncludingOnlyContext(_onlyContext);
|
builder.Filter.ByIncludingOnlyContext(_onlyContext);
|
||||||
return builder.Build();
|
return builder.Build();
|
||||||
|
@ -97,7 +97,6 @@ public class TaskHandler
|
|||||||
// Other shiz
|
// Other shiz
|
||||||
_metrics.Measure.Gauge.SetValue(Metrics.WebhookCacheSize, stats.Sum(x => x.WebhookCacheSize));
|
_metrics.Measure.Gauge.SetValue(Metrics.WebhookCacheSize, stats.Sum(x => x.WebhookCacheSize));
|
||||||
|
|
||||||
await Task.WhenAll(((IMetricsRoot)_metrics).ReportRunner.RunAllAsync());
|
|
||||||
_logger.Debug("Submitted metrics to backend");
|
_logger.Debug("Submitted metrics to backend");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user