From 12323f3662d01cb530a45be112806a317c773a7e Mon Sep 17 00:00:00 2001 From: spiral Date: Thu, 17 Nov 2022 02:51:04 +0000 Subject: [PATCH] fix: don't write raw sql queries to influxdb metrics --- PluralKit.Core/Database/Database.cs | 1 + PluralKit.Core/Database/Wrappers/PKCommand.cs | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/PluralKit.Core/Database/Database.cs b/PluralKit.Core/Database/Database.cs index e5e1b0d0..ca11d683 100644 --- a/PluralKit.Core/Database/Database.cs +++ b/PluralKit.Core/Database/Database.cs @@ -87,6 +87,7 @@ internal partial class Database: IDatabase NpgsqlConnection.GlobalTypeMapper.MapEnum("privacy_level"); } + // TODO: make sure every SQL query is behind a logged query method public async Task Obtain() { // Mark the request (for a handle, I guess) in the metrics diff --git a/PluralKit.Core/Database/Wrappers/PKCommand.cs b/PluralKit.Core/Database/Wrappers/PKCommand.cs index 348b13ab..36e29c03 100644 --- a/PluralKit.Core/Database/Wrappers/PKCommand.cs +++ b/PluralKit.Core/Database/Wrappers/PKCommand.cs @@ -124,9 +124,10 @@ internal class PKCommand: DbCommand, IPKCommand elapsed, _ourConnection.ConnectionId); // One "BCL compatible tick" is 100 nanoseconds - var micros = elapsed.BclCompatibleTicks / 10; - _metrics.Provider.Timer.Instance(CoreMetrics.DatabaseQuery, new MetricTags("query", CommandText)) - .Record(micros, TimeUnit.Microseconds, CommandText); + + // var micros = elapsed.BclCompatibleTicks / 10; + // _metrics.Provider.Timer.Instance(CoreMetrics.DatabaseQuery, new MetricTags("query", CommandText)) + // .Record(micros, TimeUnit.Microseconds, CommandText); } }