From 0bad2e8ff9d23575fb62f4495459b3f0c5bc5edb Mon Sep 17 00:00:00 2001 From: spiral Date: Wed, 23 Mar 2022 19:28:51 -0400 Subject: [PATCH] Revert "refactor: run InfluxDB reporter through AppMetrics instead of per-minute task" This reverts commit 38a3683fca78d40aba625a8798bdc0ebb609b91c. --- PluralKit.Bot/Bot.cs | 2 ++ PluralKit.Core/Modules/MetricsModule.cs | 2 +- PluralKit.ScheduledTasks/TaskHandler.cs | 1 + 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/PluralKit.Bot/Bot.cs b/PluralKit.Bot/Bot.cs index 71b15b9a..f93475d0 100644 --- a/PluralKit.Bot/Bot.cs +++ b/PluralKit.Bot/Bot.cs @@ -238,5 +238,7 @@ 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 14818dba..7d17f3ae 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, TimeSpan.FromMinutes(1)); + builder.Report.ToInfluxDb(config.InfluxUrl, config.InfluxDb); if (_onlyContext != null) builder.Filter.ByIncludingOnlyContext(_onlyContext); return builder.Build(); diff --git a/PluralKit.ScheduledTasks/TaskHandler.cs b/PluralKit.ScheduledTasks/TaskHandler.cs index 855c0058..cff18042 100644 --- a/PluralKit.ScheduledTasks/TaskHandler.cs +++ b/PluralKit.ScheduledTasks/TaskHandler.cs @@ -97,6 +97,7 @@ 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"); }