diff --git a/cmd/server/handler.go b/cmd/server/handler.go index f230648c62d..d9c1bf394f8 100644 --- a/cmd/server/handler.go +++ b/cmd/server/handler.go @@ -17,7 +17,7 @@ import ( "github.com/ory/x/corsx" "github.com/ory/x/httprouterx" - analytics "github.com/ory/analytics-go/v5" + "github.com/ory/analytics-go/v5" "github.com/ory/x/configx" "github.com/ory/x/reqlog" @@ -223,11 +223,8 @@ func setup(ctx context.Context, d driver.Registry, cmd *cobra.Command) (admin *h d.Logger(), d.Config().Source(ctx), &metricsx.Options{ - Service: "ory-hydra", - DeploymentId: metricsx.Hash(fmt.Sprintf("%s|%s", - d.Config().IssuerURL(ctx).String(), - d.Config().DSN(), - )), + Service: "hydra", + DeploymentId: metricsx.Hash(d.Persister().NetworkID(ctx).String()), IsDevelopment: d.Config().DSN() == "memory" || d.Config().IssuerURL(ctx).String() == "" || strings.Contains(d.Config().IssuerURL(ctx).String(), "localhost"), diff --git a/persistence/definitions.go b/persistence/definitions.go index f3a9230ba0a..27a8b0fa037 100644 --- a/persistence/definitions.go +++ b/persistence/definitions.go @@ -6,6 +6,10 @@ package persistence import ( "context" + "github.com/gofrs/uuid" + + "github.com/ory/x/networkx" + "github.com/gobuffalo/pop/v6" "github.com/ory/hydra/v2/client" @@ -30,8 +34,14 @@ type ( PrepareMigration(context.Context) error Connection(context.Context) *pop.Connection Ping() error + Networker } Provider interface { Persister() Persister } + + Networker interface { + NetworkID(ctx context.Context) uuid.UUID + DetermineNetwork(ctx context.Context) (*networkx.Network, error) + } )