Skip to content

Commit

Permalink
fix compilation failure after merge conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
Mateusz Rzeszutek committed Oct 4, 2021
1 parent e4001c1 commit 1914320
Showing 1 changed file with 21 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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<HttpServerExchange, HttpServerExchange> {

public UndertowHttpAttributesExtractor() {
super(HttpHeadersConfig.capturedServerHeaders());
}

@Override
protected String method(HttpServerExchange exchange) {
return exchange.getRequestMethod().toString();
Expand All @@ -22,6 +30,12 @@ protected String method(HttpServerExchange exchange) {
return exchange.getRequestHeaders().getFirst("User-Agent");
}

@Override
protected List<String> 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) {
Expand Down Expand Up @@ -63,6 +77,13 @@ protected Integer statusCode(HttpServerExchange exchange, HttpServerExchange unu
return null;
}

@Override
protected List<String> responseHeader(
HttpServerExchange exchange, HttpServerExchange unused, String name) {
HeaderValues values = exchange.getResponseHeaders().get(name);
return values == null ? Collections.emptyList() : values;
}

@Override
protected @Nullable String target(HttpServerExchange exchange) {
String requestPath = exchange.getRequestPath();
Expand Down

0 comments on commit 1914320

Please sign in to comment.