Skip to content

thrift_proxy: Fix success/error thrift metrics on passthrough#18415

Merged
mattklein123 merged 5 commits intoenvoyproxy:mainfrom
fishcakez:pass-metric
Oct 6, 2021
Merged

thrift_proxy: Fix success/error thrift metrics on passthrough#18415
mattklein123 merged 5 commits intoenvoyproxy:mainfrom
fishcakez:pass-metric

Conversation

@fishcakez
Copy link
Contributor

@fishcakez fishcakez commented Oct 4, 2021

Commit Message: thrift_proxy: Fix success/error thrift metrics on passthrough
Additional Description: When performing thrift payload passthrough the downstream metric is always reporting success (until #18296 when neither are reported) and the upstream metric always increment error. Payload passthrough could not detect the reply type because that is encoded in the payload. When not using passthrough the detection was performed inside the connection manager and shadow writer with equivalent implementations. Therefore refactor the success/error detection to be done inside the decoder statemachine before performing payload passthrough at the thrift protocol level via a peek into the payload if message type is a reply.
Risk Level: low
Testing: unit/integ tests and deployed local
Docs Changes: N/A
Release Notes: bug fix.
Platform Specific Features: N/A
Fixes commit #PR or SHA: #13592 #15668

Signed-off-by: James Fish <jfish@pinterest.com>
@fishcakez fishcakez requested a review from zuercher as a code owner October 4, 2021 19:42
Copy link
Member

@rgs1 rgs1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few nits to get started, I'll do another pass in before the next diaper change. Thanks!

* @return true if reply type was successfully read, false if more data is required
* @throw EnvoyException if the data is not a valid payload
*/
virtual bool peekReplyPayload(Buffer::Instance& buffer, ReplyType& reply_type) PURE;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could this be body const?

Copy link
Contributor Author

@fishcakez fishcakez Oct 4, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it could be but that opens a can of worms on the peek buffer helpers we have. Ill look into fixing that in a later PR i think unless you want to solve that here.

Copy link
Member

@rgs1 rgs1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few more things.

Signed-off-by: James Fish <jfish@pinterest.com>
Signed-off-by: James Fish <jfish@pinterest.com>
Signed-off-by: James Fish <jfish@pinterest.com>
Signed-off-by: James Fish <jfish@pinterest.com>
Copy link
Member

@rgs1 rgs1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the fix!

@rgs1
Copy link
Member

rgs1 commented Oct 6, 2021

Over to @zuercher for merging.

@mattklein123 mattklein123 merged commit a5927dc into envoyproxy:main Oct 6, 2021
@fishcakez fishcakez deleted the pass-metric branch October 6, 2021 17:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants