feat: log schema cache load time

This commit is contained in:
steve-chavez
2024-02-21 18:16:37 -05:00
committed by Steve Chavez
parent 1a141c19df
commit 3a3601cbeb
3 changed files with 8 additions and 4 deletions
+1 -1
View File
@@ -10,7 +10,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).
- #2887, Add Preference `max-affected` to limit affected resources - @taimoorzaeem - #2887, Add Preference `max-affected` to limit affected resources - @taimoorzaeem
- #3171, Add an ability to dump config via admin API - @skywriter - #3171, Add an ability to dump config via admin API - @skywriter
- #3061, Apply all function settings as transaction-scoped settings - @taimoorzaeem - #3061, Apply all function settings as transaction-scoped settings - @taimoorzaeem
- #3171, Log schema cache stats to stderr - @steve-chavez - #3171, #3046, Log schema cache stats to stderr - @steve-chavez
- #3210, Dump schema cache through admin API - @taimoorzaeem - #3210, Dump schema cache through admin API - @taimoorzaeem
### Fixed ### Fixed
+2 -1
View File
@@ -310,7 +310,8 @@ loadSchemaCache appState observer = do
Right sCache -> do Right sCache -> do
putSchemaCache appState $ Just sCache putSchemaCache appState $ Just sCache
observer $ SchemaCacheQueriedObs resultTime observer $ SchemaCacheQueriedObs resultTime
observer $ SchemaCacheLoadedObs sCache (t, _) <- timeItT $ observer $ SchemaCacheSummaryObs sCache
observer $ SchemaCacheLoadedObs t
return SCLoaded return SCLoaded
-- | Current database connection status data ConnectionStatus -- | Current database connection status data ConnectionStatus
+5 -2
View File
@@ -31,7 +31,8 @@ data Observation
| SchemaCacheFatalErrorObs SQL.UsageError Text | SchemaCacheFatalErrorObs SQL.UsageError Text
| SchemaCacheNormalErrorObs SQL.UsageError | SchemaCacheNormalErrorObs SQL.UsageError
| SchemaCacheQueriedObs Double | SchemaCacheQueriedObs Double
| SchemaCacheLoadedObs SchemaCache | SchemaCacheSummaryObs SchemaCache
| SchemaCacheLoadedObs Double
| ConnectionRetryObs Int | ConnectionRetryObs Int
| ConnectionPgVersionErrorObs SQL.UsageError | ConnectionPgVersionErrorObs SQL.UsageError
| DBListenerStart Text | DBListenerStart Text
@@ -70,8 +71,10 @@ observationMessage = \case
"An error ocurred when loading the schema cache. " <> jsonMessage usageErr "An error ocurred when loading the schema cache. " <> jsonMessage usageErr
SchemaCacheQueriedObs resultTime -> SchemaCacheQueriedObs resultTime ->
"Schema cache queried in " <> showMillis resultTime <> " milliseconds" "Schema cache queried in " <> showMillis resultTime <> " milliseconds"
SchemaCacheLoadedObs sCache -> SchemaCacheSummaryObs sCache ->
"Schema cache loaded " <> showSummary sCache "Schema cache loaded " <> showSummary sCache
SchemaCacheLoadedObs resultTime ->
"Schema cache loaded in " <> showMillis resultTime <> " milliseconds"
ConnectionRetryObs delay -> ConnectionRetryObs delay ->
"Attempting to reconnect to the database in " <> (show delay::Text) <> " seconds..." "Attempting to reconnect to the database in " <> (show delay::Text) <> " seconds..."
ConnectionPgVersionErrorObs usageErr -> ConnectionPgVersionErrorObs usageErr ->