Skip to content

Commit 0f66541

Browse files
committed
Fixed after CR
1 parent f4261ba commit 0f66541

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

Diff for: instrumentation/opentelemetry-instrumentation-urllib3/src/opentelemetry/instrumentation/urllib3/__init__.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ def instrumented_urlopen(wrapped, instance, args, kwargs):
205205
with _suppress_further_instrumentation():
206206
start_time = default_timer()
207207
response = wrapped(*args, **kwargs)
208-
elapsed_time = (default_timer() - start_time) * 1000
208+
elapsed_time = round((default_timer() - start_time) * 1000)
209209

210210
_apply_response(span, response)
211211
if callable(response_hook):
@@ -227,12 +227,14 @@ def instrumented_urlopen(wrapped, instance, args, kwargs):
227227
)
228228

229229
request_size = 0 if body is None else len(body)
230+
response_size = int(response.headers.get("Content-Length", 0))
231+
230232
duration_histogram.record(elapsed_time, attributes=metric_labels)
231233
request_size_histogram.record(
232234
request_size, attributes=metric_labels
233235
)
234236
response_size_histogram.record(
235-
len(response.data), attributes=metric_labels
237+
response_size, attributes=metric_labels
236238
)
237239

238240
return response

Diff for: instrumentation/opentelemetry-instrumentation-urllib3/src/opentelemetry/instrumentation/urllib3/version.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
__version__ = "0.33b0"
15+
__version__ = "0.32b0"

Diff for: instrumentation/opentelemetry-instrumentation-urllib3/tests/test_urllib3_ip_support.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ def test_basic_metric_check_client_size_post(self):
197197
self.assertAlmostEqual(
198198
data_point.sum,
199199
client_duration_estimated,
200-
delta=5000,
200+
delta=1000,
201201
)
202202
self.assertIn(metric.name, expected_metrics)
203203

0 commit comments

Comments
 (0)