Add experimental "pedantic" fortio output formatter.#534
Add experimental "pedantic" fortio output formatter.#534mum4k merged 7 commits intoenvoyproxy:masterfrom
Conversation
Adds a post-processing step to massage the fortio output formatting to more exactly reproduce Fortio's output, while leaving the original output formatter intact for backwards compatibility purposes. Fixes known issues envoyproxy#422 and fixes envoyproxy#514. Experimental until we have some conformation that this can be marked as final / all issues have been resolved. Signed-off-by: Otto van der Schaaf <oschaaf@we-amp.com>
Signed-off-by: Otto van der Schaaf <oschaaf@we-amp.com>
Signed-off-by: Otto van der Schaaf <oschaaf@we-amp.com>
|
@eric846 Please review and assign back to me once done. |
kushthedude
left a comment
There was a problem hiding this comment.
This works for us!
/cc @leecalcote
|
Also /cc @carolynhu |
| "Min": 0.053798911, | ||
| "Max": 0.310886399, | ||
| "Sum": 4.156954618, | ||
| "Avg": 0.078433106, | ||
| "StdDev": 0.05052302, |
There was a problem hiding this comment.
Could we move these fields (line 197 to line 201) up to under line 8 "Count" field as what fortio has?
There was a problem hiding this comment.
That is quite hard to pull off in the current approach. Looking at it, the proto json serialiser we use here alphabetically sorts this. I think it can do that, because after parsing the difference usually doesn't matter? Do you see a way that the re-ordering could cause trouble?
There was a problem hiding this comment.
Not yet. Just noticed the order is mismatch with fortio. Don't think it will cause any trouble.
| }, | ||
| { | ||
| "Percentile": 95, | ||
| "Value": 47353 |
There was a problem hiding this comment.
are these value fake or real? as this is in seconds...
There was a problem hiding this comment.
I didn't come up with this test data, it's a copy of a pre-existing one modified to reflect the changes in here. If I interpret the file correctly, we're not looking at seconds, but rather a histogram of byte counts for the header?
|
@oschaaf thank you for today's call. Very much enjoyed it. We can assist in verifying compatibility. Are the build artifacts of this PR (the container image) available? |
Signed-off-by: Otto van der Schaaf <oschaaf@we-amp.com>
Signed-off-by: Otto van der Schaaf <oschaaf@we-amp.com>
@leecalcote |
| // Fix two types of quirks. We disable linting because we use std::regex directly. | ||
| // This should be OK as the regular expression we use can be trusted. | ||
| // 1. We misdefined RequestedRPS as an int, whereas Fortio outputs that as a string. | ||
| res = std::regex_replace(res, std::regex(R"EOF("RequestedQPS"\: ([0-9]*))EOF"), |
There was a problem hiding this comment.
(optional) Would you mind including (in the comment) and example of the matched string? That usually helps when trying to understand regexes in code. This one is fairly trivial, so optional, but we could use one for the second regex.
There was a problem hiding this comment.
Yeah, I always felt that regular expressions are kind of a write-only concept :-)
Done in 2df8c2b
| double durationToSeconds(const Envoy::ProtobufWkt::Duration& duration) const; | ||
| }; | ||
|
|
||
| class FortioPedanticOutputFormatterImpl : public FortioOutputFormatterImpl { |
There was a problem hiding this comment.
Can we add a comment on the class roughly explaining what it is for?
test/output_formatter_test.cc
Outdated
| } | ||
|
|
||
| TEST_F(MediumOutputCollectorTest, FortioPedanticFormatter) { | ||
| const auto input_proto = loadProtoFromFile("test/test_data/output_formatter.medium.proto.gold"); |
There was a problem hiding this comment.
The "auto" here doesn't seem to hide redundant type information, so it might be better for the reader to spell it out.
| TEST_F(MediumOutputCollectorTest, FortioPedanticFormatter) { | ||
| const auto input_proto = loadProtoFromFile("test/test_data/output_formatter.medium.proto.gold"); | ||
| FortioPedanticOutputFormatterImpl formatter; | ||
| expectEqualToGoldFile(formatter.formatProto(input_proto), |
There was a problem hiding this comment.
This golden file is fairly long which makes it hard for the reader to figure out which portions actually are relevant to this test and which are just noise. Any way we could cut it down to the minimum required to test this new behavior?
There was a problem hiding this comment.
This makes sense, but is kind of pre-existing; I think the initial work for this just grabbed a raw arbitrary snapshot and included it for testing the origin fortio output formatter code.
We are now more or less forced to propagate that, as our new gold file is an amended version of the original one.
I punted this to #542 to track doing this, does that work for you?
Signed-off-by: Otto van der Schaaf <oschaaf@we-amp.com>
Signed-off-by: Otto van der Schaaf <oschaaf@we-amp.com>
| TEST_F(MediumOutputCollectorTest, FortioPedanticFormatter) { | ||
| const auto input_proto = loadProtoFromFile("test/test_data/output_formatter.medium.proto.gold"); | ||
| FortioPedanticOutputFormatterImpl formatter; | ||
| expectEqualToGoldFile(formatter.formatProto(input_proto), |
Adds a post-processing step to massage the fortio output formatting
to more exactly reproduce Fortio's output, while leaving the
original output formatter intact for backwards compatibility purposes.
Fixes known issues #422 and #514. Experimental until we have
some confirmation that this can be marked as final / all issues have
been resolved.
Signed-off-by: Otto van der Schaaf oschaaf@we-amp.com