Skip to content

Commit

Permalink
Add more verbose logging to horizon start up (#4161)
Browse files Browse the repository at this point in the history
  • Loading branch information
erika-sdf committed Jan 6, 2022
1 parent 97c628e commit 3f6217e
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions services/horizon/internal/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ func (a *App) Serve() error {
wg.Done()
}()

log.Infof("Starting to serve requests")
err := a.webServer.Serve()
if err != nil && err != http.ErrServerClosed {
return err
Expand Down
6 changes: 6 additions & 0 deletions services/horizon/internal/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -509,6 +509,8 @@ func NewAppFromFlags(config *Config, flags support.ConfigOptions) (*App, error)
if config.Ingest && !config.EnableCaptiveCoreIngestion && config.StellarCoreDatabaseURL == "" {
return nil, fmt.Errorf("flag --%s cannot be empty", StellarCoreDBURLFlagName)
}

log.Infof("Initializing horizon...")
app, err := NewApp(*config)
if err != nil {
return nil, fmt.Errorf("cannot initialize app: %s", err)
Expand Down Expand Up @@ -545,10 +547,12 @@ func ApplyFlags(config *Config, flags support.ConfigOptions, options ApplyOption
// only on ingesting instances which are required to have write-access
// to the DB.
if config.ApplyMigrations {
stdLog.Println("Applying DB migrations...")
if err := applyMigrations(*config); err != nil {
return err
}
}
stdLog.Println("Checking DB migrations...")
if err := checkMigrations(*config); err != nil {
return err
}
Expand All @@ -560,6 +564,8 @@ func ApplyFlags(config *Config, flags support.ConfigOptions, options ApplyOption
}

if config.EnableCaptiveCoreIngestion {
stdLog.Println("Preparing captive core...")

binaryPath := viper.GetString(StellarCoreBinaryPathName)

// If the user didn't specify a Stellar Core binary, we can check the
Expand Down
3 changes: 3 additions & 0 deletions services/horizon/internal/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import (
)

func mustNewDBSession(subservice db.Subservice, databaseURL string, maxIdle, maxOpen int, registry *prometheus.Registry) db.SessionInterface {
log.Infof("Establishing database session at %s for %v", databaseURL, subservice)
session, err := db.Open("postgres", databaseURL)
if err != nil {
log.Fatalf("cannot open %v DB: %v", subservice, err)
Expand All @@ -29,6 +30,8 @@ func mustNewDBSession(subservice db.Subservice, databaseURL string, maxIdle, max
}

func mustInitHorizonDB(app *App) {
log.Infof("Initializing database...")

maxIdle := app.config.HorizonDBMaxIdleConnections
maxOpen := app.config.HorizonDBMaxOpenConnections
if app.config.Ingest {
Expand Down

0 comments on commit 3f6217e

Please sign in to comment.