From 38a3683fca78d40aba625a8798bdc0ebb609b91c Mon Sep 17 00:00:00 2001 From: spiral Date: Wed, 23 Mar 2022 14:41:55 -0400 Subject: [PATCH] refactor: run InfluxDB reporter through AppMetrics instead of per-minute task --- PluralKit.Bot/Bot.cs | 2 -- PluralKit.Core/Modules/MetricsModule.cs | 2 +- PluralKit.ScheduledTasks/TaskHandler.cs | 1 - 3 files changed, 1 insertion(+), 4 deletions(-) diff --git a/PluralKit.Bot/Bot.cs b/PluralKit.Bot/Bot.cs index f93475d0..71b15b9a 100644 --- a/PluralKit.Bot/Bot.cs +++ b/PluralKit.Bot/Bot.cs @@ -238,7 +238,5 @@ public class Bot // Collect some stats, submit them to the metrics backend await _collector.CollectStats(); - await Task.WhenAll(((IMetricsRoot)_metrics).ReportRunner.RunAllAsync()); - _logger.Debug("Submitted metrics to backend"); } } \ No newline at end of file diff --git a/PluralKit.Core/Modules/MetricsModule.cs b/PluralKit.Core/Modules/MetricsModule.cs index 7d17f3ae..14818dba 100644 --- a/PluralKit.Core/Modules/MetricsModule.cs +++ b/PluralKit.Core/Modules/MetricsModule.cs @@ -23,7 +23,7 @@ public class MetricsModule: Module { var builder = AppMetrics.CreateDefaultBuilder(); 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) builder.Filter.ByIncludingOnlyContext(_onlyContext); return builder.Build(); diff --git a/PluralKit.ScheduledTasks/TaskHandler.cs b/PluralKit.ScheduledTasks/TaskHandler.cs index cff18042..855c0058 100644 --- a/PluralKit.ScheduledTasks/TaskHandler.cs +++ b/PluralKit.ScheduledTasks/TaskHandler.cs @@ -97,7 +97,6 @@ public class TaskHandler // Other shiz _metrics.Measure.Gauge.SetValue(Metrics.WebhookCacheSize, stats.Sum(x => x.WebhookCacheSize)); - await Task.WhenAll(((IMetricsRoot)_metrics).ReportRunner.RunAllAsync()); _logger.Debug("Submitted metrics to backend"); }