Skip to content

Commit

Permalink
chore: remove manager config
Browse files Browse the repository at this point in the history
  • Loading branch information
dhawal1248 committed Oct 12, 2023
1 parent 15c16a1 commit 48a7b6c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 31 deletions.
8 changes: 1 addition & 7 deletions cmd/signozschemamigrator/migrate.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,7 @@ func main() {
// the value of this env would replace all occurences of {{.SIGNOZ_CLUSTER}} in the migration files
os.Setenv("SIGNOZ_CLUSTER", clusterName)

managerConfig := migrationmanager.NewConfig(
dsn,
clusterName,
disableDurationSortFeature,
disableTimestampSortFeature,
)
manager, err := migrationmanager.New(managerConfig)
manager, err := migrationmanager.New(dsn, clusterName, disableDurationSortFeature, disableTimestampSortFeature)
if err != nil {
logger.Fatal("Failed to create migration manager", zap.Error(err))
}
Expand Down
34 changes: 10 additions & 24 deletions migrationManager/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,40 +17,26 @@ type MigrationManager struct {
logger *zap.Logger
}

type Config struct {
migrators.MigratorConfig
}

func NewConfig(
dsn string,
clusterName string,
isDurationSortFeatureDisabled bool,
isTimestampSortFeatureDisabled bool,
) Config {
return Config{
MigratorConfig: migrators.MigratorConfig{
DSN: dsn,
ClusterName: clusterName,
IsDurationSortFeatureDisabled: isDurationSortFeatureDisabled,
IsTimestampSortFeatureDisabled: isTimestampSortFeatureDisabled,
},
}
}

func New(cfg Config) (*MigrationManager, error) {
func New(dsn string, clusterName string, isDurationSortFeatureDisabled bool, isTimestampSortFeatureDisabled bool) (*MigrationManager, error) {
logger := zap.L().With(zap.String("component", "migrationManager"))
cfg := migrators.MigratorConfig{
DSN: dsn,
ClusterName: clusterName,
IsDurationSortFeatureDisabled: isDurationSortFeatureDisabled,
IsTimestampSortFeatureDisabled: isTimestampSortFeatureDisabled,
}

logsMigrator, err := createNewMigrator("logs", cfg.MigratorConfig)
logsMigrator, err := createNewMigrator("logs", cfg)
if err != nil {
logger.Error("Failed to create logs migrator", zap.Error(err))
return nil, err
}
metricsMigrator, err := createNewMigrator("metrics", cfg.MigratorConfig)
metricsMigrator, err := createNewMigrator("metrics", cfg)
if err != nil {
logger.Error("Failed to create metrics migrator", zap.Error(err))
return nil, err
}
tracesMigrator, err := createNewMigrator("traces", cfg.MigratorConfig)
tracesMigrator, err := createNewMigrator("traces", cfg)
if err != nil {
logger.Error("Failed to create traces migrator", zap.Error(err))
return nil, err
Expand Down

0 comments on commit 48a7b6c

Please sign in to comment.