Skip to content

Update connection opening failed metric when @OnOpen throws #47415

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 22, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
import static io.quarkus.websockets.next.runtime.telemetry.TelemetryConstants.CLIENT_ENDPOINT_COUNT_ERRORS;
import static io.quarkus.websockets.next.runtime.telemetry.TelemetryConstants.SERVER_BYTES;
import static io.quarkus.websockets.next.runtime.telemetry.TelemetryConstants.SERVER_CONNECTION_CLOSED;
import static io.quarkus.websockets.next.runtime.telemetry.TelemetryConstants.SERVER_CONNECTION_ON_OPEN_ERROR;
import static io.quarkus.websockets.next.runtime.telemetry.TelemetryConstants.SERVER_CONNECTION_OPENED;
import static io.quarkus.websockets.next.runtime.telemetry.TelemetryConstants.SERVER_CONNECTION_OPENED_ERROR;
import static io.quarkus.websockets.next.runtime.telemetry.TelemetryConstants.SERVER_COUNT;
import static io.quarkus.websockets.next.runtime.telemetry.TelemetryConstants.SERVER_ENDPOINT_COUNT_ERRORS;
import static io.quarkus.websockets.next.runtime.telemetry.TelemetryConstants.Direction.INBOUND;
Expand Down Expand Up @@ -120,7 +120,7 @@ static Matcher<String> assertClientErrorTotal(String path, int clientErrorCount)
}

static Matcher<String> assertServerConnectionOpeningFailedTotal(String path, int serverConnectionOpeningFailedCount) {
return assertTotal(SERVER_CONNECTION_OPENED_ERROR, serverConnectionOpeningFailedCount, path, null);
return assertTotal(SERVER_CONNECTION_ON_OPEN_ERROR, serverConnectionOpeningFailedCount, path, null);
}

static Matcher<String> assertServerConnectionOpenedTotal(int serverConnectionOpenedCount) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,9 @@ public void handle(Void event) {
});
}
} else {
if (telemetrySupport != null) {
telemetrySupport.connectionOpeningFailed(r.cause());
}
handleFailure(unhandledFailureStrategy, r.cause(), "Unable to complete @OnOpen callback", connection);
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
import static io.quarkus.websockets.next.runtime.telemetry.TelemetryConstants.CLIENT_ENDPOINT_COUNT_ERRORS;
import static io.quarkus.websockets.next.runtime.telemetry.TelemetryConstants.DIRECTION_TAG_KEY;
import static io.quarkus.websockets.next.runtime.telemetry.TelemetryConstants.SERVER_CONNECTION_CLOSED;
import static io.quarkus.websockets.next.runtime.telemetry.TelemetryConstants.SERVER_CONNECTION_ON_OPEN_ERROR;
import static io.quarkus.websockets.next.runtime.telemetry.TelemetryConstants.SERVER_CONNECTION_OPENED;
import static io.quarkus.websockets.next.runtime.telemetry.TelemetryConstants.SERVER_CONNECTION_OPENED_ERROR;
import static io.quarkus.websockets.next.runtime.telemetry.TelemetryConstants.SERVER_ENDPOINT_COUNT_ERRORS;
import static io.quarkus.websockets.next.runtime.telemetry.TelemetryConstants.Direction.INBOUND;
import static io.quarkus.websockets.next.runtime.telemetry.TelemetryConstants.Direction.OUTBOUND;
Expand Down Expand Up @@ -98,7 +98,7 @@ public ErrorInterceptor apply(String path) {
.withRegistry(meterRegistry);

private final Meter.MeterProvider<Counter> connectionOpeningFailedCounter = Counter
.builder(SERVER_CONNECTION_OPENED_ERROR)
.builder(SERVER_CONNECTION_ON_OPEN_ERROR)
.description("Number of failures occurred when opening server connection failed.")
.withRegistry(meterRegistry);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
final class MetricsConnectionInterceptor implements ConnectionInterceptor {

private final Counter connectionOpenCounter;
private final Counter connectionOpeninigFailedCounter;
private final Counter connectionOnOpenErrorsCounter;

MetricsConnectionInterceptor(Counter connectionOpenCounter, Counter connectionOpeninigFailedCounter) {
this.connectionOpenCounter = connectionOpenCounter;
this.connectionOpeninigFailedCounter = connectionOpeninigFailedCounter;
this.connectionOnOpenErrorsCounter = connectionOpeninigFailedCounter;
}

@Override
Expand All @@ -21,7 +21,7 @@ public void connectionOpened() {

@Override
public void connectionOpeningFailed(Throwable cause) {
connectionOpeninigFailedCounter.increment();
connectionOnOpenErrorsCounter.increment();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ private TelemetryConstants() {
/**
* Counts number of times that opening of a WebSocket server connection resulted in error.
*/
public static final String SERVER_CONNECTION_OPENED_ERROR = "quarkus.websockets.server.connections.opened.errors";
public static final String SERVER_CONNECTION_ON_OPEN_ERROR = "quarkus.websockets.server.connections.onopen.errors";

/**
* Counts number of times that opening of a WebSocket client connection resulted in error.
Expand Down
Loading