From ffc9cf91f8f7401f324ce7dd3169a5ec383c9ef7 Mon Sep 17 00:00:00 2001 From: Mateusz Rzeszutek Date: Fri, 1 Oct 2021 15:21:55 +0200 Subject: [PATCH] fix compilation failure after merge conflict --- .../UndertowHttpAttributesExtractor.java | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/instrumentation/undertow-1.4/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/undertow/UndertowHttpAttributesExtractor.java b/instrumentation/undertow-1.4/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/undertow/UndertowHttpAttributesExtractor.java index bb25c0709a7f..eac1247caa15 100644 --- a/instrumentation/undertow-1.4/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/undertow/UndertowHttpAttributesExtractor.java +++ b/instrumentation/undertow-1.4/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/undertow/UndertowHttpAttributesExtractor.java @@ -6,12 +6,20 @@ package io.opentelemetry.javaagent.instrumentation.undertow; import io.opentelemetry.instrumentation.api.instrumenter.http.HttpServerAttributesExtractor; +import io.opentelemetry.javaagent.instrumentation.api.config.HttpHeadersConfig; import io.undertow.server.HttpServerExchange; +import io.undertow.util.HeaderValues; +import java.util.Collections; +import java.util.List; import org.checkerframework.checker.nullness.qual.Nullable; public class UndertowHttpAttributesExtractor extends HttpServerAttributesExtractor { + public UndertowHttpAttributesExtractor() { + super(HttpHeadersConfig.capturedServerHeaders()); + } + @Override protected String method(HttpServerExchange exchange) { return exchange.getRequestMethod().toString(); @@ -22,6 +30,12 @@ protected String method(HttpServerExchange exchange) { return exchange.getRequestHeaders().getFirst("User-Agent"); } + @Override + protected List requestHeader(HttpServerExchange exchange, String name) { + HeaderValues values = exchange.getRequestHeaders().get(name); + return values == null ? Collections.emptyList() : values; + } + @Override protected @Nullable Long requestContentLength( HttpServerExchange exchange, @Nullable HttpServerExchange unused) { @@ -63,6 +77,13 @@ protected Integer statusCode(HttpServerExchange exchange, HttpServerExchange unu return null; } + @Override + protected List responseHeader( + HttpServerExchange exchange, HttpServerExchange unused, String name) { + HeaderValues values = exchange.getResponseHeaders().get(name); + return values == null ? Collections.emptyList() : values; + } + @Override protected String url(HttpServerExchange exchange) { String result = exchange.getRequestURL();