Skip to content

Commit e1fd263

Browse files
committed
Remove llm workarounds for pook http.client interceptor bugs
1 parent bfcd260 commit e1fd263

1 file changed

Lines changed: 20 additions & 50 deletions

File tree

instrumentation/opentelemetry-instrumentation-urllib/tests/test_metrics_instrumentation.py

Lines changed: 20 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -119,9 +119,7 @@ def test_basic_metric(self):
119119
"http.status_code": int(result.code),
120120
"http.method": "GET",
121121
"http.url": str(result.url),
122-
"http.flavor": client_duration.data.data_points[
123-
0
124-
].attributes["http.flavor"],
122+
"http.flavor": "1.1",
125123
},
126124
),
127125
est_value_delta=40,
@@ -139,9 +137,7 @@ def test_basic_metric(self):
139137
"http.status_code": int(result.code),
140138
"http.method": "GET",
141139
"http.url": str(result.url),
142-
"http.flavor": client_request_size.data.data_points[
143-
0
144-
].attributes["http.flavor"],
140+
"http.flavor": "1.1",
145141
},
146142
),
147143
)
@@ -153,14 +149,12 @@ def test_basic_metric(self):
153149
self.assert_metric_expected(
154150
client_response_size,
155151
self.create_histogram_data_points(
156-
client_response_size.data.data_points[0].sum,
152+
result.length,
157153
attributes={
158154
"http.status_code": int(result.code),
159155
"http.method": "GET",
160156
"http.url": str(result.url),
161-
"http.flavor": client_response_size.data.data_points[
162-
0
163-
].attributes["http.flavor"],
157+
"http.flavor": "1.1",
164158
},
165159
),
166160
)
@@ -190,9 +184,7 @@ def test_basic_metric_new_semconv(self):
190184
attributes={
191185
"http.response.status_code": int(result.code),
192186
"http.request.method": "GET",
193-
"network.protocol.version": client_request_duration.data.data_points[
194-
0
195-
].attributes["network.protocol.version"],
187+
"network.protocol.version": "1.1",
196188
},
197189
explicit_bounds=HTTP_DURATION_HISTOGRAM_BUCKETS_NEW,
198190
),
@@ -210,9 +202,7 @@ def test_basic_metric_new_semconv(self):
210202
attributes={
211203
"http.response.status_code": int(result.code),
212204
"http.request.method": "GET",
213-
"network.protocol.version": client_request_body_size.data.data_points[
214-
0
215-
].attributes["network.protocol.version"],
205+
"network.protocol.version": "1.1",
216206
},
217207
),
218208
)
@@ -224,13 +214,11 @@ def test_basic_metric_new_semconv(self):
224214
self.assert_metric_expected(
225215
client_response_body_size,
226216
self.create_histogram_data_points(
227-
client_response_body_size.data.data_points[0].sum,
217+
result.length,
228218
attributes={
229219
"http.response.status_code": int(result.code),
230220
"http.request.method": "GET",
231-
"network.protocol.version": client_response_body_size.data.data_points[
232-
0
233-
].attributes["network.protocol.version"],
221+
"network.protocol.version": "1.1",
234222
},
235223
),
236224
)
@@ -265,9 +253,7 @@ def test_basic_metric_both_semconv(self):
265253
"http.status_code": int(result.code),
266254
"http.method": "GET",
267255
"http.url": str(result.url),
268-
"http.flavor": client_duration.data.data_points[
269-
0
270-
].attributes["http.flavor"],
256+
"http.flavor": "1.1",
271257
},
272258
),
273259
est_value_delta=40,
@@ -285,9 +271,7 @@ def test_basic_metric_both_semconv(self):
285271
"http.status_code": int(result.code),
286272
"http.method": "GET",
287273
"http.url": str(result.url),
288-
"http.flavor": client_request_size.data.data_points[
289-
0
290-
].attributes["http.flavor"],
274+
"http.flavor": "1.1",
291275
},
292276
),
293277
)
@@ -299,14 +283,12 @@ def test_basic_metric_both_semconv(self):
299283
self.assert_metric_expected(
300284
client_response_size,
301285
self.create_histogram_data_points(
302-
client_response_size.data.data_points[0].sum,
286+
result.length,
303287
attributes={
304288
"http.status_code": int(result.code),
305289
"http.method": "GET",
306290
"http.url": str(result.url),
307-
"http.flavor": client_response_size.data.data_points[
308-
0
309-
].attributes["http.flavor"],
291+
"http.flavor": "1.1",
310292
},
311293
),
312294
)
@@ -322,9 +304,7 @@ def test_basic_metric_both_semconv(self):
322304
attributes={
323305
"http.response.status_code": int(result.code),
324306
"http.request.method": "GET",
325-
"network.protocol.version": client_request_duration.data.data_points[
326-
0
327-
].attributes["network.protocol.version"],
307+
"network.protocol.version": "1.1",
328308
},
329309
explicit_bounds=HTTP_DURATION_HISTOGRAM_BUCKETS_NEW,
330310
),
@@ -342,9 +322,7 @@ def test_basic_metric_both_semconv(self):
342322
attributes={
343323
"http.response.status_code": int(result.code),
344324
"http.request.method": "GET",
345-
"network.protocol.version": client_request_body_size.data.data_points[
346-
0
347-
].attributes["network.protocol.version"],
325+
"network.protocol.version": "1.1",
348326
},
349327
),
350328
)
@@ -356,13 +334,11 @@ def test_basic_metric_both_semconv(self):
356334
self.assert_metric_expected(
357335
client_response_body_size,
358336
self.create_histogram_data_points(
359-
client_response_body_size.data.data_points[0].sum,
337+
result.length,
360338
attributes={
361339
"http.response.status_code": int(result.code),
362340
"http.request.method": "GET",
363-
"network.protocol.version": client_response_body_size.data.data_points[
364-
0
365-
].attributes["network.protocol.version"],
341+
"network.protocol.version": "1.1",
366342
},
367343
),
368344
)
@@ -395,9 +371,7 @@ def test_basic_metric_request_not_empty(self):
395371
"http.status_code": int(result.code),
396372
"http.method": "POST",
397373
"http.url": str(result.url),
398-
"http.flavor": client_duration.data.data_points[
399-
0
400-
].attributes["http.flavor"],
374+
"http.flavor": "1.1",
401375
},
402376
),
403377
est_value_delta=40,
@@ -415,9 +389,7 @@ def test_basic_metric_request_not_empty(self):
415389
"http.status_code": int(result.code),
416390
"http.method": "POST",
417391
"http.url": str(result.url),
418-
"http.flavor": client_request_size.data.data_points[
419-
0
420-
].attributes["http.flavor"],
392+
"http.flavor": "1.1",
421393
},
422394
),
423395
)
@@ -429,14 +401,12 @@ def test_basic_metric_request_not_empty(self):
429401
self.assert_metric_expected(
430402
client_response_size,
431403
self.create_histogram_data_points(
432-
client_response_size.data.data_points[0].sum,
404+
result.length,
433405
attributes={
434406
"http.status_code": int(result.code),
435407
"http.method": "POST",
436408
"http.url": str(result.url),
437-
"http.flavor": client_response_size.data.data_points[
438-
0
439-
].attributes["http.flavor"],
409+
"http.flavor": "1.1",
440410
},
441411
),
442412
)

0 commit comments

Comments
 (0)