Roundup Tracker - Issues

Message7320

Author rouilj
Recipients rouilj
Date 2021-08-19.00:24:21
Message-id <1629332662.57.0.768675238344.issue2551153@roundup.psfhosted.org>
In-reply-to
See issue2550736 for a discussion on exposing performance stats.

Expose available statistics (db time, total time) via one or more
Server-Timing headers. The current internal header representation uses
a dict for header name/value. You can't represent multiple
Server-Status headers in it, but multiple timing stats can be emitted
in a single header.

A Server-Timing value (should all be on one line) looks like:

    template;desc="rendering issue index template", db;dur=53.3,
    total;dur=180;desc="total time to process"

defines three separate statistics:

    a metric called template that has no duration but indicates that
       an index template was being rendered

    a metric called db with duration of 53.3 milliseconds

    a metric called total with 180ms duration.
    
all durations are in ms, no labels.

As part of this, consider modifying the header processing mechanism to
support a value that is not a string but a list of strings. If the
header value is a list of strings, one header should be emitted for
each element in the list. So:

   self.additional_headers[{'Server-Timing'] = []
   self.additional_headers['Server-
Timing'].append('template;desc="rendering issue index template"'
   self.additional_headers['Server-Timing'].append('db;dur=53.3')

this should produce the headers:

   Server-Timing: template;desc="rendering issue index template"
   Server-Timing: db;dur=53.3

look like the various implementations of start_response (defined in
both roundup and frontends directories) would be a good place to
expand this. Also Client.header() turns the dictionary into a list of
headers, so it could be expanded in header too.

Currently the stats are reported in the body of the returned HTML page.
The Server-Timing values for total render time can be added there
but it may make more sense to add the stats in Client.header()
as it is pretty much the last place we can set the values.

This isn't perfect as we can't account for the time spent writing the
body to the socket. There is a way to add a Server-Timing header as a
Trailer to the body. However using a trailer seems only to be allowed
if the response is using chunked-encoding.
History
Date User Action Args
2021-08-19 00:24:22rouiljsetrecipients: + rouilj
2021-08-19 00:24:22rouiljsetmessageid: <1629332662.57.0.768675238344.issue2551153@roundup.psfhosted.org>
2021-08-19 00:24:22rouiljlinkissue2551153 messages
2021-08-19 00:24:21rouiljcreate