refactor: get rid of redundant SchemaCacheSummaryObs

There is unnecessary coupling between observation messages and emited log entries. This causes schema loading logic to emit redundant events: SchemaCacheSummaryObs and SchemaCacheLoadedObs.

Logically - we want to emit a single event containing both summary and timing information. How it is logged is a different matter and should be decoupled.

This commit
* changes observationMessage function returning Text to observationMessages returning [Text] so that it is possible to return multiple (or zero) messages to log based on an observation event
* Removes SchemaCacheSummaryObs constructor from Observation type and adds summary text to SchemaCacheLoadedObs
This commit is contained in:
Michał Kłeczek
2026-03-02 14:45:31 -05:00
committed by Steve Chavez
parent 58a973e664
commit 2408cd332d
5 changed files with 62 additions and 61 deletions
+1 -2
View File
@@ -416,8 +416,7 @@ retryingSchemaCacheLoad appState@AppState{stateObserver=observer, stateMainThrea
putSCacheStatus appState SCPending
putSchemaCache appState $ Just sCache
observer $ SchemaCacheQueriedObs resultTime
(t, _) <- timeItT $ observer $ SchemaCacheSummaryObs $ showSummary sCache
observer $ SchemaCacheLoadedObs t
observer . uncurry SchemaCacheLoadedObs =<< timeItT (evaluate $ showSummary sCache)
putSCacheStatus appState SCLoaded
return $ Just sCache