fix how we look for our request

Signed-off-by: Davanum Srinivas <davanum@gmail.com>
This commit is contained in:
Davanum Srinivas 2022-09-18 17:21:19 -04:00
parent 3eaca7cf51
commit a1635fa702
No known key found for this signature in database
GPG Key ID: 80D83A796103BF59

View File

@ -21,6 +21,7 @@ import (
"fmt"
"net"
"os"
"strings"
"testing"
"time"
@ -109,13 +110,16 @@ func containsNodeListSpan(req *traceservice.ExportTraceServiceRequest) bool {
for _, resourceSpans := range req.GetResourceSpans() {
for _, instrumentationSpans := range resourceSpans.GetScopeSpans() {
for _, span := range instrumentationSpans.GetSpans() {
if span.Name != "KubernetesAPI" {
if span.Name != "HTTP GET" {
continue
}
for _, attr := range span.GetAttributes() {
if attr.GetKey() == "http.target" && attr.GetValue().GetStringValue() == "/api/v1/nodes" {
// We found our request!
return true
if attr.GetKey() == "http.url" {
value := attr.GetValue().GetStringValue()
if strings.HasSuffix(value, "/api/v1/nodes") {
// We found our request!
return true
}
}
}
}