Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into janitor-slow-queries
Browse files Browse the repository at this point in the history
  • Loading branch information
Flavio Leggio committed May 20, 2021
2 parents 25be8b0 + eddfa2d commit 58a8177
Show file tree
Hide file tree
Showing 16 changed files with 40 additions and 168 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

29 changes: 13 additions & 16 deletions docs/docs/reference/api.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4608,28 +4608,28 @@ p JSON.parse(result)

<a id="opIdprometheus"></a>

### Get Snapshot Metrics from the Hydra Service.
### Get snapshot metrics from the Hydra service. If you're using k8s, you can then add annotations to

your deployment like so:

```
GET /metrics/prometheus HTTP/1.1

```

If you're using k8s, you can then add annotations to your deployment like so:

```
metadata:
annotations:
prometheus.io/port: "4445"
prometheus.io/port: "4434"
prometheus.io/path: "/metrics/prometheus"
```

If the service supports TLS Edge Termination, this endpoint does not require the
`X-Forwarded-Proto` header to be set.

#### Responses

<a id="get-snapshot-metrics-from-the-hydra-service.-responses"></a>
<a
id="get-snapshot-metrics-from-the-hydra-service.-if-you're-using-k8s,-you-can-then-add-annotations-to
your-deployment-like-so:-responses"
></a>

##### Overview

Expand Down Expand Up @@ -8280,7 +8280,6 @@ _NullTime implements sql.NullTime functionality._
}
],
"Interface": {
"ProtocolScheme": "string",
"Socket": "string",
"Types": [
{
Expand Down Expand Up @@ -8388,7 +8387,6 @@ _PluginConfigArgs plugin config args_

```json
{
"ProtocolScheme": "string",
"Socket": "string",
"Types": [
{
Expand All @@ -8404,11 +8402,10 @@ _PluginConfigInterface The interface between Docker and the plugin_

#### Properties

| Name | Type | Required | Restrictions | Description |
| -------------- | --------------------------------------------------- | -------- | ------------ | ----------------------------------------------------- |
| ProtocolScheme | string | false | none | Protocol to use for clients connecting to the plugin. |
| Socket | string | true | none | socket |
| Types | [[PluginInterfaceType](#schemaplugininterfacetype)] | true | none | types |
| Name | Type | Required | Restrictions | Description |
| ------ | --------------------------------------------------- | -------- | ------------ | ----------- |
| Socket | string | true | none | socket |
| Types | [[PluginInterfaceType](#schemaplugininterfacetype)] | true | none | types |

<a id="tocSpluginconfiglinux"></a>

Expand Down Expand Up @@ -8806,7 +8803,7 @@ _Volume volume_
| Name | string | true | none | Name of the volume. |
| Options | object | true | none | The driver specific options used when creating the volume. |
| » **additionalProperties** | string | false | none | none |
| Scope | string | true | none | The level at which the volume exists. Either `global` for cluster-wide,<br/>or `local` for machine level. |
| Scope | string | true | none | The level at which the volume exists. Either `global` for cluster-wide, or `local` for machine level. |
| Status | object | false | none | Low-level details about the volume, provided by the volume driver.<br/>Details are returned as a map with key/value pairs:<br/>`{"key":"value","key2":"value2"}`.<br/><br/>The `Status` field is optional, and is omitted if the volume driver<br/>does not support this feature. |
| UsageData | [VolumeUsageData](#schemavolumeusagedata) | false | none | VolumeUsageData Usage details about the volume. This information is used by the<br/>`GET /system/df` endpoint, and omitted in other endpoints. |

Expand Down
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
11 changes: 3 additions & 8 deletions internal/httpclient/client/admin/admin_client.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions internal/httpclient/client/public/public_client.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions internal/httpclient/models/plugin_config_interface.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions internal/httpclient/models/volume.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

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.

10 changes: 3 additions & 7 deletions spec/api.json
Original file line number Diff line number Diff line change
Expand Up @@ -846,14 +846,14 @@
},
"/metrics/prometheus": {
"get": {
"description": "If you're using k8s, you can then add annotations to your deployment like so:\n\n```\nmetadata:\nannotations:\nprometheus.io/port: \"4445\"\nprometheus.io/path: \"/metrics/prometheus\"\n```\n\nIf the service supports TLS Edge Termination, this endpoint does not require the\n`X-Forwarded-Proto` header to be set.",
"description": "```\nmetadata:\nannotations:\nprometheus.io/port: \"4434\"\nprometheus.io/path: \"/metrics/prometheus\"\n```",
"produces": [
"plain/text"
],
"tags": [
"admin"
],
"summary": "Get Snapshot Metrics from the Hydra Service.",
"summary": "Get snapshot metrics from the Hydra service. If you're using k8s, you can then add annotations to\nyour deployment like so:",
"operationId": "prometheus",
"responses": {
"200": {
Expand Down Expand Up @@ -2159,10 +2159,6 @@
"Types"
],
"properties": {
"ProtocolScheme": {
"description": "Protocol to use for clients connecting to the plugin.",
"type": "string"
},
"Socket": {
"description": "socket",
"type": "string"
Expand Down Expand Up @@ -2505,7 +2501,7 @@
}
},
"Scope": {
"description": "The level at which the volume exists. Either `global` for cluster-wide,\nor `local` for machine level.",
"description": "The level at which the volume exists. Either `global` for cluster-wide, or `local` for machine level.",
"type": "string"
},
"Status": {
Expand Down
Loading

0 comments on commit 58a8177

Please sign in to comment.