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 and hannahkm committed Feb 13, 2025
1 parent 57c1cdc commit 839b9bc
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
3 changes: 3 additions & 0 deletions instrumentation/httptrace/httptrace_api_gateway_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,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 @@ -102,6 +103,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 @@ -186,6 +188,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 instrumentation/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 *tracer.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 839b9bc

Please sign in to comment.