Skip to content

filter: add grpc upstream stats#10748

Merged
ggreenway merged 10 commits intoenvoyproxy:masterfrom
Sh4d1:grpc_upstream_stats
Apr 17, 2020
Merged

filter: add grpc upstream stats#10748
ggreenway merged 10 commits intoenvoyproxy:masterfrom
Sh4d1:grpc_upstream_stats

Conversation

@Sh4d1
Copy link
Contributor

@Sh4d1 Sh4d1 commented Apr 13, 2020

Description: Add upstream_rq_time histogram to grpc stats
Risk Level: Medium
Testing: unit test + manual test
Docs Changes: add note about enable_upstream_stats
Release Notes: added
Parially Fixes #9169

@Sh4d1 Sh4d1 requested a review from lizan as a code owner April 13, 2020 11:34
@repokitteh-read-only
Copy link

CC @envoyproxy/api-shepherds: Your approval is needed for changes made to api/.

🐱

Caused by: #10748 was opened by Sh4d1.

see: more, trace.

@Sh4d1
Copy link
Contributor Author

Sh4d1 commented Apr 13, 2020

cc @kyessenov

@Sh4d1 Sh4d1 force-pushed the grpc_upstream_stats branch 2 times, most recently from 6b5a4cc to 53b3640 Compare April 13, 2020 12:51
Copy link
Member

Choose a reason for hiding this comment

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

change type to std::chrono::duration

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Would miliseconds work? duration is a template, pretty sure I'll need to modify the class as well 🤔

@Sh4d1
Copy link
Contributor Author

Sh4d1 commented Apr 14, 2020

Not sure why the docs are failing 🤔

jmarantz
jmarantz previously approved these changes Apr 14, 2020
Copy link
Contributor

@jmarantz jmarantz left a comment

Choose a reason for hiding this comment

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

Looks good generally; one minor nit.

@envoyproxy/senior-maintainers

Sh4d1 added 10 commits April 16, 2020 08:24
Signed-off-by: Patrik Cyvoct <patrik@ptrk.io>
Signed-off-by: Patrik Cyvoct <patrik@ptrk.io>
Signed-off-by: Patrik Cyvoct <patrik@ptrk.io>
Signed-off-by: Patrik Cyvoct <patrik@ptrk.io>
Signed-off-by: Patrik Cyvoct <patrik@ptrk.io>
Signed-off-by: Patrik Cyvoct <patrik@ptrk.io>
Signed-off-by: Patrik Cyvoct <patrik@ptrk.io>
Signed-off-by: Patrik Cyvoct <patrik@ptrk.io>
Signed-off-by: Patrik Cyvoct <patrik@ptrk.io>
Signed-off-by: Patrik Cyvoct <patrik@ptrk.io>
@Sh4d1 Sh4d1 force-pushed the grpc_upstream_stats branch from 6dcb4e8 to f7c833d Compare April 16, 2020 06:25
@Sh4d1
Copy link
Contributor Author

Sh4d1 commented Apr 16, 2020

All good for me I think

@ggreenway
Copy link
Member

@Sh4d1 Do not force-push to PR branches please. It makes reviewing changes much more difficult.

@ggreenway
Copy link
Member

/retest

@repokitteh-read-only
Copy link

🐴 hold your horses - no failures detected, yet.

🐱

Caused by: a #10748 (comment) was created by @ggreenway.

see: more, trace.

@ggreenway
Copy link
Member

/azp retest

@azure-pipelines
Copy link

Command 'retest' is not supported by Azure Pipelines.

Supported commands
  • help:
    • Get descriptions, examples and documentation about supported commands
    • Example: help "command_name"
  • list:
    • List all pipelines for this repository using a comment.
    • Example: "list"
  • run:
    • Run all pipelines or specific pipelines for this repository using a comment. Use this command by itself to trigger all related pipelines, or specify specific pipelines to run.
    • Example: "run" or "run pipeline_name, pipeline_name, pipeline_name"
  • where:
    • Report back the Azure DevOps orgs that are related to this repository and org
    • Example: "where"

See additional documentation.

@Sh4d1
Copy link
Contributor Author

Sh4d1 commented Apr 16, 2020

@ggreenway it was only a rebase 😄

@ggreenway
Copy link
Member

/azp run envoy-presubmit

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@ggreenway
Copy link
Member

@Sh4d1 Don't rebase. Please merge instead. We squash the commits when the PR is merged so the extra history doesn't hurt anything. But when people force-push, there's not a way to automatically see that it is only a rebase. As described in https://github.com/envoyproxy/envoy/blob/master/CONTRIBUTING.md:

Once you submit a PR, please do not rebase it. It's much easier to review if subsequent commits are new commits and/or merges. We squash rebase the final merged commit so the number of commits you have in the PR don't matter.

@ggreenway
Copy link
Member

/azp run envoy-presubmit (macOS)

@azure-pipelines
Copy link

No pipelines are associated with this pull request.

@Sh4d1
Copy link
Contributor Author

Sh4d1 commented Apr 16, 2020

@ggreenway okay! Sorry I missed that part, my bad 🙄

@ggreenway
Copy link
Member

@envoyproxy/api-shepherds PTAL

Copy link
Member

@htuch htuch left a comment

Choose a reason for hiding this comment

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

/lgtm api

@ggreenway ggreenway merged commit 4a70533 into envoyproxy:master Apr 17, 2020
Comment on lines +232 to +240
if (config_->enable_upstream_stats_ &&
decoder_callbacks_->streamInfo().lastUpstreamTxByteSent().has_value() &&
decoder_callbacks_->streamInfo().lastUpstreamRxByteReceived().has_value()) {
std::chrono::milliseconds chrono_duration =
std::chrono::duration_cast<std::chrono::milliseconds>(
decoder_callbacks_->streamInfo().lastUpstreamRxByteReceived().value() -
decoder_callbacks_->streamInfo().lastUpstreamTxByteSent().value());
config_->context_.chargeUpstreamStat(*cluster_, request_names_, chrono_duration);
}
Copy link
Member

Choose a reason for hiding this comment

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

@ggreenway @Sh4d1 post review drive by: this would not include "trailers only" responses (headers only responses with an error). I think this is probably not what we want and we should include error responses also? Can we fix/clarify this in a follow up? Thank you.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@mattklein123 good catch! I think adding the same logic in encodeHeaders if end_stream is true should be enough right? I'll send the fix tomorrow I think 😄

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Or move the whole logic there 🤔

penguingao pushed a commit to penguingao/envoy that referenced this pull request Apr 22, 2020
* stats: add upstream_rq_time by grpc methods

Signed-off-by: Patrik Cyvoct <patrik@ptrk.io>
Signed-off-by: pengg <pengg@google.com>
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.

Improve gRPC statistics with useful data for autoscaling (active-requests, request-time...)

5 participants