@@ -78,14 +78,11 @@ def test_get_request(self) -> None:
78
78
assert spyne_span .ec is None
79
79
80
80
# spyne
81
- assert spyne_span .n == "spyne"
82
- assert (
83
- "127.0.0.1:" + str (testenv ["spyne_port" ]) == spyne_span .data ["http" ]["host" ]
84
- )
85
- assert spyne_span .data ["http" ]["url" ] == "/hello"
86
- assert spyne_span .data ["http" ]["method" ] == "GET"
87
- assert spyne_span .data ["http" ]["status" ] == 200
88
- assert spyne_span .data ["http" ]["error" ] is None
81
+ assert spyne_span .n == "rpc-server"
82
+ assert spyne_span .data ["rpc" ]["host" ] == "127.0.0.1"
83
+ assert spyne_span .data ["rpc" ]["call" ] == "/hello"
84
+ assert spyne_span .data ["rpc" ]["port" ] == str (testenv ["spyne_port" ])
85
+ assert spyne_span .data ["rpc" ]["error" ] is None
89
86
assert spyne_span .stack is None
90
87
91
88
def test_secret_scrubbing (self ) -> None :
@@ -137,161 +134,14 @@ def test_secret_scrubbing(self) -> None:
137
134
assert spyne_span .ec is None
138
135
139
136
# spyne
140
- assert spyne_span .n == "spyne"
141
- assert (
142
- "127.0.0.1:" + str (testenv ["spyne_port" ]) == spyne_span .data ["http" ]["host" ]
143
- )
144
- assert spyne_span .data ["http" ]["url" ] == "/say_hello"
145
- assert spyne_span .data ["http" ]["params" ] == "name=World×=4&secret=<redacted>"
146
- assert spyne_span .data ["http" ]["method" ] == "GET"
147
- assert spyne_span .data ["http" ]["status" ] == 200
148
- assert spyne_span .data ["http" ]["error" ] is None
149
- assert spyne_span .stack is None
150
-
151
- def test_request_header_capture (self ) -> None :
152
- # Hack together a manual custom headers list
153
- original_extra_http_headers = agent .options .extra_http_headers
154
- agent .options .extra_http_headers = ["X-Capture-This-Too" , "X-Capture-That-Too" ]
155
-
156
- request_headers = {
157
- "X-Capture-This-Too" : "this too" ,
158
- "X-Capture-That-Too" : "that too" ,
159
- }
160
-
161
- with tracer .start_as_current_span ("test" ):
162
- response = self .http .request ("GET" , testenv ["spyne_server" ] + "/hello" , headers = request_headers )
163
-
164
- spans = self .recorder .queued_spans ()
165
-
166
- assert len (spans ) == 3
167
-
168
- spyne_span = spans [0 ]
169
- urllib3_span = spans [1 ]
170
- test_span = spans [2 ]
171
-
172
- assert response .status == 200
173
-
174
- assert "X-INSTANA-T" in response .headers
175
- assert int (response .headers ["X-INSTANA-T" ], 16 )
176
- assert response .headers ["X-INSTANA-T" ] == hex_id (spyne_span .t )
177
-
178
- assert "X-INSTANA-S" in response .headers
179
- assert int (response .headers ["X-INSTANA-S" ], 16 )
180
- assert response .headers ["X-INSTANA-S" ] == hex_id (spyne_span .s )
181
-
182
- assert "X-INSTANA-L" in response .headers
183
- assert response .headers ["X-INSTANA-L" ] == "1"
184
-
185
- assert "Server-Timing" in response .headers
186
- server_timing_value = f"intid;desc={ hex_id (spyne_span .t )} "
187
- assert response .headers ["Server-Timing" ] == server_timing_value
188
-
189
- # Same traceId
190
- assert test_span .t == urllib3_span .t
191
- assert urllib3_span .t == spyne_span .t
192
-
193
- # Parent relationships
194
- assert urllib3_span .p == test_span .s
195
- assert spyne_span .p == urllib3_span .s
196
-
197
- assert spyne_span .sy is None
198
- assert urllib3_span .sy is None
199
- assert test_span .sy is None
200
-
201
- # Error logging
202
- assert test_span .ec is None
203
- assert urllib3_span .ec is None
204
- assert spyne_span .ec is None
205
-
206
- # spyne
207
- assert spyne_span .n == "spyne"
208
- assert (
209
- "127.0.0.1:" + str (testenv ["spyne_port" ]) == spyne_span .data ["http" ]["host" ]
210
- )
211
- assert spyne_span .data ["http" ]["url" ] == "/hello"
212
- assert spyne_span .data ["http" ]["method" ] == "GET"
213
- assert spyne_span .data ["http" ]["status" ] == 200
214
- assert spyne_span .data ["http" ]["error" ] is None
215
- assert spyne_span .stack is None
216
-
217
- # custom headers
218
- assert "X-Capture-This-Too" in spyne_span .data ["http" ]["header" ]
219
- assert spyne_span .data ["http" ]["header" ]["X-Capture-This-Too" ] == "this too"
220
- assert "X-Capture-That-Too" in spyne_span .data ["http" ]["header" ]
221
- assert spyne_span .data ["http" ]["header" ]["X-Capture-That-Too" ] == "that too"
222
-
223
- agent .options .extra_http_headers = original_extra_http_headers
224
-
225
- def test_response_header_capture (self ) -> None :
226
- # Hack together a manual custom headers list
227
- original_extra_http_headers = agent .options .extra_http_headers
228
- agent .options .extra_http_headers = ["X-Capture-This" , "X-Capture-That" ]
229
-
230
- with tracer .start_as_current_span ("test" ):
231
- response = self .http .request ("GET" , testenv ["spyne_server" ] + "/response_headers" )
232
-
233
- spans = self .recorder .queued_spans ()
234
-
235
- assert len (spans ) == 3
236
-
237
- spyne_span = spans [0 ]
238
- urllib3_span = spans [1 ]
239
- test_span = spans [2 ]
240
-
241
- assert response .status == 200
242
-
243
- assert "X-INSTANA-T" in response .headers
244
- assert int (response .headers ["X-INSTANA-T" ], 16 )
245
- assert response .headers ["X-INSTANA-T" ] == hex_id (spyne_span .t )
246
-
247
- assert "X-INSTANA-S" in response .headers
248
- assert int (response .headers ["X-INSTANA-S" ], 16 )
249
- assert response .headers ["X-INSTANA-S" ] == hex_id (spyne_span .s )
250
-
251
- assert "X-INSTANA-L" in response .headers
252
- assert response .headers ["X-INSTANA-L" ] == "1"
253
-
254
- assert "Server-Timing" in response .headers
255
- server_timing_value = f"intid;desc={ hex_id (spyne_span .t )} "
256
- assert response .headers ["Server-Timing" ] == server_timing_value
257
-
258
- # Same traceId
259
- assert test_span .t == urllib3_span .t
260
- assert urllib3_span .t == spyne_span .t
261
-
262
- # Parent relationships
263
- assert urllib3_span .p == test_span .s
264
- assert spyne_span .p == urllib3_span .s
265
-
266
- # Synthetic
267
- assert spyne_span .sy is None
268
- assert urllib3_span .sy is None
269
- assert test_span .sy is None
270
-
271
- # Error logging
272
- assert test_span .ec is None
273
- assert urllib3_span .ec is None
274
- assert spyne_span .ec is None
275
-
276
- # spyne
277
- assert spyne_span .n == "spyne"
278
- assert (
279
- "127.0.0.1:" + str (testenv ["spyne_port" ]) == spyne_span .data ["http" ]["host" ]
280
- )
281
- assert spyne_span .data ["http" ]["url" ] == "/response_headers"
282
- assert spyne_span .data ["http" ]["method" ] == "GET"
283
- assert spyne_span .data ["http" ]["status" ] == 200
284
- assert spyne_span .data ["http" ]["error" ] is None
137
+ assert spyne_span .n == "rpc-server"
138
+ assert spyne_span .data ["rpc" ]["host" ] == "127.0.0.1"
139
+ assert spyne_span .data ["rpc" ]["call" ] == "/say_hello"
140
+ assert spyne_span .data ["rpc" ]["params" ] == "name=World×=4&secret=<redacted>"
141
+ assert spyne_span .data ["rpc" ]["port" ] == str (testenv ["spyne_port" ])
142
+ assert spyne_span .data ["rpc" ]["error" ] is None
285
143
assert spyne_span .stack is None
286
144
287
- # custom headers
288
- assert "X-Capture-This" in spyne_span .data ["http" ]["header" ]
289
- assert spyne_span .data ["http" ]["header" ]["X-Capture-This" ] == "this"
290
- assert "X-Capture-That" in spyne_span .data ["http" ]["header" ]
291
- assert spyne_span .data ["http" ]["header" ]["X-Capture-That" ] == "that"
292
-
293
- agent .options .extra_http_headers = original_extra_http_headers
294
-
295
145
def test_custom_404 (self ) -> None :
296
146
with tracer .start_as_current_span ("test" ):
297
147
response = self .http .request ("GET" , testenv ["spyne_server" ] + "/custom_404?user_id=9876" )
@@ -307,7 +157,7 @@ def test_custom_404(self) -> None:
307
157
test_span = spans [3 ]
308
158
309
159
assert response
310
- assert response .status == 404
160
+ assert response .status == 404
311
161
312
162
assert "X-INSTANA-T" in response .headers
313
163
assert int (response .headers ["X-INSTANA-T" ], 16 )
@@ -343,14 +193,12 @@ def test_custom_404(self) -> None:
343
193
assert spyne_span .ec is None
344
194
345
195
# spyne
346
- assert spyne_span .n == "spyne"
347
- assert (
348
- "127.0.0.1:" + str (testenv ["spyne_port" ]) == spyne_span .data ["http" ]["host" ]
349
- )
350
- assert spyne_span .data ["http" ]["url" ] == "/custom_404"
351
- assert spyne_span .data ["http" ]["method" ] == "GET"
352
- assert spyne_span .data ["http" ]["status" ] == 404
353
- assert spyne_span .data ["http" ]["error" ] is None
196
+ assert spyne_span .n == "rpc-server"
197
+ assert spyne_span .data ["rpc" ]["host" ] == "127.0.0.1"
198
+ assert spyne_span .data ["rpc" ]["call" ] == "/custom_404"
199
+ assert spyne_span .data ["rpc" ]["port" ] == str (testenv ["spyne_port" ])
200
+ assert spyne_span .data ["rpc" ]["params" ] == "user_id=9876"
201
+ assert spyne_span .data ["rpc" ]["error" ] is None
354
202
assert spyne_span .stack is None
355
203
356
204
# urllib3
@@ -379,7 +227,7 @@ def test_404(self) -> None:
379
227
test_span = spans [2 ]
380
228
381
229
assert response
382
- assert response .status == 404
230
+ assert response .status == 404
383
231
384
232
assert "X-INSTANA-T" in response .headers
385
233
assert int (response .headers ["X-INSTANA-T" ], 16 )
@@ -415,14 +263,11 @@ def test_404(self) -> None:
415
263
assert spyne_span .ec is None
416
264
417
265
# spyne
418
- assert spyne_span .n == "spyne"
419
- assert (
420
- "127.0.0.1:" + str (testenv ["spyne_port" ]) == spyne_span .data ["http" ]["host" ]
421
- )
422
- assert spyne_span .data ["http" ]["url" ] == "/11111"
423
- assert spyne_span .data ["http" ]["method" ] == "GET"
424
- assert spyne_span .data ["http" ]["status" ] == 404
425
- assert spyne_span .data ["http" ]["error" ] is None
266
+ assert spyne_span .n == "rpc-server"
267
+ assert spyne_span .data ["rpc" ]["host" ] == "127.0.0.1"
268
+ assert spyne_span .data ["rpc" ]["call" ] == "/11111"
269
+ assert spyne_span .data ["rpc" ]["port" ] == str (testenv ["spyne_port" ])
270
+ assert spyne_span .data ["rpc" ]["error" ] is None
426
271
assert spyne_span .stack is None
427
272
428
273
# urllib3
@@ -487,12 +332,9 @@ def test_500(self) -> None:
487
332
assert spyne_span .ec == 1
488
333
489
334
# spyne
490
- assert spyne_span .n == "spyne"
491
- assert (
492
- "127.0.0.1:" + str (testenv ["spyne_port" ]) == spyne_span .data ["http" ]["host" ]
493
- )
494
- assert spyne_span .data ["http" ]["url" ] == "/exception"
495
- assert spyne_span .data ["http" ]["method" ] == "GET"
496
- assert spyne_span .data ["http" ]["status" ] == 500
497
- assert spyne_span .data ["http" ]["error" ] is None
335
+ assert spyne_span .n == "rpc-server"
336
+ assert spyne_span .data ["rpc" ]["host" ] == "127.0.0.1"
337
+ assert spyne_span .data ["rpc" ]["call" ] == "/exception"
338
+ assert spyne_span .data ["rpc" ]["port" ] == str (testenv ["spyne_port" ])
339
+ assert spyne_span .data ["rpc" ]["error" ]
498
340
assert spyne_span .stack is None
0 commit comments