diff --git a/src/client.ts b/src/client.ts index 4d237b60..3c187972 100644 --- a/src/client.ts +++ b/src/client.ts @@ -244,10 +244,10 @@ export class Client { dbStatementSerializer: RedisDbStatementSerializer }, "@opentelemetry/instrumentation-koa": { - requestHook: function (_span, info) { + requestHook: function (span, info) { if (sendParams && info.layerType === KoaLayerType.ROUTER) { const queryParams = info.context.request.query - setParams(queryParams) + setParams(queryParams, span) } } }, diff --git a/test/koa-mysql/tests/spec/app_spec.rb b/test/koa-mysql/tests/spec/app_spec.rb index e236b7cd..a49b6aeb 100644 --- a/test/koa-mysql/tests/spec/app_spec.rb +++ b/test/koa-mysql/tests/spec/app_spec.rb @@ -16,17 +16,18 @@ end describe "GET /get with params" do - it "adds params to the HTTP root span" do + it "adds params to the router child span" do response = HTTP.get("#{@test_app_url}/get?param1=user¶m2=password") expect(response.status).to eq(200) - expect(Span.root!).to be_http_span_with_route("GET /get") + + router_span = Span.find_by_name!("router - /get") expected_request_parameters = { "param1" => "user", "param2" => "password" } - expect(Span.root!).to match_request_parameters(expected_request_parameters) + expect(router_span).to match_request_parameters(expected_request_parameters) end end