Skip to content

Commit

Permalink
Quieter signaling and module logs (#393)
Browse files Browse the repository at this point in the history
  • Loading branch information
benjirewis authored Nov 19, 2024
1 parent 96ba3e3 commit 2682be8
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 9 deletions.
4 changes: 3 additions & 1 deletion pexec/managed_process.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@ type ManagedProcess interface {

// NewManagedProcess returns a new, unstarted, from the given configuration.
func NewManagedProcess(config ProcessConfig, logger utils.ZapCompatibleLogger) ManagedProcess {
logger = utils.Sublogger(logger, fmt.Sprintf("process.%s_%s", config.ID, config.Name))
// NOTE(benjirewis): config.ID maps to the module name in the module
// manager's usage of this method and the passed-in ProcessConfig.
logger = utils.Sublogger(logger, config.ID)

if config.StopSignal == 0 {
config.StopSignal = syscall.SIGTERM
Expand Down
20 changes: 13 additions & 7 deletions rpc/wrtc_base_channel.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,17 +131,23 @@ func newBaseChannel(
connIDMu.Lock()
connID = connInfo.ID
connIDMu.Unlock()
logger.Infow("Connection state changed",
connectionStateChangedLogFields := []interface{}{
"conn_id", connInfo.ID,
"conn_state", connectionState.String(),
"conn_local_candidates", connInfo.LocalCandidates,
"conn_remote_candidates", connInfo.RemoteCandidates,
)
}
if hasCandPair {
logger.Infow("Selected candidate pair",
"conn_id", connInfo.ID,
"candidate_pair", candPair.String(),
)
// Use info level when there is a selected candidate pair, as a
// connection has been established.
connectionStateChangedLogFields = append(connectionStateChangedLogFields,
"candidate_pair", candPair.String())
logger.Infow("Connection establishment succeeded", connectionStateChangedLogFields...)
} else {
// Use debug level when there is no selected candidate pair to avoid
// noise.
connectionStateChangedLogFields = append(connectionStateChangedLogFields,
"conn_state", connectionState.String())
logger.Debugw("Connection state changed", connectionStateChangedLogFields...)
}
}
})
Expand Down
3 changes: 2 additions & 1 deletion rpc/wrtc_signaling_answerer.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,8 @@ func checkExceptionalError(err error) error {
strings.Contains(s.Message(), "too_many_pings") ||
// RSDK-3025: Cloud Run has a max one hour timeout which will terminate gRPC
// streams, but leave the underlying connection open.
strings.Contains(s.Message(), "upstream max stream duration reached"))) {
strings.Contains(s.Message(), "upstream max stream duration reached") ||
strings.Contains(s.Message(), "server closed the stream without sending trailers"))) {
return nil
}
return err
Expand Down

0 comments on commit 2682be8

Please sign in to comment.