Repository: quarkusio/quarkus
Issue: OpenTelemetry: NPE in HttpInstrumenterVertxTracer.RouteGetter when request got cancelled

### Describe the bug

Relates to [#26356](https://github.com/quarkusio/quarkus/pull/26356/files#diff-8dd25e6bcffd41aa6d82e224799fbf61b9708d6d8a3ead2c7ed32ad261d62cccR152):
Using a vert.x HTTP server along with `quarkus-opentelemetry`, we are seeing such exceptions in the logs:
```
java.lang.NullPointerException: Cannot invoke "io.vertx.core.spi.observability.HttpResponse.statusCode()" because "response" is null
	at io.quarkus.opentelemetry.runtime.tracing.vertx.HttpInstrumenterVertxTracer$RouteGetter.get(HttpInstrumenterVertxTracer.java:153)
	at io.quarkus.opentelemetry.runtime.tracing.vertx.HttpInstrumenterVertxTracer$RouteGetter.get(HttpInstrumenterVertxTracer.java:136)
	at io.opentelemetry.instrumentation.api.instrumenter.http.HttpRouteHolder.updateHttpRoute(HttpRouteHolder.java:125)
	at io.quarkus.opentelemetry.runtime.tracing.vertx.HttpInstrumenterVertxTracer.sendResponse(HttpInstrumenterVertxTracer.java:94)
	at io.quarkus.opentelemetry.runtime.tracing.vertx.HttpInstrumenterVertxTracer.sendResponse(HttpInstrumenterVertxTracer.java:41)
	at io.quarkus.opentelemetry.runtime.tracing.vertx.OpenTelemetryVertxTracer.sendResponse(OpenTelemetryVertxTracer.java:47)
	at io.quarkus.opentelemetry.runtime.tracing.vertx.OpenTelemetryVertxTracer.sendResponse(OpenTelemetryVertxTracer.java:16)
	at io.vertx.core.http.impl.Http1xServerRequest.reportRequestReset(Http1xServerRequest.java:645)
	at io.vertx.core.http.impl.Http1xServerRequest.handleException(Http1xServerRequest.java:623)
	at io.vertx.core.http.impl.Http1xServerConnection.lambda$handleClosed$6(Http1xServerConnection.java:455)
	at io.vertx.core.impl.EventLoopContext.execute(EventLoopContext.java:71)
	at io.vertx.core.impl.DuplicatedContext.execute(DuplicatedContext.java:163)
	at io.vertx.core.impl.AbstractContext.execute(AbstractContext.java:58)
	at io.vertx.core.http.impl.Http1xServerConnection.handleClosed(Http1xServerConnection.java:454)
	at io.vertx.core.net.impl.VertxHandler.channelInactive(VertxHandler.java:143)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelInactive(AbstractChannelHandlerContext.java:262)
[...]
```

They occur when a client cancels a request before the server has sent a response.

### Expected behavior

_No response_

### Actual behavior

_No response_

### How to Reproduce?

_No response_

### Output of `uname -a` or `ver`

_No response_

### Output of `java -version`

_No response_

### GraalVM version (if different from Java)

_No response_

### Quarkus version or git rev

2.10.2

### Build tool (ie. output of `mvnw --version` or `gradlew --version`)

_No response_

### Additional information

_No response_

Changed files:
extensions/opentelemetry/opentelemetry/runtime/src/main/java/io/quarkus/opentelemetry/runtime/tracing/vertx/HttpInstrumenterVertxTracer.java

diff --git a/extensions/opentelemetry/opentelemetry/runtime/src/main/java/io/quarkus/opentelemetry/runtime/tracing/vertx/HttpInstrumenterVertxTracer.java b/extensions/opentelemetry/opentelemetry/runtime/src/main/java/io/quarkus/opentelemetry/runtime/tracing/vertx/HttpInstrumenterVertxTracer.java
index 0e21f0d2bdb..cbc01516f96 100644
--- a/extensions/opentelemetry/opentelemetry/runtime/src/main/java/io/quarkus/opentelemetry/runtime/tracing/vertx/HttpInstrumenterVertxTracer.java
+++ b/extensions/opentelemetry/opentelemetry/runtime/src/main/java/io/quarkus/opentelemetry/runtime/tracing/vertx/HttpInstrumenterVertxTracer.java
@@ -4,6 +4,7 @@
 import static io.opentelemetry.semconv.trace.attributes.SemanticAttributes.HTTP_CLIENT_IP;
 import static io.quarkus.opentelemetry.runtime.OpenTelemetryConfig.INSTRUMENTATION_NAME;
 
+import java.util.Collections;
 import java.util.List;
 import java.util.function.BiConsumer;
 
@@ -151,7 +152,7 @@ public String get(final io.opentelemetry.context.Context context, final HttpRequ
                 return route;
             }
 
-            if (HttpResponseStatus.NOT_FOUND.code() == response.statusCode()) {
+            if (response != null && HttpResponseStatus.NOT_FOUND.code() == response.statusCode()) {
                 return "/*";
             }
 
@@ -231,12 +232,12 @@ public Long requestContentLengthUncompressed(final HttpRequest request, final Ht
 
         @Override
         public Integer statusCode(final HttpRequest request, final HttpResponse response) {
-            return response.statusCode();
+            return response != null ? response.statusCode() : null;
         }
 
         @Override
         public Long responseContentLength(final HttpRequest request, final HttpResponse response) {
-            return getContentLength(response.headers());
+            return response != null ? getContentLength(response.headers()) : null;
         }
 
         @Override
@@ -246,7 +247,7 @@ public Long responseContentLengthUncompressed(final HttpRequest request, final H
 
         @Override
         public List<String> responseHeader(final HttpRequest request, final HttpResponse response, final String name) {
-            return response.headers().getAll(name);
+            return response != null ? response.headers().getAll(name) : Collections.emptyList();
         }
 
         private static Long getContentLength(final MultiMap headers) {