Skip to content
Merged
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 @@ -8,6 +8,7 @@
import datadog.trace.bootstrap.instrumentation.api.ResourceNamePriorities;
import datadog.trace.bootstrap.instrumentation.api.UTF8BytesString;
import java.util.function.Function;
import javax.annotation.Nonnull;

public class HttpResourceNames {
public static final UTF8BytesString DEFAULT_RESOURCE_NAME = UTF8BytesString.create("/");
Expand Down Expand Up @@ -71,6 +72,9 @@ private HttpResourceNames() {

public static AgentSpan setForServer(
AgentSpan span, CharSequence method, CharSequence path, boolean encoded) {
if (path == null) {
return span;
}
Pair<CharSequence, Byte> result = computeForServer(method, path, encoded);
if (result.hasLeft()) {
span.setResourceName(result.getLeft(), result.getRight());
Expand All @@ -80,7 +84,7 @@ public static AgentSpan setForServer(
}

public static Pair<CharSequence, Byte> computeForServer(
CharSequence method, CharSequence path, boolean encoded) {
CharSequence method, @Nonnull CharSequence path, boolean encoded) {
byte priority;

String resourcePath =
Expand All @@ -96,7 +100,7 @@ public static Pair<CharSequence, Byte> computeForServer(
}

public static Pair<CharSequence, Byte> computeForClient(
CharSequence method, CharSequence path, boolean encoded) {
CharSequence method, @Nonnull CharSequence path, boolean encoded) {
byte priority;

String resourcePath =
Expand All @@ -112,6 +116,9 @@ public static Pair<CharSequence, Byte> computeForClient(

public static AgentSpan setForClient(
AgentSpan span, CharSequence method, CharSequence path, boolean encoded) {
if (path == null) {
return span;
}
Pair<CharSequence, Byte> result = computeForClient(method, path, encoded);
if (result.hasLeft()) {
span.setResourceName(result.getLeft(), result.getRight());
Expand Down