Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(42)

Issue 6317011: Add histogram for HTTP response codes (Closed)

Created:
9 years, 11 months ago by gavinp
Modified:
9 years, 6 months ago
CC:
chromium-reviews, cbentzel+watch_chromium.org, darin-cc_chromium.org
Visibility:
Public.

Description

Add histogram for HTTP response codes This adds an histogram to the HTTP response header parser. I reviewed the code, and I've convinced myself that this captures the two main cases of HTTP header parsing (tunneling, and normal HTTP), and that double-calls aren't occuring. I liked having all the code in the one translation unit. But, I might have missed one, and we might still be getting called twice for the same load: so the statistics might be off. Alternatively, I could put a static function on HttpResponseHeader, to be called from the site of parse. But this might miss a parse. All in all, I wanted to be sure to catch all distinct response codes we get, so we can be sure not to stomp on anything. So I chose the approach using the HttpResponseHeaders constructor. TEST=none BUG=70428 Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=72801

Patch Set 1 : fix lint + range #

Total comments: 8

Patch Set 2 : remediation to review #

Total comments: 9

Patch Set 3 : remedation to reivew #

Total comments: 10

Patch Set 4 : address reviews from wtc and jar #

Unified diffs Side-by-side diffs Delta from patch set Stats (+46 lines, -0 lines) Patch
M net/http/http_response_headers.cc View 1 2 3 3 chunks +46 lines, -0 lines 0 comments Download

Messages

Total messages: 23 (0 generated)
gavinp
9 years, 11 months ago (2011-01-21 19:19:02 UTC) #1
gavinp
Made a second upload after realising a lint boo-boo plus a mistake with a range.
9 years, 11 months ago (2011-01-21 19:21:57 UTC) #2
jar (doing other things)
I only see one upload. Did you really do a second upload? Jim On Fri, ...
9 years, 11 months ago (2011-01-21 20:28:26 UTC) #3
cbentzel
http://codereview.chromium.org/6317011/diff/7001/net/http/http_response_headers.cc File net/http/http_response_headers.cc (right): http://codereview.chromium.org/6317011/diff/7001/net/http/http_response_headers.cc#newcode96 net/http/http_response_headers.cc:96: std::vector<int> codes; How expensive is this? It looks like ...
9 years, 11 months ago (2011-01-21 20:33:25 UTC) #4
jar (doing other things)
Is this code called from anywhere? Are there additional files in this CL? Also, please ...
9 years, 11 months ago (2011-01-21 20:37:46 UTC) #5
jar (doing other things)
http://codereview.chromium.org/6317011/diff/7001/net/http/http_response_headers.cc File net/http/http_response_headers.cc (right): http://codereview.chromium.org/6317011/diff/7001/net/http/http_response_headers.cc#newcode96 net/http/http_response_headers.cc:96: std::vector<int> codes; This is only done during the initialization ...
9 years, 11 months ago (2011-01-21 20:40:36 UTC) #6
cbentzel
One concern - is HttpResponseHeaders too low level a location for this? It seems like ...
9 years, 11 months ago (2011-01-21 21:33:08 UTC) #7
gavinp
I really did do the second upload talked about earlier Jim, but to "reduce confusion" ...
9 years, 11 months ago (2011-01-21 21:38:18 UTC) #8
gavinp
On 2011/01/21 21:33:08, cbentzel wrote: > One concern - is HttpResponseHeaders too low level a ...
9 years, 11 months ago (2011-01-21 21:44:19 UTC) #9
gavinp
*PING*
9 years, 11 months ago (2011-01-25 01:17:41 UTC) #10
cbentzel
Adding willchan, wtc, and eroman who may also have good ideas for where to place ...
9 years, 11 months ago (2011-01-25 16:47:22 UTC) #11
willchan no longer on Chromium
On Tue, Jan 25, 2011 at 8:47 AM, <cbentzel@chromium.org> wrote: > Adding willchan, wtc, and ...
9 years, 11 months ago (2011-01-25 17:22:53 UTC) #12
gavinp
On 2011/01/25 16:47:22, cbentzel wrote: > > In the case of a tunnel establishment, the ...
9 years, 11 months ago (2011-01-25 18:18:05 UTC) #13
jar (doing other things)
LGTM
9 years, 11 months ago (2011-01-25 18:30:16 UTC) #14
willchan no longer on Chromium
Ok, I was wrong about the copying, so don't worry about that. Ok, here's the ...
9 years, 11 months ago (2011-01-25 18:30:58 UTC) #15
wtc
It seems useful to have separate histograms for the HTTP GET, POST, and CONNECT methods. ...
9 years, 11 months ago (2011-01-25 18:38:00 UTC) #16
gavinp
On 2011/01/25 18:38:00, wtc wrote: > It seems useful to have separate histograms for the ...
9 years, 11 months ago (2011-01-25 20:42:54 UTC) #17
gavinp
On 2011/01/25 18:30:58, willchan wrote: > Ok, I was wrong about the copying, so don't ...
9 years, 11 months ago (2011-01-26 01:42:17 UTC) #18
gavinp
http://codereview.chromium.org/6317011/diff/17001/net/http/http_response_headers.cc File net/http/http_response_headers.cc (right): http://codereview.chromium.org/6317011/diff/17001/net/http/http_response_headers.cc#newcode95 net/http/http_response_headers.cc:95: kHistogramMaxHttpResponseCode = 599 }; On 2011/01/25 18:38:00, wtc wrote: ...
9 years, 11 months ago (2011-01-26 01:42:45 UTC) #19
gavinp
remediated to latest reviews. Thanks everyone!
9 years, 11 months ago (2011-01-26 01:47:05 UTC) #20
wtc
LGTM. http://codereview.chromium.org/6317011/diff/29001/net/http/http_response_headers.cc File net/http/http_response_headers.cc (right): http://codereview.chromium.org/6317011/diff/29001/net/http/http_response_headers.cc#newcode92 net/http/http_response_headers.cc:92: // ares are not sent in practice, to ...
9 years, 11 months ago (2011-01-26 19:03:11 UTC) #21
jar (doing other things)
http://codereview.chromium.org/6317011/diff/29001/net/http/http_response_headers.cc File net/http/http_response_headers.cc (right): http://codereview.chromium.org/6317011/diff/29001/net/http/http_response_headers.cc#newcode95 net/http/http_response_headers.cc:95: kHistogramMaxHttpResponseCode = 599, nit: On Chrome, we use MACRO_STYLE_NAMING ...
9 years, 11 months ago (2011-01-26 21:33:14 UTC) #22
gavinp
9 years, 11 months ago (2011-01-27 00:04:36 UTC) #23
Thanks for the reviews everyone!  Willchan, I put together a python server that
provides 100 response codes, and I've confirmed the writeup above: when 100
response code is provided, nothing is double counted.

