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 support #211

Closed
imraan-go opened this issue Sep 20, 2021 · 6 comments · Fixed by #216
Closed

Add prometheus support #211

imraan-go opened this issue Sep 20, 2021 · 6 comments · Fixed by #216
Labels
enhancement New feature or request

Comments

@imraan-go
Copy link

imraan-go commented Sep 20, 2021

Looking at the source code of bunotel, looks like it only support traces. Do you have any plan to support metrics exporting perhaps via opentelemetry? I want to export http metrics along with bun metrics to prometheus.

@vmihailenco vmihailenco added the enhancement New feature or request label Sep 20, 2021
@vmihailenco
Copy link
Member

Yes, bunotel will support metrics. The rough estimation is next week.

@imraan-go
Copy link
Author

Any example usage with Treemux router is appreciated. Since metrics collection documentation is missing in the official bun website. @vmihailenco

@vmihailenco
Copy link
Member

vmihailenco commented Sep 29, 2021

Well, all you should do is to configure OpenTelemetry to export metrics to Prometheus. I will write an article at blog.uptrace.dev for SEO purposes :), but for now you can try to figure that for yourself - https://github.com/open-telemetry/opentelemetry-go/blob/main/example/prometheus/main.go . The only treemux specific line is http.HandleFunc("/", exporter.ServeHTTP) which can be written as:

-http.HandleFunc("/", exporter.ServeHTTP)
+router.Compat().GET("/", exporter.ServeHTTP)

After that you need to visualize the data somehow. With Uptrace it looks something like this

bun-metrics

The histogram accuracy (p50) is really bad, but it will be improved with exponential histograms - github.com/open-telemetry/opentelemetry-go/pull/2261.

@j2gg0s
Copy link
Collaborator

j2gg0s commented Oct 27, 2021

I come too late, do you mind i recommand otsql at here .
It supports prometheus & opentelemetry by hook of database/sql .
@vmihailenco

@vmihailenco
Copy link
Member

vmihailenco commented Oct 27, 2021

@j2gg0s I've already mentioned it here and will add it to the bun readme as well.

I still hope to add instructions for OpenTelemetry and Prometheus, just was busy working on OpenTelemetry mentrics documentation...

@vmihailenco
Copy link
Member

vmihailenco commented Oct 28, 2021

I've added links at bun, but the main doc is here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants