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

add prometheus metrics for apis #586

Closed
1 of 2 tasks
drinktee opened this issue Apr 10, 2024 · 2 comments
Closed
1 of 2 tasks

add prometheus metrics for apis #586

drinktee opened this issue Apr 10, 2024 · 2 comments
Labels
devx enhancement New feature or request

Comments

@drinktee
Copy link

Preflight Checklist

  • I could not find a solution in the existing issues, docs, nor discussions
  • I have joined the ZITADEL chat

Describe your problem

It need to add prometheus metrics for apis. Just like http://xxxx:8888/metrics

Describe your ideal solution

add a middleware for metric

Version

No response

Additional Context

No response

@drinktee drinktee added the enhancement New feature or request label Apr 10, 2024
@muhlemmer
Copy link
Collaborator

You can add your own middleware using options:

https://pkg.go.dev/github.com/zitadel/oidc/v3/pkg/op#WithHTTPMiddleware

We already have OpenTelemetry included in the package for metrics. If you define a tracer in your main package and pass the context, you should get metrics out of the OIDC package.

@muhlemmer muhlemmer added the devx label Apr 10, 2024
@muhlemmer
Copy link
Collaborator

It is also possible to configure OTEL to export to prometheus using this package: https://pkg.go.dev/go.opentelemetry.io/otel/exporters/prometheus

All the base infrastructure is already present in OIDC. The package consumer needs to setup otel with the desired exporter, in this case prometheus. Such setup is not in the scope of the OIDC library. Therefore I will now close this issue.

@muhlemmer muhlemmer closed this as not planned Won't fix, can't repro, duplicate, stale Apr 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
devx enhancement New feature or request
Projects
Status: Done
Development

No branches or pull requests

2 participants