Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,8 @@ HTTP/3 protocol stats are global with the following statistics:
:header: Name, Type, Description
:widths: 1, 1, 2

<tx/rx>.quic_connection_close_error_code_<error_code>, Counter, A collection of counters that are lazily initialized to record each QUIC connection close's error code.
upstream.<tx/rx>.quic_connection_close_error_code_<error_code>, Counter, A collection of counters that are lazily initialized to record each QUIC connection close's error code.
upstream.<tx/rx>.quic_reset_stream_error_code_<error_code>, Counter, A collection of counters that are lazily initialized to record each QUIC stream reset error code.


Health check statistics
Expand Down
14 changes: 14 additions & 0 deletions source/common/quic/envoy_quic_client_session.cc
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,20 @@ void EnvoyQuicClientSession::OnHttp3GoAway(uint64_t stream_id) {
}
}

void EnvoyQuicClientSession::MaybeSendRstStreamFrame(quic::QuicStreamId id,
quic::QuicRstStreamErrorCode error,
quic::QuicStreamOffset bytes_written) {
QuicSpdyClientSession::MaybeSendRstStreamFrame(id, error, bytes_written);
quic_stat_names_.chargeQuicResetStreamErrorStats(scope_, error, /*from_self*/ true,
/*is_upstream*/ true);
}

void EnvoyQuicClientSession::OnRstStream(const quic::QuicRstStreamFrame& frame) {
QuicSpdyClientSession::OnRstStream(frame);
quic_stat_names_.chargeQuicResetStreamErrorStats(scope_, frame.error_code,
/*from_self*/ false, /*is_upstream*/ true);
}

void EnvoyQuicClientSession::SetDefaultEncryptionLevel(quic::EncryptionLevel level) {
quic::QuicSpdyClientSession::SetDefaultEncryptionLevel(level);
if (level == quic::ENCRYPTION_FORWARD_SECURE) {
Expand Down
3 changes: 3 additions & 0 deletions source/common/quic/envoy_quic_client_session.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@ class EnvoyQuicClientSession : public QuicFilterManagerConnectionImpl,
quic::QuicStreamId id, spdy::SpdyHeaderBlock headers, bool fin,
const spdy::SpdyStreamPrecedence& precedence,
quic::QuicReferenceCountedPointer<quic::QuicAckListenerInterface> ack_listener) override;
void MaybeSendRstStreamFrame(quic::QuicStreamId id, quic::QuicRstStreamErrorCode error,
quic::QuicStreamOffset bytes_written) override;
void OnRstStream(const quic::QuicRstStreamFrame& frame) override;
// quic::QuicSpdyClientSessionBase
void SetDefaultEncryptionLevel(quic::EncryptionLevel level) override;

Expand Down
27 changes: 26 additions & 1 deletion test/common/quic/envoy_quic_client_session_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,29 @@ TEST_P(EnvoyQuicClientSessionTest, OnResetFrame) {
quic::QuicRstStreamFrame rst1(/*control_frame_id=*/1u, stream_id,
quic::QUIC_ERROR_PROCESSING_STREAM, /*bytes_written=*/0u);
EXPECT_CALL(stream_callbacks, onResetStream(Http::StreamResetReason::RemoteReset, _));
stream.OnStreamReset(rst1);
envoy_quic_session_.OnRstStream(rst1);

EXPECT_EQ(
1U, TestUtility::findCounter(
store_, "http3.upstream.rx.quic_reset_stream_error_code_QUIC_ERROR_PROCESSING_STREAM")
->value());
}

TEST_P(EnvoyQuicClientSessionTest, SendResetFrame) {
Http::MockResponseDecoder response_decoder;
Http::MockStreamCallbacks stream_callbacks;
EnvoyQuicClientStream& stream = sendGetRequest(response_decoder, stream_callbacks);

// G-QUIC or IETF bi-directional stream.
quic::QuicStreamId stream_id = stream.id();
EXPECT_CALL(stream_callbacks, onResetStream(Http::StreamResetReason::LocalReset, _));
EXPECT_CALL(*quic_connection_, SendControlFrame(_));
envoy_quic_session_.ResetStream(stream_id, quic::QUIC_ERROR_PROCESSING_STREAM);

EXPECT_EQ(
1U, TestUtility::findCounter(
store_, "http3.upstream.tx.quic_reset_stream_error_code_QUIC_ERROR_PROCESSING_STREAM")
->value());
}

TEST_P(EnvoyQuicClientSessionTest, OnGoAwayFrame) {
Expand Down Expand Up @@ -277,6 +299,9 @@ TEST_P(EnvoyQuicClientSessionTest, ConnectionCloseWithActiveStream) {
envoy_quic_session_.close(Network::ConnectionCloseType::NoFlush);
EXPECT_EQ(Network::Connection::State::Closed, envoy_quic_session_.state());
EXPECT_TRUE(stream.write_side_closed() && stream.reading_stopped());
EXPECT_EQ(1U, TestUtility::findCounter(
store_, "http3.upstream.tx.quic_connection_close_error_code_QUIC_NO_ERROR")
->value());
}

class EnvoyQuicClientSessionAllQuicVersionTest
Expand Down