Skip to content

Commit

Permalink
Merge pull request #1167 from input-output-hk/erikd/startup-report
Browse files Browse the repository at this point in the history
db-sync: Report versions and cli options on startup
  • Loading branch information
erikd committed Jun 29, 2022
2 parents b994337 + 9586a8e commit 2cd36e1
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions cardano-db-sync/src/Cardano/DbSync.hs
Original file line number Diff line number Diff line change
Expand Up @@ -44,17 +44,20 @@ import Control.Monad.Extra (whenJust)
import Control.Monad.Trans.Except.Exit (orDie)
import Control.Monad.Trans.Except.Extra (newExceptT)

import qualified Data.Text as Text
import Data.Version (showVersion)

import Ouroboros.Network.NodeToClient (IOManager, withIOManager)

import Paths_cardano_db_sync (version)

runDbSyncNode :: MetricSetters -> [(Text, Text)] -> SyncNodeParams -> IO ()
runDbSyncNode metricsSetters knownMigrations params =
withIOManager $ \iomgr -> do
trce <- configureLogging params "db-sync-node"

aop <- readAbortOnPanic
if aop
then logWarning trce "Enviroment variable DbSyncAbortOnPanic: True"
else logInfo trce "Enviroment variable DbSyncAbortOnPanic: False"
startupReport trce aop params

runDbSync metricsSetters knownMigrations iomgr trce params aop 500 10000

Expand Down Expand Up @@ -98,3 +101,11 @@ orDieWithLog render trce e = do
panic errorStr
Right () -> pure ()

startupReport :: Trace IO Text -> Bool -> SyncNodeParams -> IO ()
startupReport trce aop params = do
logWarning trce $ mconcat ["Version number: ", Text.pack (showVersion version)]
logWarning trce $ mconcat ["Git hash: ", Db.gitRev]
logWarning trce $ mconcat ["Option disable-ledger: ", textShow (not $ enpHasLedger params)]
logWarning trce $ mconcat ["Option disable-cache: ", textShow (not $ enpHasCache params)]
logWarning trce $ mconcat ["Option disable-epoch: ", textShow (not $ enpExtended params)]
logWarning trce $ mconcat ["Enviroment variable DbSyncAbortOnPanic: ", textShow aop]

0 comments on commit 2cd36e1

Please sign in to comment.