Skip to content

quic: add QUIC connection close stats to upstream connections#17222

Merged
jmarantz merged 19 commits intoenvoyproxy:mainfrom
RenjieTang:upstream-stat
Jul 22, 2021
Merged

quic: add QUIC connection close stats to upstream connections#17222
jmarantz merged 19 commits intoenvoyproxy:mainfrom
RenjieTang:upstream-stat

Conversation

@RenjieTang
Copy link
Copy Markdown
Contributor

@RenjieTang RenjieTang commented Jul 2, 2021

Commit Message: Allow upstream quic connections to charge connection close stats.
Additional Description: For upstream connections, QuicStatNames reference is now passed down as Server->ClusterManager->ConnPool->EnvoyQuicConnection.
Risk Level: Low
Testing: unit tests
Docs Changes: docs/root/configuration/upstream/cluster_manager/cluster_stats.rst

Signed-off-by: Renjie Tang <renjietang@google.com>
Signed-off-by: Renjie Tang <renjietang@google.com>
Signed-off-by: Renjie Tang <renjietang@google.com>
Signed-off-by: Renjie Tang <renjietang@google.com>
Signed-off-by: Renjie Tang <renjietang@google.com>
Signed-off-by: Renjie Tang <renjietang@google.com>
Signed-off-by: Renjie Tang <renjietang@google.com>
@RenjieTang RenjieTang marked this pull request as ready for review July 12, 2021 20:03
@RenjieTang
Copy link
Copy Markdown
Contributor Author

/assign @jmarantz

return std::make_unique<Http3ConnPoolImpl>(
host, priority, dispatcher, options, transport_socket_options, random_generator, state,
[](HttpConnPoolImplBase* pool) -> ::Envoy::ConnectionPool::ActiveClientPtr {
[&](HttpConnPoolImplBase* pool) -> ::Envoy::ConnectionPool::ActiveClientPtr {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think for non-test uses I'd avoid capturing [&] -- can you capture just what's needed?

std::shared_ptr<Upstream::MockClusterInfo> cluster_{new NiceMock<Upstream::MockClusterInfo>()};
NiceMock<Random::MockRandomGenerator> random_;
AlternateProtocolsCacheSharedPtr alternate_protocols_;
Stats::IsolatedStoreImpl scope_;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think typically in tests if we are instantiating a store we'd call the member variable stats_ or store_ or stats_store_.

Here & below.

absl::Notification server_gone_;
Stats::SymbolTableImpl symbol_table_;
std::unique_ptr<Stats::AllocatorImpl> stats_allocator_;
Quic::QuicStatNames* quic_stat_names_;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

use OptRef<Quic:QuicStatNames> rather than a pointer here. It's more idiomatic for Envoy style, and also avoids having an uninitialized value there potentially.

return sendRequestAndWaitForResponse(*dispatcher, method, url, body, host, content_type, client);
#else
ASSERT(false, "running a QUIC integration test without compiling QUIC");
(void)quic_stat_names;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

use UNREFERENCED_PARAMETER(quic_stat_names) in ./source/common/common/macros.h

Filesystem::fileSystemForTest(), random_generator);
Event::DispatcherPtr dispatcher(api.allocateDispatcher("test_thread"));
TestConnectionCallbacks connection_callbacks(*dispatcher);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

given the existing usage model and implementation of this, where mock_stats_store is instantiated a few lines up, I think it would be more consistent for you to instantiate a new Quic::QuicStatNames here, using mock_stats_store.symbolTable().

That will avoid the new args to makeSingleRequest, and remove a large number of other changes in this PR I think.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

That's an great advice!
done.

@jmarantz
Copy link
Copy Markdown
Contributor

/wait

Signed-off-by: Renjie Tang <renjietang@google.com>
Signed-off-by: Renjie Tang <renjietang@google.com>
Signed-off-by: Renjie Tang <renjietang@google.com>
Copy link
Copy Markdown
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.

this basically looks great, with a couple of small nits and a suggestion.

#include "source/common/common/dump_state_utils.h"
#include "source/common/common/utility.h"
#include "source/common/http/codec_client.h"
#include "source/common/quic/quic_stat_names.h"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

revert?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

it shouldn't be necessary to include quic_stat_names.h here in the header; you should include it from the cc

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

done including it in the cc file

Signed-off-by: Renjie Tang <renjietang@google.com>
jmarantz
jmarantz previously approved these changes Jul 14, 2021
Copy link
Copy Markdown
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.

OK -- I was worried that the lack of a Quic::Context might be a barrier to easily finishing off that PR, and also favor the parallel with the Http::Context and Grpc::Context.

But I don't feel that strongly about it, and you can always add it later (albeit with another large PR).

/assign-from @envoyproxy/senior-maintainers

@repokitteh-read-only
Copy link
Copy Markdown

@envoyproxy/senior-maintainers assignee is @alyssawilk

🐱

Caused by: a #17222 (review) was submitted by @jmarantz.

see: more, trace.

@alyssawilk
Copy link
Copy Markdown
Contributor

want to check out CI and I can take a look once that's sorted?
/wait

Signed-off-by: Renjie Tang <renjietang@google.com>
Copy link
Copy Markdown
Contributor

@alyssawilk alyssawilk left a comment

Choose a reason for hiding this comment

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

Nice, thanks for following up on this!


EXPECT_EQ(
1U, TestUtility::findCounter(
store_, "http3.upstream.rx.quic_connection_close_error_code_QUIC_INVALID_FRAME_DATA")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

do we have docs for this?
I'm not entirely sure where we'd put them. Currently the upstream stats I'm familiar with are rooted in the cluster so docced in cluster_stats.rst
That said these are only updated when traffic is sent to a cluster, so maybe put them there but make it clear they're not rooted in the cluster and are in fact global? Unless @mattklein123 or @phlax have better suggestions

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yeah I think that might be the best place to put this doc. done.

Signed-off-by: Renjie Tang <renjietang@google.com>
alyssawilk
alyssawilk previously approved these changes Jul 19, 2021
Copy link
Copy Markdown
Contributor

@alyssawilk alyssawilk left a comment

Choose a reason for hiding this comment

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

LGTM, though it looks like one comment of @jmarantz may not be addressed - I'll let him check and merge.
/retest for the windows flake

@repokitteh-read-only
Copy link
Copy Markdown

Retrying Azure Pipelines:
Retried failed jobs in: envoy-presubmit

🐱

Caused by: a #17222 (review) was submitted by @alyssawilk.

see: more, trace.

@jmarantz
Copy link
Copy Markdown
Contributor

/wait

Signed-off-by: Renjie Tang <renjietang@google.com>
jmarantz
jmarantz previously approved these changes Jul 19, 2021
@alyssawilk
Copy link
Copy Markdown
Contributor

unfortunately needs a main merge before we can land this

Signed-off-by: Renjie Tang <renjietang@google.com>
@alyssawilk
Copy link
Copy Markdown
Contributor

Hey Renjie, is the windows release failure that uint64 optional issue you mentioned? Looks like it might need one more pass?

@RenjieTang
Copy link
Copy Markdown
Contributor Author

Hey Renjie, is the windows release failure that uint64 optional issue you mentioned? Looks like it might need one more pass?

Yes it's still the optional<uint64_t> issue. I've filed #17409

Signed-off-by: Renjie Tang <renjietang@google.com>
@RenjieTang
Copy link
Copy Markdown
Contributor Author

/retest

@repokitteh-read-only
Copy link
Copy Markdown

Retrying Azure Pipelines:
Retried failed jobs in: envoy-presubmit

🐱

Caused by: a #17222 (comment) was created by @RenjieTang.

see: more, trace.

Signed-off-by: Renjie Tang <renjietang@google.com>
Signed-off-by: Renjie Tang <renjietang@google.com>
@jmarantz jmarantz merged commit 2b716d1 into envoyproxy:main Jul 22, 2021
dubious90 pushed a commit to envoyproxy/nighthawk that referenced this pull request Jul 27, 2021
1. Update ENVOY_COMMIT to the latest Envoy's commit
2. Update ENVOY_SHA in bazel/repositories.bzl
3. Pass an extra QuicStatNames argument when creating the cluster_manager_factory_ in process_impl.cc. This is to accommodate the recent change in the constructor of Envoy::Upstream::ProdClusterManagerFactory in envoyproxy/envoy#17222.

Signed-off-by: Jason Ye jiajunye@google.com
leyao-daily pushed a commit to leyao-daily/envoy that referenced this pull request Sep 30, 2021
…roxy#17222)

* add QUIC stats to upstream connections

Signed-off-by: Renjie Tang <renjietang@google.com>

* format

Signed-off-by: Renjie Tang <renjietang@google.com>

* minor ci fixes

Signed-off-by: Renjie Tang <renjietang@google.com>

* format

Signed-off-by: Renjie Tang <renjietang@google.com>

* fix compiler error

Signed-off-by: Renjie Tang <renjietang@google.com>

* address comments.

Signed-off-by: Renjie Tang <renjietang@google.com>

* clean up unused variables.

Signed-off-by: Renjie Tang <renjietang@google.com>

* remove unused includes.

Signed-off-by: Renjie Tang <renjietang@google.com>

* fix ci compile time option

Signed-off-by: Renjie Tang <renjietang@google.com>

* fix an unrelated Windows ci failure.

Signed-off-by: Renjie Tang <renjietang@google.com>

* add docs and fix a compile option issue.

Signed-off-by: Renjie Tang <renjietang@google.com>

* fix include

Signed-off-by: Renjie Tang <renjietang@google.com>

* fix windows CI failure in config_impl_test

Signed-off-by: Renjie Tang <renjietang@google.com>

* fix unsuccessful merge to upstream.

Signed-off-by: Renjie Tang <renjietang@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.

3 participants