From 4e9601d1553aa18fda32eeef1dbce9f587fc9eee Mon Sep 17 00:00:00 2001 From: steve-chavez Date: Wed, 13 Nov 2024 22:08:54 -0500 Subject: [PATCH] fix: always show schema cache load time It used to be that this was only enabled with log-level=debug. But the default log-level is misleading, for example: ``` $ PGRST_DB_SCHEMAS="apflora" postgrest-with-postgresql-16 -f test/io/big_schema.sql postgrest-run ... 13/Nov/2024:22:08:20 -0500: Config reloaded 13/Nov/2024:22:08:20 -0500: Schema cache queried in 36.3 milliseconds 13/Nov/2024:22:08:20 -0500: Schema cache loaded 326 Relations, 305 Relationships, 7 Functions, 0 Domain Representations, 4 Media Type Handlers, 1194 Timezones ``` The "Schema cache loaded" can take a while to appear, yet the 22:08:20 time is the same. If we reveal the load time this is clarified: ``` 13/Nov/2024:22:08:37 -0500: Schema cache loaded in 16770.1 milliseconds ``` --- CHANGELOG.md | 4 ++++ src/PostgREST/Logger.hs | 3 --- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2a9c273d2..755665cb5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,10 @@ This project adheres to [Semantic Versioning](http://semver.org/). ## Unreleased +### Fixed + + - #3779, Always log the schema cache load time - @steve-chavez + ## [12.2.3] - 2024-08-01 ### Fixed diff --git a/src/PostgREST/Logger.hs b/src/PostgREST/Logger.hs index 08ad5b166..5e46594bb 100644 --- a/src/PostgREST/Logger.hs +++ b/src/PostgREST/Logger.hs @@ -87,9 +87,6 @@ observationLogger loggerState logLevel obs = case obs of o@(HasqlPoolObs _) -> do when (logLevel >= LogDebug) $ do logWithZTime loggerState $ observationMessage o - o@(SchemaCacheLoadedObs _) -> do - when (logLevel >= LogDebug) $ do - logWithZTime loggerState $ observationMessage o PoolRequest -> pure () PoolRequestFullfilled ->