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
- #3171, Add an ability to dump config via admin API - @skywriter
- #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
### Fixed
+2 -1
View File
@@ -310,7 +310,8 @@ loadSchemaCache appState observer = do
Right sCache -> do
putSchemaCache appState $ Just sCache
observer $ SchemaCacheQueriedObs resultTime
observer $ SchemaCacheLoadedObs sCache
(t, _) <- timeItT $ observer $ SchemaCacheSummaryObs sCache
observer $ SchemaCacheLoadedObs t
return SCLoaded
-- | Current database connection status data ConnectionStatus
+5 -2
View File
@@ -31,7 +31,8 @@ data Observation
| SchemaCacheFatalErrorObs SQL.UsageError Text
| SchemaCacheNormalErrorObs SQL.UsageError
| SchemaCacheQueriedObs Double
| SchemaCacheLoadedObs SchemaCache
| SchemaCacheSummaryObs SchemaCache
| SchemaCacheLoadedObs Double
| ConnectionRetryObs Int
| ConnectionPgVersionErrorObs SQL.UsageError
| DBListenerStart Text
@@ -70,8 +71,10 @@ observationMessage = \case
"An error ocurred when loading the schema cache. " <> jsonMessage usageErr
SchemaCacheQueriedObs resultTime ->
"Schema cache queried in " <> showMillis resultTime <> " milliseconds"
SchemaCacheLoadedObs sCache ->
SchemaCacheSummaryObs sCache ->
"Schema cache loaded " <> showSummary sCache
SchemaCacheLoadedObs resultTime ->
"Schema cache loaded in " <> showMillis resultTime <> " milliseconds"
ConnectionRetryObs delay ->
"Attempting to reconnect to the database in " <> (show delay::Text) <> " seconds..."
ConnectionPgVersionErrorObs usageErr ->