Webhooks for machine states?

I am looking for a solution that would allow me to track when the machines are running, suspended, etc.

I am building a hosting service on top of Fly and this is needed to accurately bill the end customers.

As I don’t see any mention in the documentation, any solutions?

Using API to poll is non-viable due to rate limits as there will be thousands of machines.

1 Like

I hacked something together using API, but yeah – it means hitting Fly API every few seconds.

Found a semi decent solution.

If I increase the interval, and instead of checking the current state, I check the events associated with the machine, that works quite well. Just a lot more complicated logic.

Your product might be eligible for the Extensions Program. If so, you’ll get access to Outbound Webhooks which include machine state changes.

If you don’t go that route, API polling and direct Prometheus integration are the two threads I’d pull on. Word of caution that Fly Metrics can be a bit rocky at times, so I would only suggest that interface for convenience and make sure you have a reconciliation plan for true-up.

2 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.