rack-attack icon indicating copy to clipboard operation
rack-attack copied to clipboard

Would you agree to support a track response support?

Open flevour opened this issue 12 years ago • 3 comments

I am seeing a need to be able to apply track functionality based on response codes. The possible use case I see is stats tracking of API calls by response code. I am willing to provide a PR if you think it makes sense to integrate with rack-attack.

flevour avatar Aug 08 '14 10:08 flevour

@flevour why should this be part of rack-attack instead of a separate HTTP code-tracking Rack middleware?

zmillman avatar Aug 08 '14 21:08 zmillman

@flevour: Interesting. I'm hesitant to expand the track functionality to include responses. Adding tracks for requests was b/c it was such a close fit to how we're already blocking & throttling other requests.

For simplicity and focus, I'd like to keep parsing responses outside the scope of rack-attack. You could implementing response tracking as a separate middleware or gem (per @zmillman's suggesting).

ktheory avatar Aug 08 '14 21:08 ktheory

In my case I'd want to throttle only successful requests to API over a given period. Basically I'm re-using the whole rack-attack count-over-period logic but to throttle responses. I see your point about simplicity/focus though, thanks for sharing your thoughts!

flevour avatar Aug 11 '14 09:08 flevour