Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Should we flatten the hierarchy? #752

Closed
henbos opened this issue Apr 3, 2023 · 5 comments
Closed

Should we flatten the hierarchy? #752

henbos opened this issue Apr 3, 2023 · 5 comments
Assignees

Comments

@henbos
Copy link
Collaborator

henbos commented Apr 3, 2023

Having non-observable WebIDL dictionaries that don't map to objects makes the spec less readable.

One argument for having them is not to have to define the same metric in multiple places like outbound-rtp + remote-outbound-rtp and inbound-rtp + remote-inbound-rtp. But saying the shared metrics are the same is not entirely accurate, as local metrics usually come from a local counter and remote metrics usually come from an RTCP packet, so it does make sense to have separate definitions for them.

Can we flatten so that "what you see (in the spec) is what you get"? One dictionary per JS observed object.

@henbos
Copy link
Collaborator Author

henbos commented Apr 3, 2023

@alvestrand @vr000m @jan-ivar thoughts?

@henbos
Copy link
Collaborator Author

henbos commented Apr 3, 2023

The hierarchy made a lot of sense when we had both "track" and "*-rtp" metrics, because then we truly had the same definitions in multiple places, but with the deprecation of "track", I think it s only a matter of time before these are moved to the provisional spec to reflect that they will have been unshipped (Chrome currently has a Deprecation Trial to remove "track" and "stream")

@jan-ivar
Copy link
Member

jan-ivar commented Apr 4, 2023

Having non-observable WebIDL dictionaries that don't map to objects makes the spec less readable.

I don't think it's unreadable because of WebIDL inheritance, but because it's organized around dictionaries in the first place:

image

The above is dense and not very helpful to look things up.

As I mention in mdn/mdn#384 (comment) the better organization is https://w3c.github.io/webrtc-stats/#summary.

The lesson I draw from MDN here is that WebIDL dictionaries aren't APIs, they're details of an API. And if they're a detail, then whether they rely on inheritance or not should in theory also be a detail.

This seems obvious with method APIs like MDN's createDataChannel(label, options), which describes RTCDataChannelInit without mentioning its name (as part of the options input).

It's perhaps less obvious when the API is a maplike RTCStatsReport interface, but that's where MDN is moving stuff in mdn/browser-compat-data#18910, which I think is the right idea (for MDN at least).

I worry about changing the WebIDL inheritance, since that affects lexicographical order of members, a normative change requiring WG consensus.

I think editors should be able to improve the organization of the document a lot without resorting to that.

Step 1 might be to:

  1. restructure the document itself to de-emphasize dictionaries, something like
    • Extensions to stats in RTCStatsReport
      • Breakdown by RTCStatsType:
        • "codec",
          • Introduce RTCCodecStats WebIDL here as a detail (without its own heading) to describe "codec"'s members
        • "inbound-rtp",
          • Introduce RTCInboundRtpStreamStats here as a detail, including its ancestors (ascending or descending list) if this is their first mention
        • "outbound-rtp",
          • Introduce RTCOutboundRtpStreamStats here as a detail
        • etc.

I.e. make the table of contents the RTCStatsTypes.

@vr000m
Copy link
Contributor

vr000m commented Apr 5, 2023 via email

@henbos
Copy link
Collaborator Author

henbos commented May 30, 2023

It's flatten enough :) let's close

@henbos henbos closed this as completed May 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants