fluxcloud icon indicating copy to clipboard operation
fluxcloud copied to clipboard

Expose a HTTP endpoint with the last $N events for polling

Open paddycarey opened this issue 6 years ago • 3 comments

I was wondering if it would be desirable for fluxcloud to expose a HTTP endpoint which would return a list of the events it's received (limited to some user configurable value for memory reasons) that could be polled by an external service?

We have a use case where we'd like to receive flux events in a system where we can't accept inbound connections (so webhooks don't work) but we can make outbound connections to other services.

I'm not sure if this even makes sense for fluxcloud or should be its own service that fluxcloud can talk to via webhooks. Maybe even something like a redis/kafka/whatever exporter would work (fluxcloud writes events to redis, we poll redis for new events 🤷‍♂️ ).

Wanted to find out what you think before trying to implement this.

paddycarey avatar Nov 29 '18 13:11 paddycarey

This is an interesting use-case. My main apprehension there is we would need to maintain some state to ensure you could retrieve events even after a restart. I think adding an exporter for a some queue that you use would be the best bet.

I’m happy to write the Redis exporter - but not sure when I’ll be able to get to it, so if you want it sooner I’m happy to accept the contribution!

oliviabarrick avatar Dec 01 '18 20:12 oliviabarrick

We could also expose detailed prometheus metrics?

oliviabarrick avatar Dec 01 '18 23:12 oliviabarrick

I like the prometheus metric part!

sfrique avatar Dec 04 '18 22:12 sfrique