MCPcopy Index your code
hub / github.com/coder/coder / Expected

Method Expected

codersdk/disconnect.go:104–122  ·  view source on GitHub ↗

Expected reports whether a disconnect with this reason is part of normal operation. Operators can use this to split dashboards or alerts into "expected" and "investigate" buckets without enumerating every reason.

()

Source from the content-addressed store, hash-verified

102// into "expected" and "investigate" buckets without enumerating every
103// reason.
104func (r DisconnectReason) Expected() bool {
105 switch r {
106 case DisconnectReasonGraceful,
107 DisconnectReasonClientClosed,
108 DisconnectReasonServerShutdown,
109 DisconnectReasonWorkspaceStopped:
110 return true
111 case DisconnectReasonUnknown,
112 DisconnectReasonNetworkError,
113 DisconnectReasonProtocolError,
114 DisconnectReasonControlPlaneLost:
115 return false
116 default:
117 // Unknown reason values are treated as not expected so that
118 // new emit sites that forget to classify themselves surface
119 // in the "investigate" bucket by default.
120 return false
121 }
122}
123
124// DisconnectInitiator identifies which side caused the disconnect. It
125// pairs with DisconnectReason: the reason describes what happened, the

Callers 2

SlogExpectedFieldMethod · 0.95

Calls

no outgoing calls

Tested by 1