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

Support fasthttp #356

Closed
krisdioles opened this issue Oct 20, 2017 · 8 comments
Closed

Support fasthttp #356

krisdioles opened this issue Oct 20, 2017 · 8 comments

Comments

@krisdioles
Copy link

So, currently there is no way (or is it?) to implement this lib to fasthttp. Is there any plans to support it? Or how to contribute?

@metalmatze
Copy link
Member

What exactly are you trying to accomplish with fasthttp that this lib shouldn't be able to do?

@beorn7
Copy link
Member

beorn7 commented Oct 20, 2017

I don't have experience with fasthttp. But the interface is clearly defined here. Similar to the promhttp package, you could create a promfasthttp (which doesn't even need to be in the same repo). You only need something like HandlerFor. As you can see in https://github.com/prometheus/client_golang/blob/master/prometheus/promhttp/http.go , it's not really a lot of code.

@krisdioles
Copy link
Author

krisdioles commented Oct 21, 2017

So I have trouble exposing /metrics on services that uses fasthttp instead of net/http.

Anyhow I already succeeded on creating the HandleFor equivalent for fasthttp and I have tested /metrics served by fasthttp on my dev side and it worked.

My question is, should I code that on my side or should I code that on this repo? So that others that want to use this client on fasthttp can use it.

@beorn7
Copy link
Member

beorn7 commented Oct 21, 2017

I would suggest to keep it simple and create a package in a repository you own. For users, it's really not a big difference between import "github.com/prometheus/client_golang/prometheus/promfasthttp" and import "github.com/prometheus/client_golang/krisdioles/promfasthttp". We can link your package from the doc here to give people a pointer. At this time, I'm not a fan of tightly coupling promfasthttp with the packages here and thus take an additional maintenance burden. Should it turn out at some point that the world is really using only net/http and fasthttp and nothing else, we can take a raincheck if having both here makes sense.

@krisdioles
Copy link
Author

Ok thanks for your replies and explanation. Closing this.

@gaby
Copy link

gaby commented Mar 9, 2024

@beorn7 Any chance of taking a 2nd look at this after 8 years?

I'm one of the maintainers for https://github.com/gofiber/fiber which is based on fasthttp. I'm in the process of integrating a middleware for prometheus but in the current state we would need to convert each fasthttp request to net/http which adds a ton of overhead.

I noticed @krisdioles has an implementation of promfasthttp here main...krisdioles:client_golang:fasthttp but it is probably outdated by now.

@beorn7
Copy link
Member

beorn7 commented Mar 11, 2024

I don't maintain this repo any longer. The call has to be made by @bwplotka @kakkoyun @ArthurSens .

Generally, I still think this can be in a separate repository. If it turns out to be generally useful and popular, we can think about moving it over here.

@bwplotka
Copy link
Member

Yup, as have been said here: #356 (comment) -- there are many HTTP framework around, but not really popular ones (compared to std one).

One option would be to use some interfaces (or generics) for more generic version of promhttp, but those might defy the point of fast HTTP (there is some overhead for interfaces and generics).

I would say let's collaborate (e.g. by copying promhttp and tailor for fasthttp) on separate Go module and repo first (we could put it in prometheus-community GitHub org). I would say also a decent place for it would be actually in https://github.com/valyala/fasthttp repo too if @valyala (or other fasthttp maintainers) would be up for it 🤗

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

No branches or pull requests

5 participants