Skip to content

Commit

Permalink
fix: prometheus URL label (#2503)
Browse files Browse the repository at this point in the history
Fixes #2502
  • Loading branch information
seremenko-wish authored May 19, 2021
1 parent 64022e8 commit f588ec6
Show file tree
Hide file tree
Showing 10 changed files with 16 additions and 132 deletions.
9 changes: 8 additions & 1 deletion cmd/server/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@ import (
"github.com/ory/hydra/driver"
"github.com/ory/hydra/driver/config"
"github.com/ory/hydra/jwk"
"github.com/ory/hydra/metrics/prometheus"
"github.com/ory/hydra/oauth2"
"github.com/ory/hydra/x"
prometheus "github.com/ory/x/prometheusx"
)

var _ = &consent.Handler{}
Expand Down Expand Up @@ -94,6 +94,8 @@ func RunServeAdmin(cmd *cobra.Command, args []string) {
admin, _, adminmw, _ := setup(d, cmd)
cert := GetOrCreateTLSCertificate(cmd, d, config.AdminInterface) // we do not want to run this concurrently.

d.PrometheusManager().RegisterRouter(admin.Router)

var wg sync.WaitGroup
wg.Add(1)

Expand All @@ -118,6 +120,8 @@ func RunServePublic(cmd *cobra.Command, args []string) {
_, public, _, publicmw := setup(d, cmd)
cert := GetOrCreateTLSCertificate(cmd, d, config.PublicInterface) // we do not want to run this concurrently.

d.PrometheusManager().RegisterRouter(public.Router)

var wg sync.WaitGroup
wg.Add(1)

Expand All @@ -140,6 +144,9 @@ func RunServeAll(cmd *cobra.Command, args []string) {

admin, public, adminmw, publicmw := setup(d, cmd)

d.PrometheusManager().RegisterRouter(admin.Router)
d.PrometheusManager().RegisterRouter(public.Router)

var wg sync.WaitGroup
wg.Add(2)

Expand Down
1 change: 0 additions & 1 deletion contrib/quickstart/5-min/hydra.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,3 @@ oidc:
- public
pairwise:
salt: youReallyNeedToChangeThis

2 changes: 1 addition & 1 deletion driver/registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (

"github.com/ory/hydra/persistence"

"github.com/ory/hydra/metrics/prometheus"
prometheus "github.com/ory/x/prometheusx"

"github.com/ory/x/dbal"
"github.com/ory/x/healthx"
Expand Down
5 changes: 3 additions & 2 deletions driver/registry_base.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import (
"strings"
"time"

prometheus "github.com/ory/x/prometheusx"

"github.com/pkg/errors"

"github.com/ory/hydra/x/oauth2cors"
Expand All @@ -16,7 +18,6 @@ import (

"github.com/prometheus/client_golang/prometheus/promhttp"

"github.com/ory/hydra/metrics/prometheus"
"github.com/ory/x/logrusx"

"github.com/gorilla/sessions"
Expand Down Expand Up @@ -442,7 +443,7 @@ func (m *RegistryBase) Tracer(ctx context.Context) *tracing.Tracer {

func (m *RegistryBase) PrometheusManager() *prometheus.MetricsManager {
if m.pmm == nil {
m.pmm = prometheus.NewMetricsManager(m.buildVersion, m.buildHash, m.buildDate)
m.pmm = prometheus.NewMetricsManager("hydra", m.buildVersion, m.buildHash, m.buildDate)
}
return m.pmm
}
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ require (
github.com/ory/go-acc v0.2.6
github.com/ory/graceful v0.1.1
github.com/ory/herodot v0.9.3
github.com/ory/x v0.0.233
github.com/ory/x v0.0.237
github.com/pborman/uuid v1.2.1
github.com/phayes/freeport v0.0.0-20180830031419-95f893ade6f2
github.com/philhofer/fwd v1.1.1 // indirect
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1210,6 +1210,8 @@ github.com/ory/x v0.0.205/go.mod h1:A1s4iwmFIppRXZLF3J9GGWeY/HpREVm0Dk5z/787iek=
github.com/ory/x v0.0.207/go.mod h1:sBgvUAcmc2lmtOBe5VMcV2vNAlADT4bkFHomG29y7N4=
github.com/ory/x v0.0.233 h1:AiBvucFkE054XJ04OnUziM9Ect5nR/NbMe5101EBjVE=
github.com/ory/x v0.0.233/go.mod h1:0mSGWLFgcqckIvgexka1GJK/sshYrFFkU7lPajzGTFw=
github.com/ory/x v0.0.237 h1:sFcWr8EcOYrPb30tsWk3BZM7jdzHeBAqaOSHveizmfs=
github.com/ory/x v0.0.237/go.mod h1:KPgNsUzpztH15EZdw5HjurtTe+mXQ34yqMCCTb5BZAc=
github.com/pact-foundation/pact-go v1.0.4/go.mod h1:uExwJY4kCzNPcHRj+hCR/HBbOOIwwtUjcrb0b5/5kLM=
github.com/parnurzeal/gorequest v0.2.15/go.mod h1:3Kh2QUMJoqw3icWAecsyzkpY7UzRfDhbRdTjtNwNiUE=
github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc=
Expand Down
26 changes: 0 additions & 26 deletions metrics/prometheus/doc.go

This file was deleted.

68 changes: 0 additions & 68 deletions metrics/prometheus/metrics.go

This file was deleted.

31 changes: 0 additions & 31 deletions metrics/prometheus/middleware.go

This file was deleted.

2 changes: 1 addition & 1 deletion x/tls_termination.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import (
"github.com/pkg/errors"
"github.com/urfave/negroni"

"github.com/ory/hydra/metrics/prometheus"
"github.com/ory/x/healthx"
prometheus "github.com/ory/x/prometheusx"
"github.com/ory/x/stringsx"
)

Expand Down

0 comments on commit f588ec6

Please sign in to comment.