Consolidate "closed connection" errors, but add an "exception" dimension
This commit is contained in:
parent
0ea13ec528
commit
444f6ca826
|
@ -93,6 +93,7 @@ public class WebSocketConnection implements WebSocketConnectionEventListener {
|
||||||
private static final String STATUS_CODE_TAG = "status";
|
private static final String STATUS_CODE_TAG = "status";
|
||||||
private static final String STATUS_MESSAGE_TAG = "message";
|
private static final String STATUS_MESSAGE_TAG = "message";
|
||||||
private static final String ERROR_TYPE_TAG = "errorType";
|
private static final String ERROR_TYPE_TAG = "errorType";
|
||||||
|
private static final String EXCEPTION_TYPE_TAG = "exceptionType";
|
||||||
|
|
||||||
private static final long SLOW_DRAIN_THRESHOLD = 10_000;
|
private static final long SLOW_DRAIN_THRESHOLD = 10_000;
|
||||||
|
|
||||||
|
@ -436,26 +437,26 @@ public class WebSocketConnection implements WebSocketConnectionEventListener {
|
||||||
return queueCleared;
|
return queueCleared;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void measureSendMessageErrors(Throwable e, final boolean terminal) {
|
private void measureSendMessageErrors(final Throwable e, final boolean terminal) {
|
||||||
final String errorType;
|
final String errorType;
|
||||||
|
|
||||||
if (e instanceof TimeoutException) {
|
if (e instanceof TimeoutException) {
|
||||||
errorType = "timeout";
|
errorType = "timeout";
|
||||||
} else if (e instanceof java.nio.channels.ClosedChannelException) {
|
} else if (e instanceof java.nio.channels.ClosedChannelException ||
|
||||||
errorType = "closedChannel";
|
e == WebSocketResourceProvider.CONNECTION_CLOSED_EXCEPTION ||
|
||||||
} else if (e == WebSocketResourceProvider.CONNECTION_CLOSED_EXCEPTION) {
|
e instanceof org.eclipse.jetty.io.EofException ||
|
||||||
|
(e instanceof StaticException staticException && "Closed".equals(staticException.getMessage()))) {
|
||||||
errorType = "connectionClosed";
|
errorType = "connectionClosed";
|
||||||
} else if (e instanceof org.eclipse.jetty.io.EofException) {
|
|
||||||
errorType = "connectionEof";
|
|
||||||
} else if (e instanceof StaticException staticException && "Closed".equals(staticException.getMessage())) {
|
|
||||||
errorType = "closedStatic";
|
|
||||||
} else {
|
} else {
|
||||||
logger.warn(terminal ? "Send message failure terminated stream" : "Send message failed", e);
|
logger.warn(terminal ? "Send message failure terminated stream" : "Send message failed", e);
|
||||||
errorType = "other";
|
errorType = "other";
|
||||||
}
|
}
|
||||||
final Tags tags = Tags.of(
|
|
||||||
UserAgentTagUtil.getPlatformTag(client.getUserAgent()),
|
Metrics.counter(SEND_MESSAGE_ERROR_COUNTER, Tags.of(
|
||||||
Tag.of(ERROR_TYPE_TAG, errorType));
|
UserAgentTagUtil.getPlatformTag(client.getUserAgent()),
|
||||||
Metrics.counter(SEND_MESSAGE_ERROR_COUNTER, tags).increment();
|
Tag.of(ERROR_TYPE_TAG, errorType),
|
||||||
|
Tag.of(EXCEPTION_TYPE_TAG, e.getClass().getSimpleName())))
|
||||||
|
.increment();
|
||||||
}
|
}
|
||||||
|
|
||||||
private CompletableFuture<Void> sendMessage(Envelope envelope) {
|
private CompletableFuture<Void> sendMessage(Envelope envelope) {
|
||||||
|
|
Loading…
Reference in New Issue