Update configuration settings and logging behavior for SQL monitoring
- Increased thresholds for maximum query and method executions per window to 500 and 250, respectively, to reduce false positives in loop detection. - Enabled logging of slow queries only, improving performance by reducing log volume. - Adjusted SQL query logging to capture only warnings and errors, further optimizing logging efficiency. - Updated various settings across appsettings files to reflect these changes, ensuring consistency in configuration.
This commit is contained in:
@@ -50,8 +50,8 @@ public abstract class BaseRepositoryWithLogging
|
||||
var result = await operation();
|
||||
stopwatch.Stop();
|
||||
|
||||
// Only log if slow query (>2000ms) and logging is enabled
|
||||
if (stopwatch.Elapsed.TotalMilliseconds > 2000 && _sentryMonitoringService.IsLoggingEnabled())
|
||||
// Only log if it should be logged based on monitoring settings (respects LogSlowQueriesOnly and thresholds)
|
||||
if (_sentryMonitoringService.ShouldLogQuery(stopwatch.Elapsed))
|
||||
{
|
||||
_logger.LogWarning(
|
||||
"[SLOW-SQL] {Repository}.{Method} | Pattern: {Pattern} | Time: {Time}ms",
|
||||
@@ -121,8 +121,8 @@ public abstract class BaseRepositoryWithLogging
|
||||
await operation();
|
||||
stopwatch.Stop();
|
||||
|
||||
// Only log if slow query (>2000ms) and logging is enabled
|
||||
if (stopwatch.Elapsed.TotalMilliseconds > 2000 && _sentryMonitoringService.IsLoggingEnabled())
|
||||
// Only log if it should be logged based on monitoring settings (respects LogSlowQueriesOnly and thresholds)
|
||||
if (_sentryMonitoringService.ShouldLogQuery(stopwatch.Elapsed))
|
||||
{
|
||||
_logger.LogWarning(
|
||||
"[SLOW-SQL] {Repository}.{Method} | Pattern: {Pattern} | Time: {Time}ms",
|
||||
|
||||
Reference in New Issue
Block a user