w3c / server-timing

Server Timing
http://w3c.github.io/server-timing/
Other
75 stars 20 forks source link

clarify incomplete params #46

Closed cvazac closed 6 years ago

cvazac commented 6 years ago

The spec currently reads:

If any parameter is specified more than once, only the first instance is to be considered. All subsequent occurrences MUST be ignored without signaling an error or otherwise altering the processing of the server-timing-metric.

I think we need to clarify three scenarios, where a param name is supplied with no valid param value

1) metric;dur=123.4;dur=567.8 yields a duration of 123.4 in chrome 2) metric;dur=foo;dur=567.8 yields a duration of 0 in chrome 3) metric;dur;dur=123.4 yields a duration of 123.4 in chrome

cvazac commented 6 years ago

I suspect that there's no debate on 1).

Examples 2) and 3) could be considered discrepant. If we convert the empty string of the first dur param in 3), we'd get a 0.

Consistency options: A) 2) & 3) both return a 0 duration B) 2) returns 567.8 and 3) returns 123.4

yoavweiss commented 6 years ago

Seems to me that A) is the more consistent option, and it's also what would naturally fall out of HTML's parsing rules.

IMO, we should clarify the spec language around that, and change implementations and tests accordingly.

KershawChang commented 6 years ago

I think A) is better, since it would make the code a bit easier. I mean we can just take the string after "dur" without checking if it's a valid double value.

cvazac commented 6 years ago

fixed with: https://github.com/w3c/server-timing/pull/47