Made slow queries logging disabled by default.

This commit is contained in:
Ivan Tashkinov 2021-12-27 09:13:31 +03:00
parent 3e9e7178bc
commit 08c0f09bad
2 changed files with 8 additions and 2 deletions

View File

@ -855,7 +855,11 @@ config :pleroma, ConcurrentLimiter, [
] ]
config :pleroma, :telemetry, config :pleroma, :telemetry,
slow_queries_logging: [exclude_sources: [nil, "oban_jobs"], min_duration: 500_000] slow_queries_logging: [
enabled: false,
min_duration: 500_000,
exclude_sources: [nil, "oban_jobs"]
]
# Import environment specific config. This must remain at the bottom # Import environment specific config. This must remain at the bottom
# of this file so it overrides the configuration defined above. # of this file so it overrides the configuration defined above.

View File

@ -106,7 +106,9 @@ defmodule Pleroma.Telemetry.Logger do
) do ) do
logging_config = Pleroma.Config.get([:telemetry, :slow_queries_logging], []) logging_config = Pleroma.Config.get([:telemetry, :slow_queries_logging], [])
if logging_config[:min_duration] && query_time > logging_config[:min_duration] and if logging_config[:enabled] &&
logging_config[:min_duration] &&
query_time > logging_config[:min_duration] and
(is_nil(logging_config[:exclude_sources]) or (is_nil(logging_config[:exclude_sources]) or
source not in logging_config[:exclude_sources]) do source not in logging_config[:exclude_sources]) do
log_slow_query(measurements, metadata, config) log_slow_query(measurements, metadata, config)