Skip to content

Commit

Permalink
feat: sqa metrics v2 (#3533)
Browse files Browse the repository at this point in the history
Co-authored-by: Patrik <zepatrik@users.noreply.github.com>
  • Loading branch information
misamu and zepatrik authored Jun 13, 2023
1 parent 262ebbb commit 3ec683d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
9 changes: 3 additions & 6 deletions cmd/server/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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"),
Expand Down
10 changes: 10 additions & 0 deletions persistence/definitions.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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)
}
)

0 comments on commit 3ec683d

Please sign in to comment.