fix(mirror): initialize meter to prevent panic (#9712)

# Which Problems Are Solved

With the change of #9561, the `mirror` command panics as there's no
metrics provider configured.

# How the Problems Are Solved

Correctly initialize the provider (no-op by default) for the mirror
command.

# Additional Changes

None

# Additional Context

relates to #9561 -> needs backports to 2.66.x - 2.71.x and 3.0.0-rc

Co-authored-by: Stefan Benz <46600784+stebenz@users.noreply.github.com>
This commit is contained in:
Livio Spring
2025-04-07 18:00:15 +02:00
committed by GitHub
parent 79a5585f91
commit a7a5124643

View File

@@ -16,6 +16,7 @@ import (
"github.com/zitadel/zitadel/internal/database"
"github.com/zitadel/zitadel/internal/domain"
"github.com/zitadel/zitadel/internal/id"
metrics "github.com/zitadel/zitadel/internal/telemetry/metrics/config"
)
type Migration struct {
@@ -26,6 +27,7 @@ type Migration struct {
Log *logging.Config
Machine *id.Config
Metrics metrics.Config
}
var (
@@ -40,6 +42,9 @@ func mustNewMigrationConfig(v *viper.Viper) *Migration {
err := config.Log.SetLogger()
logging.OnError(err).Fatal("unable to set logger")
err = config.Metrics.NewMeter()
logging.OnError(err).Fatal("unable to set meter")
id.Configure(config.Machine)
return config