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

[MM-60561] RTC client metrics #159

Merged
merged 3 commits into from
Oct 9, 2024
Merged

[MM-60561] RTC client metrics #159

merged 3 commits into from
Oct 9, 2024

Conversation

streamer45
Copy link
Contributor

Summary

PR adds support for receiving and tracking basic client metrics (round trip time, jitter and loss rate). These can then be easily surfaced through our existing Prometheus/Grafana stack (see screenshot).

I also added a basic Golang client implementation, however it's not very accurate given some limitations in the pion implementation (jitter is especially problematic). We are keeping these off by default so that we don't get wild reports from transcriber or other clients we may have in production.

Screenshot

image

Related PRs

mattermost/calls-common#41

Ticket Link

https://mattermost.atlassian.net/browse/MM-60561

Copy link
Member

@cpoile cpoile left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just trying to understand better. :)

Comment on lines 108 to 109
avgJitter = (totalJitter / statsCount)
avgLossRate = totalLossRate / statsCount
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: brackets style

Comment on lines 139 to 140
avgJitter = (totalJitter / statsCount)
avgLossRate = totalLost / totalReceived
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same nit
(not important of course)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would have expected a linter to say something. Will review 👍

Comment on lines +194 to +202
statsInterceptorFactory, err := stats.NewInterceptor()
if err != nil {
return fmt.Errorf("failed to create stats interceptor: %w", err)
}
var statsGetter stats.Getter
statsInterceptorFactory.OnNewPeerConnection(func(_ string, g stats.Getter) {
statsGetter = g
})
i.Add(statsInterceptorFactory)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure I fully understand this block here.... Oh, intercepter is provided by pion, and a pc always has a stats.Getter... I'm not sure what we do with this exact statsGetter..?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cpoile We need to register the interceptor in order to generate the stats for senders and receivers. statsGetter is passed as input to NewRTCMonitor and used internally after that.

rtcMon := newRTCMonitor(c.log, pc, statsGetter, rtcMonitorInterval)

@streamer45 streamer45 added 3: Reviews Complete All reviewers have approved the pull request and removed 2: Dev Review Requires review by a core committer labels Oct 9, 2024
@streamer45 streamer45 merged commit 5e0ced3 into dc-msg Oct 9, 2024
2 checks passed
@streamer45 streamer45 deleted the MM-60561 branch October 9, 2024 21:35
streamer45 added a commit that referenced this pull request Oct 9, 2024
* Implement data channel message type

* Update client implementation

* Update godeltaprof

* Fix dc init race

* [MM-60561] RTC client metrics (#159)

* Client metrics

* Implement rtc stats monitor

* Remove unnecessary parenthesis
streamer45 added a commit that referenced this pull request Oct 9, 2024
* Allow signaling through data channel

* Wrap tests

* DC messages (#158)

* Implement data channel message type

* Update client implementation

* Update godeltaprof

* Fix dc init race

* [MM-60561] RTC client metrics (#159)

* Client metrics

* Implement rtc stats monitor

* Remove unnecessary parenthesis
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3: Reviews Complete All reviewers have approved the pull request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants