Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: remove panic on NewDatabaseSQLStats Register from various reports #5163

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion enterprise/reporting/error_index/error_index_reporting.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import (
"github.com/rudderlabs/rudder-go-kit/stats"
"github.com/rudderlabs/rudder-go-kit/stats/collectors"
kitsync "github.com/rudderlabs/rudder-go-kit/sync"
obskit "github.com/rudderlabs/rudder-observability-kit/go/labels"

"github.com/rudderlabs/rudder-server/jobsdb"
. "github.com/rudderlabs/rudder-server/utils/tx" //nolint:staticcheck
Expand Down Expand Up @@ -191,7 +192,7 @@ func (eir *ErrorIndexReporter) DatabaseSyncer(c types.SyncerConfig) types.Report
}
err = eir.statsFactory.RegisterCollector(collectors.NewDatabaseSQLStats("jobsdb-err_idx", dbHandle))
if err != nil {
panic(fmt.Errorf("failed to register collector: %w", err))
eir.log.Errorn("error registering database sql stats", obskit.Error(err))
}
errIndexDB := jobsdb.NewForReadWrite(
"err_idx",
Expand Down
2 changes: 1 addition & 1 deletion enterprise/reporting/error_reporting.go
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ func (edr *ErrorDetailReporter) migrate(c types.SyncerConfig) (*sql.DB, error) {
dbHandle.SetMaxOpenConns(edr.maxOpenConnections)
err = edr.stats.RegisterCollector(collectors.NewDatabaseSQLStats("error_detail_reporting", dbHandle))
if err != nil {
return nil, fmt.Errorf("could not register database stats collector: %w", err)
edr.log.Errorn("error registering database sql stats", obskit.Error(err))
}

m := &migrator.Migrator{
Expand Down
3 changes: 2 additions & 1 deletion enterprise/reporting/flusher/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
"github.com/rudderlabs/rudder-go-kit/logger"
"github.com/rudderlabs/rudder-go-kit/stats"
"github.com/rudderlabs/rudder-go-kit/stats/collectors"
obskit "github.com/rudderlabs/rudder-observability-kit/go/labels"
"github.com/rudderlabs/rudder-server/enterprise/reporting/flusher/aggregator"
"github.com/rudderlabs/rudder-server/utils/misc"
)
Expand All @@ -34,7 +35,7 @@ func CreateRunner(ctx context.Context, table string, log logger.Logger, stats st
db.SetMaxOpenConns(maxOpenConns)
err = stats.RegisterCollector(collectors.NewDatabaseSQLStats(fmt.Sprintf("reporting_flusher_%s", table), db))
if err != nil {
return nil, fmt.Errorf("registering collector: %w", err)
log.Errorn("error registering database sql stats", obskit.Error(err))
}

if table == "tracked_users_reports" {
Expand Down
2 changes: 1 addition & 1 deletion enterprise/trackedusers/users_reporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ func (u *UniqueUsersReporter) MigrateDatabase(dbConn string, conf *config.Config
dbHandle.SetMaxOpenConns(1)
err = u.stats.RegisterCollector(collectors.NewDatabaseSQLStats("tracked_users_reports", dbHandle))
if err != nil {
return fmt.Errorf("registering collector: %w", err)
u.log.Errorn("error registering database sql stats", obskit.Error(err))
}

m := &migrator.Migrator{
Expand Down
Loading