@@ -120,16 +120,17 @@ def test_litestar_opentelemetry_instrument_uses_custom_middleware(
120120
121121
122122@pytest .mark .parametrize (
123- ("path" , "expected_span_name" ),
123+ ("path" , "expected_span_name" , "expected_path_template" ),
124124 [
125- ("/users/123" , "GET /users/{user_id}" ),
126- ("/users/" , "GET /users/" ),
127- ("/" , "GET /" ),
125+ ("/users/123" , "GET /users/{user_id}" , "/users/{user_id}" ),
126+ ("/users/" , "GET /users/" , "/users" ),
127+ ("/" , "GET /" , "/" ),
128128 ],
129129)
130130def test_litestar_opentelemetry_integration_with_path_templates (
131131 path : str ,
132132 expected_span_name : str ,
133+ expected_path_template : str ,
133134 minimal_opentelemetry_config : OpentelemetryConfig ,
134135) -> None :
135136 @litestar .get ("/users/{user_id:int}" )
@@ -158,6 +159,7 @@ async def root() -> dict[str, str]:
158159 response : typing .Final = client .get (path )
159160 assert response .status_code == HTTP_200_OK
160161 assert mock_function .called
162+ assert mock_function .call_args_list [0 ].args [0 ].get ("path_template" ) == expected_path_template
161163
162164
163165def test_litestar_opentelemetry_middleware_initialization () -> None :
0 commit comments