kazeburo / Plack-Middleware-ServerStatus-Lite

Plack-Middleware-ServerStatus-Lite
Other
26 stars 11 forks source link

patch to allow counting of bytes sent #4

Closed kgoess closed 12 years ago

kgoess commented 12 years ago

Hi there, here is a fork with new code that would allow counting and reporting of the bytes sent.

I changed the behavior of your code so that it counts the current request as it is finishing, instead of as it is beginning. It made counting the bytes simpler and I didn't think it was that important, correct me if I'm wrong.

The byte counter wraps around to zero at 2**53 bytes. I explained why in the docs.

The unit test coverage I added was minimal, let me know if you think it should be more extensive.

I changed t/05_counter.t removing the requirement for Cache::FastMmap, which doesn't seem to be used anywhere currently, so the test would have been always skipping up until now. I also changed the test a little so that it will pass if both starman and starlet are installed, maybe that wasn't necessary.

Let me know what you think. And let me know if you are not going to release this soon, since we'd like to use the new code if you're not going to push a release with it, we'll release our own version internally.

Thanks!

kazeburo commented 12 years ago

Hi Kevin.

I just refactored code with Plack::Util::response_cb() https://github.com/kazeburo/Plack-Middleware-ServerStatus-Lite/compare/totalbytes

please check it.

kazeburo commented 12 years ago

released version 0.08 https://metacpan.org/release/KAZEBURO/Plack-Middleware-ServerStatus-Lite-0.08

kgoess commented 12 years ago

Thanks! Sorry, I didn't check my email yesterday.

I left a comment about maybe this line should be $bytes / 1_024 instead of 1_000, up to you. Sorry I didn't think of that earlier.

Other than that it looks good. I like your Guard class, nice approach. Looking forward to running that on our servers. Thank you!

On Thu, Aug 23, 2012 at 1:55 AM, Masahiro Nagano notifications@github.comwrote:

Hi Kevin.

I just refactored code with Plack::Util::response_cb()

https://github.com/kazeburo/Plack-Middleware-ServerStatus-Lite/compare/totalbytes

please check it.

— Reply to this email directly or view it on GitHubhttps://github.com/kazeburo/Plack-Middleware-ServerStatus-Lite/pull/4#issuecomment-7963658.