httpcompression stats added (#4797)

This commit is contained in:
Georgiy Zatserklianyi 2020-09-20 16:24:05 +03:00 committed by GitHub
parent 5e997587d9
commit 70c82d33c0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 0 deletions

View File

@ -37,6 +37,8 @@ class HttpCompressionMiddleware:
if content_encoding:
encoding = content_encoding.pop()
decoded_body = self._decode(response.body, encoding.lower())
spider.crawler.stats.inc_value('httpcompression/response_bytes', len(decoded_body), spider=spider)
spider.crawler.stats.inc_value('httpcompression/response_count', spider=spider)
respcls = responsetypes.from_args(
headers=response.headers, url=response.url, body=decoded_body
)