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.
()
| 102 | // into "expected" and "investigate" buckets without enumerating every |
| 103 | // reason. |
| 104 | func (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 |
no outgoing calls