Skip to content

Commit

Permalink
Move enabling metric persistence to core module prep phase
Browse files Browse the repository at this point in the history
  • Loading branch information
dhaavi committed Oct 13, 2023
1 parent 48bccad commit e6c4937
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
7 changes: 0 additions & 7 deletions core/base/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ package base

import (
_ "github.com/safing/portbase/config"
"github.com/safing/portbase/log"
"github.com/safing/portbase/metrics"
"github.com/safing/portbase/modules"
_ "github.com/safing/portbase/rng"
)
Expand Down Expand Up @@ -33,11 +31,6 @@ func start() error {
return err
}

// Set metrics storage key and load them from db.
if err := metrics.EnableMetricPersistence("core:metrics/storage"); err != nil {
log.Warningf("core: failed to load persisted metrics from db: %s", err)
}

registerLogCleaner()

return nil
Expand Down
7 changes: 7 additions & 0 deletions core/core.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import (
"fmt"
"time"

"github.com/safing/portbase/log"
"github.com/safing/portbase/metrics"
"github.com/safing/portbase/modules"
"github.com/safing/portbase/modules/subsystems"
_ "github.com/safing/portmaster/broadcasts"
Expand Down Expand Up @@ -60,6 +62,11 @@ func prep() error {
return err
}

// Enable persistent metrics.
if err := metrics.EnableMetricPersistence("core:metrics/storage"); err != nil {
log.Warningf("core: failed to enable persisted metrics: %s", err)
}

return nil
}

Expand Down

0 comments on commit e6c4937

Please sign in to comment.