Skip to content

Commit

Permalink
Fixed after CR
Browse files Browse the repository at this point in the history
  • Loading branch information
shalevr committed Jul 27, 2022
1 parent f4261ba commit 56fb196
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ def instrumented_urlopen(wrapped, instance, args, kwargs):
with _suppress_further_instrumentation():
start_time = default_timer()
response = wrapped(*args, **kwargs)
elapsed_time = (default_timer() - start_time) * 1000
elapsed_time = round((default_timer() - start_time) * 1000)

_apply_response(span, response)
if callable(response_hook):
Expand All @@ -227,12 +227,14 @@ def instrumented_urlopen(wrapped, instance, args, kwargs):
)

request_size = 0 if body is None else len(body)
response_size = int(response.headers.get("Content-Length", 0))

duration_histogram.record(elapsed_time, attributes=metric_labels)
request_size_histogram.record(
request_size, attributes=metric_labels
)
response_size_histogram.record(
len(response.data), attributes=metric_labels
response_size, attributes=metric_labels
)

return response
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@
# See the License for the specific language governing permissions and
# limitations under the License.

__version__ = "0.33b0"
__version__ = "0.32b0"
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ def test_basic_metric_check_client_size_post(self):
self.assertAlmostEqual(
data_point.sum,
client_duration_estimated,
delta=5000,
delta=100,
)
self.assertIn(metric.name, expected_metrics)

Expand Down

0 comments on commit 56fb196

Please sign in to comment.