go-metrics icon indicating copy to clipboard operation
go-metrics copied to clipboard

TestMetrics_MeasureSince is faling on arm64

Open lucaskanashiro opened this issue 4 years ago • 1 comments

TestMetrics_MeasureSince is failing in Ubuntu Groovy 20.10 (development release) on arm64 (Go 1.14), here is the test log. I patched the test to print m (MockSink) after each call of MeasureSince or MeasureSinceWithLabels (4 calls in this test) and commented out the t.Fatalf("") when m.vals[0] > 0.1. Then I ran the test 5 times, here are the results:

Round 1:
&{{0 0} [[key]] [0.00192] [[]]}
&{{0 0} [[key]] [0.268622] [[{a b}]]}
&{{0 0} [[timer key]] [0.294562] [[]]}
&{{0 0} [[service key]] [0.307243] [[]]}

Round 2:
&{{0 0} [[key]] [0.00228] [[]]}
&{{0 0} [[key]] [0.260842] [[{a b}]]}
&{{0 0} [[timer key]] [0.299362] [[]]}
&{{0 0} [[service key]] [0.314462] [[]]}

Round 3:
&{{0 0} [[key]] [0.00192] [[]]}
&{{0 0} [[key]] [0.334702] [[{a b}]]}
&{{0 0} [[timer key]] [0.373842] [[]]}
&{{0 0} [[service key]] [0.408443] [[]]}

Round 4:
&{{0 0} [[key]] [0.00234] [[]]}
&{{0 0} [[key]] [0.220862] [[{a b}]]}
&{{0 0} [[timer key]] [0.254622] [[]]}
&{{0 0} [[service key]] [0.290202] [[]]}

Round 5:
&{{0 0} [[key]] [0.001481] [[]]}
&{{0 0} [[key]] [0.283643] [[{a b}]]}
&{{0 0} [[timer key]] [0.319363] [[]]}
&{{0 0} [[service key]] [0.332583] [[]]}

As you can see the m.vals[0] is lesser or equal to 0.1 in all rounds only in the first scenario covered by this test, all the others fail because they are greater than 0.1. I am not sure why those operations take longer in arm64 than in other architectures (I did not spend too much time investigating the root cause). As a workaround for now I plan to patch this test in the Debian package to check m.vals[0] > 0.5 instead of m.vals[0] > 0.1.

lucaskanashiro avatar Jul 27 '20 19:07 lucaskanashiro

I forgot to mention but a similar behavior can be identified in Test_GlobalMetrics_MeasureSince, specifically in the scenario with labels which is kind of expected.

lucaskanashiro avatar Jul 27 '20 21:07 lucaskanashiro