Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add new prometheus metrics endpoint #672 #673

Merged
merged 2 commits into from
Aug 27, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions .schema/api.swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,24 @@
}
}
},
"/metrics/prometheus": {
"get": {
"description": "```\nmetadata:\nannotations:\nprometheus.io/port: \"4445\"\nprometheus.io/path: \"/metrics/prometheus\"\n```",
"produces": [
"plain/text"
],
"tags": [
"admin"
],
"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": {
"description": "Empty responses are sent when, for example, resources are deleted. The HTTP status code for empty responses is\ntypically 201."
}
}
}
},
"/recovery/link": {
"post": {
"description": "This endpoint creates a recovery link which should be given to the user in order for them to recover\n(or activate) their account.",
Expand Down
4 changes: 4 additions & 0 deletions cmd/daemon/serve.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import (
"strings"
"sync"

"github.com/ory/kratos/metrics/prometheus"

"github.com/ory/analytics-go/v4"

"github.com/ory/x/flagx"
Expand Down Expand Up @@ -84,6 +86,7 @@ func serveAdmin(d driver.Driver, wg *sync.WaitGroup, cmd *cobra.Command, args []
r.RegisterAdminRoutes(router)
n.Use(NewNegroniLoggerMiddleware(l, "admin#"+c.SelfAdminURL().String()))
n.Use(sqa(cmd, d))
n.Use(d.Registry().PrometheusManager())

if tracer := d.Registry().Tracer(); tracer.IsLoaded() {
n.Use(tracer)
Expand Down Expand Up @@ -144,6 +147,7 @@ func sqa(cmd *cobra.Command, d driver.Driver) *metricsx.Service {
strings.ReplaceAll(verification.PublicVerificationInitPath, ":via", "email"),
verification.PublicVerificationRequestPath,
errorx.ErrorsPath,
prometheus.MetricsPrometheusPath,
},
BuildVersion: d.Registry().BuildVersion(),
BuildHash: d.Registry().BuildHash(),
Expand Down
3 changes: 3 additions & 0 deletions docs/docs/admin/managing-users-identities.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ To create the account recovery link, use:
]}>
<TabItem value="curl">


```shell script
$ curl --request POST -sL \
--header "Content-Type: application/json" \
Expand All @@ -93,6 +94,7 @@ $ curl --request POST -sL \
</TabItem>
<TabItem value="go">


```go
package main

Expand Down Expand Up @@ -143,6 +145,7 @@ email, this feature is tracked as
</TabItem>
</Tabs>


### Import a User Identity

This feature is not implemented yet.
Expand Down
Loading