@@ -39,15 +39,19 @@ async def test_tracing() -> None:
3939 first_span , second_span , third_span = cast ("tuple[Span, Span, Span]" , exporter .get_finished_spans ())
4040
4141 assert response .status_code == 200
42- assert_that (first_span .attributes ).is_equal_to ({"http.status_code" : 200 , "type" : "http.response.start" })
43- assert_that (second_span .attributes ).is_equal_to ({"type" : "http.response.body" })
42+ assert_that (first_span .attributes ).is_equal_to (
43+ {"http.status_code" : 200 , "asgi.event.type" : "http.response.start" },
44+ )
45+ assert_that (second_span .attributes ).is_equal_to ({"asgi.event.type" : "http.response.body" })
4446 assert_that (third_span .attributes ).is_equal_to (
4547 {
4648 "http.scheme" : "http" ,
4749 "http.host" : "testserver" ,
4850 "net.host.port" : 80 ,
4951 "http.flavor" : "1.1" ,
5052 "http.target" : "/" ,
53+ "net.peer.ip" : "testclient" ,
54+ "net.peer.port" : 50000 ,
5155 "http.url" : "http://testserver/" ,
5256 "http.method" : "GET" ,
5357 "http.server_name" : "testserver" ,
@@ -71,8 +75,10 @@ async def test_tracing_with_empty_routes() -> None:
7175 # Assert
7276 first_span , second_span , third_span = cast ("tuple[Span, Span, Span]" , exporter .get_finished_spans ())
7377 assert response .status_code == 405
74- assert_that (first_span .attributes ).is_equal_to ({"http.status_code" : 405 , "type" : "http.response.start" })
75- assert_that (second_span .attributes ).is_equal_to ({"type" : "http.response.body" })
78+ assert_that (first_span .attributes ).is_equal_to (
79+ {"http.status_code" : 405 , "asgi.event.type" : "http.response.start" },
80+ )
81+ assert_that (second_span .attributes ).is_equal_to ({"asgi.event.type" : "http.response.body" })
7682 assert_that (third_span .attributes ).is_equal_to (
7783 {
7884 "http.scheme" : "http" ,
@@ -86,6 +92,8 @@ async def test_tracing_with_empty_routes() -> None:
8692 "http.user_agent" : "testclient" ,
8793 "http.status_code" : 405 ,
8894 "http.route" : "/" ,
95+ "net.peer.ip" : "testclient" ,
96+ "net.peer.port" : 50000 ,
8997 },
9098 )
9199
@@ -103,8 +111,10 @@ async def test_tracing_partial_match() -> None:
103111 # Assert
104112 first_span , second_span , third_span = cast ("tuple[Span, Span, Span]" , exporter .get_finished_spans ())
105113 assert response .status_code == 404
106- assert_that (first_span .attributes ).is_equal_to ({"http.status_code" : 404 , "type" : "http.response.start" })
107- assert_that (second_span .attributes ).is_equal_to ({"type" : "http.response.body" })
114+ assert_that (first_span .attributes ).is_equal_to (
115+ {"http.status_code" : 404 , "asgi.event.type" : "http.response.start" },
116+ )
117+ assert_that (second_span .attributes ).is_equal_to ({"asgi.event.type" : "http.response.body" })
108118 assert_that (third_span .attributes ).is_equal_to (
109119 {
110120 "http.scheme" : "http" ,
@@ -117,6 +127,8 @@ async def test_tracing_partial_match() -> None:
117127 "http.server_name" : "testserver" ,
118128 "http.user_agent" : "testclient" ,
119129 "http.status_code" : 404 ,
130+ "net.peer.ip" : "testclient" ,
131+ "net.peer.port" : 50000 ,
120132 },
121133 )
122134
0 commit comments