diff --git a/contrib/envoyproxy/go-control-plane/envoy.go b/contrib/envoyproxy/go-control-plane/envoy.go index 52279e0138..a38b5a5e3c 100644 --- a/contrib/envoyproxy/go-control-plane/envoy.go +++ b/contrib/envoyproxy/go-control-plane/envoy.go @@ -11,6 +11,7 @@ import ( "io" "math" "net/http" + "path" "strings" "gopkg.in/DataDog/dd-trace-go.v1/contrib/internal/httptrace" @@ -204,6 +205,7 @@ func processRequestHeaders(ctx context.Context, req *envoyextproc.ProcessingRequ var blocked bool fakeResponseWriter := newFakeResponseWriter() wrappedResponseWriter, request, afterHandle, blocked := httptrace.BeforeHandle(&httptrace.ServeConfig{ + Resource: request.Method + " " + path.Clean(request.URL.Path), SpanOpts: []ddtrace.StartSpanOption{ tracer.Tag(ext.SpanKind, ext.SpanKindServer), tracer.Tag(ext.Component, componentName), diff --git a/contrib/envoyproxy/go-control-plane/envoy_test.go b/contrib/envoyproxy/go-control-plane/envoy_test.go index 8af05eaab3..257cf83538 100644 --- a/contrib/envoyproxy/go-control-plane/envoy_test.go +++ b/contrib/envoyproxy/go-control-plane/envoy_test.go @@ -254,7 +254,7 @@ func TestGeneratedSpan(t *testing.T) { stream, err := client.Process(ctx) require.NoError(t, err) - end2EndStreamRequest(t, stream, "/resource-span", "GET", map[string]string{"user-agent": "Mistake Not...", "test-key": "test-value"}, map[string]string{"response-test-key": "response-test-value"}, false) + end2EndStreamRequest(t, stream, "/../../../resource-span/.?id=test", "GET", map[string]string{"user-agent": "Mistake Not...", "test-key": "test-value"}, map[string]string{"response-test-key": "response-test-value"}, false) err = stream.CloseSend() require.NoError(t, err) @@ -266,10 +266,10 @@ func TestGeneratedSpan(t *testing.T) { // Check for tags span := finished[0] require.Equal(t, "http.request", span.OperationName()) - require.Equal(t, "https://datadoghq.com/resource-span", span.Tag("http.url")) + require.Equal(t, "https://datadoghq.com/../../../resource-span/.?id=test", span.Tag("http.url")) require.Equal(t, "GET", span.Tag("http.method")) require.Equal(t, "datadoghq.com", span.Tag("http.host")) - // require.Equal(t, "GET /resource-span", span.Tag("resource.name")) + require.Equal(t, "GET /resource-span", span.Tag("resource.name")) require.Equal(t, "server", span.Tag("span.kind")) require.Equal(t, "Mistake Not...", span.Tag("http.useragent")) })