-
Notifications
You must be signed in to change notification settings - Fork 10.3k
Description
Proposal
Use case. Why is this important?
The promtool test rules utility produces error outputs that are sometimes hard to read. This is because the expected and actual data structures being compared are printed using a %#v dump. In particular, it is hard to read the difference between the two structures when they are large - eg. a lot of labels and/or a lot of annotations.
Moreover, it's hard to improve/collect the output from a third-party tool, because the "%#v" dump is not easily parsable.
What are the changes I'm proposing?
For promtool test rules introduce a flag --format, initially, with only a single supported value: "json". This will encode the output as JSON and allows third party tools to easily parse the output and format it as needed.
In this PR #7549 I'm trying to solve my initial issue, which is diffing the exp and got data structures so I can understand my tests is failing. At this point, I think that method has disadvantages: - it introduces a new dependency; - it's not flexible; - it contributes to the problem, instead of fixing it.
I'm happy to work on this if I get a green light!