Most companies where I worked, used only native solutions for this, e.g. for Linux there are quite a few solutions, e.g.: vnStat, iftop, or the more known MRTG
您必须创建自己的 HttpServletResponseWrapper,然后重写方法 createOutputStream(),您可以执行自己的 OutputStream 并将计数器附加到 write(init i)、write(byte[] bytes) 和 write(byte[] bytes, int off, int length),这并不容易听起来不错,但这样你就可以知道每个响应的长度。
You have to make your own HttpServletResponseWrapper and then override method createOutputStream(), which you can do your own OutputStream with counter appened to write(init i), write(byte[] bytes) and write(byte[] bytes, int off, int length), It's not easy as it sounds, but this way you can know the length of each response.
发布评论
评论(3)
我工作过的大多数公司都只使用本机解决方案,例如对于 Linux,有很多解决方案,例如:vnStat、iftop 或更知名的 MRTG
Most companies where I worked, used only native solutions for this, e.g. for Linux there are quite a few solutions, e.g.: vnStat, iftop, or the more known MRTG
您必须创建自己的
HttpServletResponseWrapper
,然后重写方法createOutputStream()
,您可以执行自己的OutputStream
并将计数器附加到write(init i)
、write(byte[] bytes)
和write(byte[] bytes, int off, int length)
,这并不容易听起来不错,但这样你就可以知道每个响应的长度。You have to make your own
HttpServletResponseWrapper
and then override methodcreateOutputStream()
, which you can do your ownOutputStream
with counter appened towrite(init i)
,write(byte[] bytes)
andwrite(byte[] bytes, int off, int length)
, It's not easy as it sounds, but this way you can know the length of each response.也许您想使用 Lambda 探针
它免费、易于部署,并具有实时流量图表和其他一些额外优势。
Maybe you want to use Lambda Probe
Its free, easy to deploy and has realtime traffic charts and some other additional benefits.