catchpoint / WebPageTest.agent

Cross-platform WebPageTest agent
Other
213 stars 138 forks source link

Backfill sequence numbers for any request missing them #572

Closed pmeenan closed 1 year ago

pmeenan commented 1 year ago

There was a previous fix for netlog requests that were missing sequence numbers and it shouldn't be possible for there to be any requests that don't have sequence numbers but there are some reports of some errors with $WPT_REQUESTS still so just to be absolutely positive, this fills in the sequence number for any request that may be missing one (allowing the sort to happen).

pmeenan commented 1 year ago

The sequence numbers added here are just for the time when they are extracted for custom metrics. The underlying sequence numbers with the raw request data doesn't get modified.

It does take a bit of digging to see that get_requests calls get_request which constructs a new request object that it then populates with the request details so the request object here is pointing to a one-time list of one-time request objects so the sequence numbers won't be re-used.

That said, given the layers it takes to figure that out, it would be cleaner to just have get_request guarantee a sequence number is present and have it increment the main sequence numbers to be sure that there is no way it changes in the future.

PR update coming.

pmeenan commented 1 year ago

@stoyan I moved the sequence updating to the raw underlying request data (and used the persistent sequence numbers).