@@ -110,7 +110,7 @@ def _test_method(self, method):
110
110
spans = self .memory_exporter .get_finished_spans ()
111
111
self .assertEqual (len (spans ), 1 )
112
112
span = spans [0 ]
113
- self .assertEqual (span .name , f"HelloWorldResource.on_ { method . lower () } " )
113
+ self .assertEqual (span .name , f"{ method } /hello " )
114
114
self .assertEqual (span .status .status_code , StatusCode .UNSET )
115
115
self .assertEqual (
116
116
span .status .description ,
@@ -145,7 +145,7 @@ def test_404(self):
145
145
spans = self .memory_exporter .get_finished_spans ()
146
146
self .assertEqual (len (spans ), 1 )
147
147
span = spans [0 ]
148
- self .assertEqual (span .name , "GET /does-not-exist " )
148
+ self .assertEqual (span .name , "GET" )
149
149
self .assertEqual (span .status .status_code , StatusCode .UNSET )
150
150
self .assertSpanHasAttributes (
151
151
span ,
@@ -177,7 +177,7 @@ def test_500(self):
177
177
spans = self .memory_exporter .get_finished_spans ()
178
178
self .assertEqual (len (spans ), 1 )
179
179
span = spans [0 ]
180
- self .assertEqual (span .name , "ErrorResource.on_get " )
180
+ self .assertEqual (span .name , "GET /error " )
181
181
self .assertFalse (span .status .is_ok )
182
182
self .assertEqual (span .status .status_code , StatusCode .ERROR )
183
183
self .assertEqual (
@@ -206,6 +206,33 @@ def test_500(self):
206
206
span .attributes [SpanAttributes .NET_PEER_IP ], "127.0.0.1"
207
207
)
208
208
209
+ def test_url_template (self ):
210
+ self .client ().simulate_get ("/user/123" )
211
+ spans = self .memory_exporter .get_finished_spans ()
212
+ self .assertEqual (len (spans ), 1 )
213
+ span = spans [0 ]
214
+ self .assertEqual (span .name , "GET /user/{user_id}" )
215
+ self .assertEqual (span .status .status_code , StatusCode .UNSET )
216
+ self .assertEqual (
217
+ span .status .description ,
218
+ None ,
219
+ )
220
+ self .assertSpanHasAttributes (
221
+ span ,
222
+ {
223
+ SpanAttributes .HTTP_METHOD : "GET" ,
224
+ SpanAttributes .HTTP_SERVER_NAME : "falconframework.org" ,
225
+ SpanAttributes .HTTP_SCHEME : "http" ,
226
+ SpanAttributes .NET_HOST_PORT : 80 ,
227
+ SpanAttributes .HTTP_HOST : "falconframework.org" ,
228
+ SpanAttributes .HTTP_TARGET : "/" ,
229
+ SpanAttributes .NET_PEER_PORT : "65133" ,
230
+ SpanAttributes .HTTP_FLAVOR : "1.1" ,
231
+ "falcon.resource" : "UserResource" ,
232
+ SpanAttributes .HTTP_STATUS_CODE : 200 ,
233
+ },
234
+ )
235
+
209
236
def test_uninstrument (self ):
210
237
self .client ().simulate_get (path = "/hello" )
211
238
spans = self .memory_exporter .get_finished_spans ()
0 commit comments