Skip to content
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

Remove extra space from kubernetes client span name #8540

Merged
merged 1 commit into from
May 22, 2023
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 @@ -106,7 +106,14 @@ public String toString() {
targetResourceName = resourceMeta.getResource() + "/" + resourceMeta.getSubResource();
}

return verb.value() + ' ' + groupVersion + ' ' + targetResourceName;
StringBuilder result = new StringBuilder(verb.value());
if (!groupVersion.isEmpty()) {
result.append(" ").append(groupVersion);
}
if (!targetResourceName.isEmpty()) {
result.append(" ").append(targetResourceName);
}
return result.toString();
}

private static boolean isNullOrEmpty(String s) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ class KubernetesClientTest extends AgentInstrumentationSpecification {
kind SpanKind.INTERNAL
hasNoParent()
}
apiClientSpan(it, 1, "get pods/proxy", "${server.httpUri()}/api/v1/namespaces/namespace/pods/name/proxy?path=path", 200)
apiClientSpan(it, 1, "get pods/proxy", "${server.httpUri()}/api/v1/namespaces/namespace/pods/name/proxy?path=path", 200)
}
}
}
Expand All @@ -95,7 +95,7 @@ class KubernetesClientTest extends AgentInstrumentationSpecification {
status ERROR
errorEvent(exception.class, exception.message)
}
apiClientSpan(it, 1, "get pods/proxy", "${server.httpUri()}/api/v1/namespaces/namespace/pods/name/proxy?path=path", 451, exception)
apiClientSpan(it, 1, "get pods/proxy", "${server.httpUri()}/api/v1/namespaces/namespace/pods/name/proxy?path=path", 451, exception)
}
}
}
Expand Down Expand Up @@ -131,7 +131,7 @@ class KubernetesClientTest extends AgentInstrumentationSpecification {
kind SpanKind.INTERNAL
hasNoParent()
}
apiClientSpan(it, 1, "get pods/proxy", "${server.httpUri()}/api/v1/namespaces/namespace/pods/name/proxy?path=path", 200)
apiClientSpan(it, 1, "get pods/proxy", "${server.httpUri()}/api/v1/namespaces/namespace/pods/name/proxy?path=path", 200)
span(2) {
name "callback"
kind SpanKind.INTERNAL
Expand Down Expand Up @@ -172,7 +172,7 @@ class KubernetesClientTest extends AgentInstrumentationSpecification {
kind SpanKind.INTERNAL
hasNoParent()
}
apiClientSpan(it, 1, "get pods/proxy", "${server.httpUri()}/api/v1/namespaces/namespace/pods/name/proxy?path=path", 451, exception.get())
apiClientSpan(it, 1, "get pods/proxy", "${server.httpUri()}/api/v1/namespaces/namespace/pods/name/proxy?path=path", 451, exception.get())
span(2) {
name "callback"
kind SpanKind.INTERNAL
Expand Down
Loading