Skip to content

Commit

Permalink
Add a metric for unfinished QUIC handshake count
Browse files Browse the repository at this point in the history
Summary: Add visibility into the number of handshakes. We are already getting some partial visibility unintentionally through SLB_downstream_idle_conn.sum, but that metric includes actual idle connections and I need an explicit metric to set up rate limiting thresholds correctly.

Reviewed By: dddmello

Differential Revision: D50760028

fbshipit-source-id: 5c9063f80f7863b0b1a3e4d4c94c7b2207596c1f
  • Loading branch information
meleshuk authored and facebook-github-bot committed Nov 14, 2023
1 parent e5311c8 commit 99fe355
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions quic/server/QuicServerWorker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ bool isValidConnIdLength(const quic::ConnectionId& connId) {
namespace quic {

std::atomic_int globalUnfinishedHandshakes{0};
int QuicServerWorker::getUnfinishedHandshakeCount() {
return globalUnfinishedHandshakes.load(std::memory_order_relaxed);
}

QuicServerWorker::QuicServerWorker(
std::shared_ptr<QuicServerWorker::WorkerCallback> callback,
Expand Down
3 changes: 3 additions & 0 deletions quic/server/QuicServerWorker.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ class QuicServerWorker : public QuicAsyncUDPSocketWrapper::ReadCallback,
public folly::EventRecvmsgCallback,
public folly::EventRecvmsgMultishotCallback,
public QuicTimerCallback {
public:
static int getUnfinishedHandshakeCount();

private:
struct MsgHdr : public folly::EventRecvmsgCallback::MsgHdr {
static auto constexpr kBuffSize = 1024;
Expand Down

0 comments on commit 99fe355

Please sign in to comment.