http://codereview.chromium.org/6317011/diff/29001/net/http/http_response_head...
File net/http/http_response_headers.cc (right):

http://codereview.chromium.org/6317011/diff/29001/net/http/http_response_head...
net/http/http_response_headers.cc:92: // ares are not sent in practice, to
reduce upload size & memory use.
On 2011/01/26 19:03:11, wtc wrote:
> Typo: remove 'ares', or change it to 'ones'

Done.

http://codereview.chromium.org/6317011/diff/29001/net/http/http_response_head...
net/http/http_response_headers.cc:95: kHistogramMaxHttpResponseCode = 599,
On 2011/01/26 19:03:11, wtc wrote:
> The formatting is still wrong.  It should be:
> 
> enum {
>     kHistogramMinHttpResponseCode = 100,
>     kHistogramMaxHttpResponseCode = 599,
> };

Done.

http://codereview.chromium.org/6317011/diff/29001/net/http/http_response_head...
net/http/http_response_headers.cc:95: kHistogramMaxHttpResponseCode = 599,
On 2011/01/26 21:33:14, jar wrote:
> nit: On Chrome, we use MACRO_STYLE_NAMING for enums (contrary to google3).
> 
> see: https://sites.google.com/a/chromium.org/dev/developers/coding-style

Done.

http://codereview.chromium.org/6317011/diff/29001/net/http/http_response_head...
net/http/http_response_headers.cc:103: // range [kHistogramMinHttpResponseCode,
kHistogramMaxHttpResponseCode].
On 2011/01/26 19:03:11, wtc wrote:
> I see that you already explained the 0 histogram value at lines 89-90 above.
> So you may remove this comment I asked you to add.

Done.

http://codereview.chromium.org/6317011/diff/29001/net/http/http_response_head...
net/http/http_response_headers.cc:141: // instantiating the histogram in two
places.
On 2011/01/26 19:03:11, wtc wrote:
> You should also explain why the other constructors don't call this histogram.
> 
> I would not do the histogram in a HttpResponseHeaders constructor because
> this side effect is not obvious, but this may be a matter of personal taste.
> 
> Nit: don't abbreviate "def'n".

Done.

Powered by Google App Engine
This is Rietveld 408576698