-
Notifications
You must be signed in to change notification settings - Fork 119
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
prometheus:stop() hangs when run from an ejabberd module #66
Comments
Hi, glad you found this lib useful :-) Will look into this shortly. |
I've done some further investigation. It looks like there's a deadlock because the I guess I could just refrain from stopping the prometheus application completely. ejabberd does this as well for a bunch of internally used applications. But that doesn't really feel clean. I've also tried to call |
Frankly I'm not that familiar with ejabberd plugin architecture (although I am (was) planning to write a plugin). So I need some time to learn it. The problem as I see from your latest comment is that this Also I don't know what's your use-case, but there is https://github.com/deadtrickster/prometheus-httpd with |
Interesting! Are you planning on collecting additional application-specific metrics like you did for RabbitMQ (e.g. online users per vhost)?
Yep, I think so.
Yeah, I've seen that. However, ejabberd has a built-in HTTP server that we're already using, so I want to expose it there. As you can see, it's not a lot of code (thanks to you). |
You know, it'd be really cool if you find time to write the plugin. I can help of course.
Yeah, but you missing content negotiation, compression and authentication.
Can we somehow inject prometheus to ejabber supervision tree? You tried it and it didn't work? |
Let me get a barebones plugin working locally and then we can talk about it. 🙂
I wasn't aware of
I didn't add |
Hi, how's it going? Maybe spawn_link a new process in stop/1, trap_exit and after 'main' process exits call prometheus:stop? Also, why you want to stop it anyway :-) |
ejabberd modules have to implement the Would you mind sketching out your idea in a bit more detail? |
Yes, hopefully soon. So stop/1 called with Host. Will it be called for all Hosts or just for one? |
It depends on how you register it. Since the general metrics are not host-specific, I worked around this by just registering it for a single host, i.e. |
Thanks, But can we stop ejabberd plugin for specific Host? or they stopped globally? In former case stopping prometheus isn't good for other running Hosts... |
Yes, you can stop plugins for a specific host. For me, that's not a problem. But for the general case that's undesirable. I guess it would be better to "attach" it to the ejabberd application but I don't think ejabberd provides a hook to do so. |
I spent today working on a gatherer for ejabberd, and actually didn't get much further than the code in the first comment on my own. There is also a basic exporter at https://github.com/skythet/ejabberd-prometheus-exporter/blob/master/mod_prometheus.erl - however I'd much rather use this library. |
First of all, thanks for creating this library, very useful!
I'm trying to implement an ejabberd module that uses
prometheus
:Here's what I have:
However, when I shutdown/restart ejabberd,
prometheus:stop()
never returns:Do you have an idea how I can find out what's going on? Any help would be highly appreciated!
The text was updated successfully, but these errors were encountered: