Skip to content

fix: defer OnStreamRecv so recv error and bytes are observed correctly - #116

Open
steve-weiland wants to merge 1 commit into
livekit:mainfrom
steve-weiland:fix-stream-recv-metrics
Open

fix: defer OnStreamRecv so recv error and bytes are observed correctly#116
steve-weiland wants to merge 1 commit into
livekit:mainfrom
steve-weiland:fix-stream-recv-metrics

Conversation

@steve-weiland

Copy link
Copy Markdown

Problem

streamMetricsInterceptor.Recv records its metric before calling the downstream handler, so err is always nil and proto.Size(msg) measures an empty message, every stream-recv metric reports err == nil and bytes == 0.

Send already defers correctly; Recv doesn't.

Fix

Defer OnStreamRecv so it runs after the handler returns, mirroring Send. Adds TestStreamMetricsRecvObservedAfterHandler, which fails on the old ordering and passes with the fix.

No behavioral change beyond metric accuracy.

@CLAassistant

CLAassistant commented Jun 19, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@steve-weiland

Copy link
Copy Markdown
Author

Bumping this gently.

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

Successfully merging this pull request may close these issues.

2 participants