l7mp / stunner

A Kubernetes media gateway for WebRTC. Contact: info@l7mp.io
https://l7mp.io
MIT License
751 stars 58 forks source link

Monitoring: Allocations active metric #140

Closed amm0nite closed 7 months ago

amm0nite commented 7 months ago

Hello!

I'm currently monitoring a TURN server using Stunner (Headless deployment model) and have come across an issue with the stunner_listener_connections metric. This metric is described in the documentation as representing the "Number of active downstream connections at a listener." However, in my setup, it consistently reports a value of 16, which coincidentally matches the --udp-thread-num setting, regardless of the service's actual usage.

I found an answer in the discord that explains that it is expected behavior when using UDP for Stunner as I do. And then there is an interesting message:

That being said, we should really implement a TURN allocation counter that would wrap this API: stunner package - github.com/l7mp/stunner - Go Packages This is a TODO list item currently I'm afraid. If you feel you really need this, please submit an issue at GitHub, we tend to prioritize wishlist items

I looked at the code and found that it was almost already implemented. I made the changes to make it work and validated in my test environment. As suggested in the discord message, i want to submit this to voice the need for the metric!

coveralls commented 7 months ago

Pull Request Test Coverage Report for Build 8817947146

Details


Totals Coverage Status
Change from base Build 8815431142: 0.2%
Covered Lines: 982
Relevant Lines: 1367

💛 - Coveralls
levaitamas commented 7 months ago

Hi @amm0nite,

Thanks for the PR. looks fantastic! I will wait for @rg0now 's response before merging it. If it is not a secret, mind to tell us a few words about your use-case?

rg0now commented 7 months ago

Thanks a lot, this is really useful. If you have similar PRs, don't hold them back...:-)

amm0nite commented 7 months ago

Thanks for checking and merging my pull request! We use Stunner to help with WebRTC video streaming. With this metric I can keep an eye on usage stats and spot if there's a sudden dip in service utilization. This could help me figure out quickly if users are having trouble accessing the service.