Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

quic: add QUIC downstream connection close error stats. #16584

Merged
merged 18 commits into from
Jun 3, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions docs/root/configuration/http/http_conn_man/stats.rst
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ Per listener statistics

Per listener statistics are rooted at *listener.<address>*.

Http per listener statistics
HTTP per listener statistics
~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Additional HTTP statistics are of the form *http.<stat_prefix>.* with the
Expand All @@ -106,10 +106,10 @@ following statistics:
downstream_rq_4xx, Counter, Total 4xx responses
downstream_rq_5xx, Counter, Total 5xx responses

Http3 per listener statistics
HTTP/3 per listener statistics
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Http3 statistics with the form of *http3.downstream.<stat_prefix>.*:
HTTP/3 statistics with the form of *http3.downstream.<stat_prefix>.*:

.. csv-table::
:header: Name, Type, Description
Expand All @@ -125,7 +125,7 @@ Per codec statistics

Each codec has the option of adding per-codec statistics. http1, http2, and http3 all have codec stats.

Http1 codec statistics
HTTP/1 codec statistics
~~~~~~~~~~~~~~~~~~~~~~

On the downstream side all http1 statistics are rooted at *http1.*
Expand All @@ -141,7 +141,7 @@ On the upstream side all http1 statistics are rooted at *cluster.<name>.http1.*
response_flood, Counter, Total number of connections closed due to response flooding
requests_rejected_with_underscores_in_headers, Counter, Total numbers of rejected requests due to header names containing underscores. This action is configured by setting the :ref:`headers_with_underscores_action config setting <envoy_v3_api_field_config.core.v3.HttpProtocolOptions.headers_with_underscores_action>`.

Http2 codec statistics
HTTP/2 codec statistics
~~~~~~~~~~~~~~~~~~~~~~

On the downstream side all http2 statistics are rooted at *http2.*
Expand Down Expand Up @@ -177,7 +177,7 @@ On the upstream side all http2 statistics are rooted at *cluster.<name>.http2.*
`downstream_rq_active` gauge due to differences in stream accounting between the codec and the
HTTP connection manager.

Http3 codec statistics
HTTP/3 codec statistics
~~~~~~~~~~~~~~~~~~~~~~

On the downstream side all http3 statistics are rooted at *http3.*
Expand Down
7 changes: 5 additions & 2 deletions source/common/quic/quic_stat_names.cc
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,18 @@ void QuicStatNames::chargeQuicConnectionCloseStats(Stats::Scope& scope,
bool is_upstream) {
ASSERT(&symbol_table_ == &scope.symbolTable());

if (error_code >= quic::QUIC_LAST_ERROR) {
ENVOY_LOG(warn, fmt::format("Error code {} is out of range of QuicErrorCodes.", error_code));
Copy link
Member

Choose a reason for hiding this comment

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

Can you add a test case for this? Also, I think warning here can log spam. I would recommend making this debug level and potentially also adding a stat for unknown error code or something like that. Thank you.

/wait

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done.
I utilized quic::QUIC_LAST_ERROR_CODE as a stat for all out of range codes.

return;
}

const Stats::StatName connection_close = connectionCloseStatName(error_code);
incCounter(scope, {http3_prefix_, is_upstream ? upstream_ : downstream_,
source == quic::ConnectionCloseSource::FROM_SELF ? from_self_ : from_peer_,
connection_close});
}

Stats::StatName QuicStatNames::connectionCloseStatName(quic::QuicErrorCode error_code) {
ASSERT(error_code < quic::QUIC_LAST_ERROR);

return Stats::StatName(
connection_error_stat_names_.get(error_code, [this, error_code]() -> const uint8_t* {
return stat_name_pool_.addReturningStorage(
Expand Down