Skip to content

Commit

Permalink
Merge branch 'main' into redis_additional_attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
lzchen authored Aug 28, 2024
2 parents 748022a + b0129ac commit 7b5bd19
Showing 1 changed file with 25 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -530,7 +530,7 @@ def test_basic_metric_success(self):
dict(point.attributes),
)
self.assertEqual(point.count, 1)
self.assertAlmostEqual(duration, point.sum, delta=40)
self.assertAlmostEqual(duration, point.sum, delta=350)
if isinstance(point, NumberDataPoint):
self.assertDictEqual(
expected_requests_count_attributes,
Expand Down Expand Up @@ -565,7 +565,9 @@ def test_basic_metric_success_new_semconv(self):
)
self.assertEqual(point.count, 1)
if metric.name == "http.server.request.duration":
self.assertAlmostEqual(duration_s, point.sum, places=1)
self.assertAlmostEqual(
duration_s * 0.1, point.sum, places=1
)
elif metric.name == "http.server.response.body.size":
self.assertEqual(25, point.sum)
elif metric.name == "http.server.request.body.size":
Expand Down Expand Up @@ -615,9 +617,11 @@ def test_basic_metric_success_both_semconv(self):
for point in list(metric.data.data_points):
if isinstance(point, HistogramDataPoint):
self.assertEqual(point.count, 1)
self.assertAlmostEqual(duration, point.sum, delta=40)
self.assertAlmostEqual(duration, point.sum, delta=350)
if metric.name == "http.server.request.duration":
self.assertAlmostEqual(duration_s, point.sum, places=1)
self.assertAlmostEqual(
duration_s * 0.1, point.sum, places=1
)
self.assertDictEqual(
expected_duration_attributes_new,
dict(point.attributes),
Expand All @@ -635,7 +639,7 @@ def test_basic_metric_success_both_semconv(self):
dict(point.attributes),
)
elif metric.name == "http.server.duration":
self.assertAlmostEqual(duration, point.sum, delta=40)
self.assertAlmostEqual(duration, point.sum, delta=350)
self.assertDictEqual(
expected_duration_attributes_old,
dict(point.attributes),
Expand Down Expand Up @@ -691,7 +695,7 @@ def test_basic_metric_nonstandard_http_method_success(self):
dict(point.attributes),
)
self.assertEqual(point.count, 1)
self.assertAlmostEqual(duration, point.sum, delta=40)
self.assertAlmostEqual(duration, point.sum, delta=350)
if isinstance(point, NumberDataPoint):
self.assertDictEqual(
expected_requests_count_attributes,
Expand Down Expand Up @@ -726,7 +730,9 @@ def test_basic_metric_nonstandard_http_method_success_new_semconv(self):
)
self.assertEqual(point.count, 1)
if metric.name == "http.server.request.duration":
self.assertAlmostEqual(duration_s, point.sum, places=1)
self.assertAlmostEqual(
duration_s * 0.1, point.sum, places=1
)
elif metric.name == "http.server.response.body.size":
self.assertEqual(31, point.sum)
elif metric.name == "http.server.request.body.size":
Expand Down Expand Up @@ -777,7 +783,9 @@ def test_basic_metric_nonstandard_http_method_success_both_semconv(self):
if isinstance(point, HistogramDataPoint):
self.assertEqual(point.count, 1)
if metric.name == "http.server.request.duration":
self.assertAlmostEqual(duration_s, point.sum, places=1)
self.assertAlmostEqual(
duration_s * 0.1, point.sum, places=1
)
self.assertDictEqual(
expected_duration_attributes_new,
dict(point.attributes),
Expand All @@ -795,7 +803,7 @@ def test_basic_metric_nonstandard_http_method_success_both_semconv(self):
dict(point.attributes),
)
elif metric.name == "http.server.duration":
self.assertAlmostEqual(duration, point.sum, delta=40)
self.assertAlmostEqual(duration, point.sum, delta=350)
self.assertDictEqual(
expected_duration_attributes_old,
dict(point.attributes),
Expand Down Expand Up @@ -836,7 +844,7 @@ def test_basic_post_request_metric_success(self):
if isinstance(point, HistogramDataPoint):
self.assertEqual(point.count, 1)
if metric.name == "http.server.duration":
self.assertAlmostEqual(duration, point.sum, delta=40)
self.assertAlmostEqual(duration, point.sum, delta=350)
elif metric.name == "http.server.response.size":
self.assertEqual(response_size, point.sum)
elif metric.name == "http.server.request.size":
Expand All @@ -861,7 +869,9 @@ def test_basic_post_request_metric_success_new_semconv(self):
if isinstance(point, HistogramDataPoint):
self.assertEqual(point.count, 1)
if metric.name == "http.server.request.duration":
self.assertAlmostEqual(duration_s, point.sum, places=1)
self.assertAlmostEqual(
duration_s * 0.1, point.sum, places=1
)
elif metric.name == "http.server.response.body.size":
self.assertEqual(response_size, point.sum)
elif metric.name == "http.server.request.body.size":
Expand All @@ -887,13 +897,15 @@ def test_basic_post_request_metric_success_both_semconv(self):
if isinstance(point, HistogramDataPoint):
self.assertEqual(point.count, 1)
if metric.name == "http.server.request.duration":
self.assertAlmostEqual(duration_s, point.sum, places=1)
self.assertAlmostEqual(
duration_s * 0.1, point.sum, places=1
)
elif metric.name == "http.server.response.body.size":
self.assertEqual(response_size, point.sum)
elif metric.name == "http.server.request.body.size":
self.assertEqual(request_size, point.sum)
elif metric.name == "http.server.duration":
self.assertAlmostEqual(duration, point.sum, delta=40)
self.assertAlmostEqual(duration, point.sum, delta=350)
elif metric.name == "http.server.response.size":
self.assertEqual(response_size, point.sum)
elif metric.name == "http.server.request.size":
Expand Down

0 comments on commit 7b5bd19

Please sign in to comment.