disconnectErrorString returns the grpc.disconnect_error metric label corresponding to the provided transport.GoAwayInfo, as specified by gRFC A94: https://github.com/grpc/proposal/blob/master/A94-grpc-subchannel-disconnections-metrics.md
(info transport.GoAwayInfo)
| 1573 | // to the provided transport.GoAwayInfo, as specified by gRFC A94: |
| 1574 | // https://github.com/grpc/proposal/blob/master/A94-grpc-subchannel-disconnections-metrics.md |
| 1575 | func disconnectErrorString(info transport.GoAwayInfo) string { |
| 1576 | err := info.Err |
| 1577 | var sysErr syscall.Errno |
| 1578 | switch { |
| 1579 | case info.Reason != transport.GoAwayInvalid: |
| 1580 | return fmt.Sprintf("GOAWAY %s", info.GoAwayCode.String()) |
| 1581 | case err == nil: |
| 1582 | return "unknown" |
| 1583 | case errors.Is(err, context.Canceled): |
| 1584 | return "subchannel shutdown" |
| 1585 | case errors.Is(err, syscall.ECONNRESET): |
| 1586 | return "connection reset" |
| 1587 | case errors.Is(err, syscall.ETIMEDOUT), errors.Is(err, context.DeadlineExceeded), errors.Is(err, os.ErrDeadlineExceeded): |
| 1588 | return "connection timed out" |
| 1589 | case errors.Is(err, syscall.ECONNABORTED): |
| 1590 | return "connection aborted" |
| 1591 | case errors.As(err, &sysErr): |
| 1592 | return "socket error" |
| 1593 | default: |
| 1594 | return "unknown" |
| 1595 | } |
| 1596 | } |
| 1597 | |
| 1598 | // startHealthCheck starts the health checking stream (RPC) to watch the health |
| 1599 | // stats of this connection if health checking is requested and configured. |
no test coverage detected