Skip to content

Commit

Permalink
contrib/internal/httptrace: add inferred span identification tag (#3184)
Browse files Browse the repository at this point in the history
  • Loading branch information
zarirhamza authored Feb 13, 2025
1 parent 9eb2e61 commit c345adb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
3 changes: 3 additions & 0 deletions contrib/internal/httptrace/httptrace_api_gateway_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ func TestInferredProxySpans(t *testing.T) {
assert.Equal(t, "aws.apigateway", gwSpan.OperationName())
assert.Equal(t, "http.request", webReqSpan.OperationName())
assert.Equal(t, "example.com", gwSpan.Tag("service.name"))
assert.Equal(t, 1, gwSpan.Tag("_dd.inferred_span"))
assert.True(t, webReqSpan.ParentID() == gwSpan.SpanID())
assert.Equal(t, webReqSpan.Tag("http.status_code"), gwSpan.Tag("http.status_code"))
assert.Equal(t, webReqSpan.Tag("span.type"), gwSpan.Tag("span.type"))
Expand Down Expand Up @@ -101,6 +102,7 @@ func TestInferredProxySpans(t *testing.T) {
assert.Equal(t, "aws.apigateway", gwSpan.OperationName())
assert.Equal(t, "http.request", webReqSpan.OperationName())
assert.Equal(t, "example.com", gwSpan.Tag("service.name"))
assert.Equal(t, 1, gwSpan.Tag("_dd.inferred_span"))
assert.True(t, webReqSpan.ParentID() == gwSpan.SpanID())
assert.Equal(t, webReqSpan.Tag("http.status_code"), gwSpan.Tag("http.status_code"))
assert.Equal(t, webReqSpan.Tag("span.type"), gwSpan.Tag("span.type"))
Expand Down Expand Up @@ -185,6 +187,7 @@ func TestInferredProxySpans(t *testing.T) {
assert.Equal(t, "aws.apigateway", gwSpan.OperationName())
assert.Equal(t, "http.request", webReqSpan.OperationName())
assert.Equal(t, "example.com", gwSpan.Tag("service.name"))
assert.Equal(t, 1, gwSpan.Tag("_dd.inferred_span"))
assert.True(t, webReqSpan.ParentID() == gwSpan.SpanID())
assert.Equal(t, webReqSpan.Tag("http.status_code"), gwSpan.Tag("http.status_code"))
assert.Equal(t, webReqSpan.Tag("span.type"), gwSpan.Tag("span.type"))
Expand Down
1 change: 1 addition & 0 deletions contrib/internal/httptrace/inferred_proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ func startInferredProxySpan(requestProxyContext *proxyContext, parent ddtrace.Sp
cfg.Tags[ext.HTTPURL] = requestProxyContext.domainName + requestProxyContext.path
cfg.Tags[ext.HTTPRoute] = requestProxyContext.path
cfg.Tags[ext.ResourceName] = fmt.Sprintf("%s %s", requestProxyContext.method, requestProxyContext.path)
cfg.Tags["_dd.inferred_span"] = 1
cfg.Tags["stage"] = requestProxyContext.stage
},
)
Expand Down

0 comments on commit c345adb

Please sign in to comment.