- From: Hugo Arregui <hugo.arregui@mykolab.com>
- Date: Sat, 29 Jun 2019 14:41:44 -0300
- To: westhawk <thp@westhawk.co.uk>
- Cc: public-webrtc@w3.org
[Sorry I realise now that I didn't send my answer to the mailing list] Hello again, Thanks for your comments and suggestions! > and given that this is a fresh API and outside the browser you > are free to do as you will ;-) > but I think ObjectID is a bit too broad - perhaps StatsID ? I thought it might be useful to share the approach we decided to follow: We added the statsID to every monitored object, but we are keeping it private. Taking advantage of the fact that in go objects of the same package can access private members of each other, we added a set of helper methods to the report object to retrieve the associated stats of a given monitored object, for example: ``` func (r StatsReport) GetConnectionStats(conn *PeerConnection) (PeerConnectionStats, bool) { statsID := conn.getStatsID() stats, ok := r[statsID] ... return pcStats, true } ``` This is a pretty neat API IMO, but unfortunately this is not a portable solution, since it relies on the package visibility of the go programming language. IMHO exposing the stats id of the monitored objects will help to have a cleaner API when you are doing things like online analysis (I mean that as oppose of storing stats for offline processing later). Thanks again! Regards, Hugo
Received on Saturday, 29 June 2019 17:42:10 UTC