willkg / markus

Markus is a Python library for generating metrics
Mozilla Public License 2.0
70 stars 8 forks source link

Add print_records() call on assertion failure (#74) #84

Closed willkg closed 3 years ago

willkg commented 3 years ago

If you're using one of the assert_* helper methods on MetricsMock and the assertion fails, then this will make it print the metrics records that were captured.

Fixes #74

willkg commented 3 years ago

@jwhitlock This will show something like this when there's an assertion failure and you're using one of the assert_ helpers in MetricsMock:

---------------------------------------------------- Captured stdout call ------------------------------------------------------
('histogram', 'foobar.key1', 1, [])
('histogram', 'foobar.keymultiple', 1, [])
('histogram', 'foobar.keymultiple', 1, [])
('histogram', 'foobar.key1', 1, [])
('histogram', 'foobar.keymultiple', 1, [])
('histogram', 'foobar.keymultiple', 1, [])

What do you think? Do you think it's clear what it is? If not, what would better output look like?

willkg commented 3 years ago

Thank you for looking at it!

After looking at the output, I think I want to fix the output by changing how print_records() works. Then I'll land this.