Skip to content

Commit 3339ccb

Browse files
authored
Add USDT tracepoints for connection fd (#12436)
* Origin connection pool * Session attachment * Readiness polling
1 parent f2d43db commit 3339ccb

3 files changed

Lines changed: 10 additions & 1 deletion

File tree

src/iocore/net/ReadWriteEventIO.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424

2525
#include "iocore/net/ReadWriteEventIO.h"
2626
#include "iocore/net/NetHandler.h"
27-
27+
#include "ts/ats_probe.h"
2828
namespace
2929
{
3030
DbgCtl dbg_ctl_iocore_net_main{"iocore_net_main"};
@@ -52,6 +52,7 @@ ReadWriteEventIO::process_event(int flags)
5252
{
5353
// Remove triggered NetEvent from cop_list because it won't be timeout before
5454
// next InactivityCop runs.
55+
ATS_PROBE2(eventio_rw_process_event, _ne->get_fd(), flags);
5556
if (_nh->cop_list.in(_ne)) {
5657
_nh->cop_list.remove(_ne);
5758
}

src/proxy/http/HttpSM.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -392,6 +392,7 @@ HttpSM::attach_client_session(ProxyTransaction *txn)
392392
if (!netvc) {
393393
return;
394394
}
395+
ATS_PROBE2(http_attach_client_session, sm_id, netvc->get_socket());
395396
_ua.set_txn(txn, milestones);
396397

397398
// Collect log & stats information. We've already verified that the netvc is !nullptr above,
@@ -6629,6 +6630,7 @@ HttpSM::attach_server_session()
66296630
// Propagate the per client IP debugging
66306631
if (_ua.get_txn()) {
66316632
server_txn->get_netvc()->control_flags.set_flags(get_cont_flags().get_flags());
6633+
ATS_PROBE2(http_attach_server_session, this->sm_id, server_txn->get_netvc()->get_socket());
66326634
} else { // If there is no _ua.get_txn() no sense in continuing to attach the server session
66336635
return;
66346636
}

src/proxy/http/HttpSessionManager.cc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
#include "proxy/http/HttpSM.h"
3737
#include "proxy/http/HttpDebugNames.h"
3838
#include "iocore/net/TLSSNISupport.h"
39+
#include "ts/ats_probe.h"
3940
#include <iterator>
4041

4142
namespace
@@ -500,11 +501,13 @@ HttpSessionManager::_acquire_session(sockaddr const *ip, CryptoHash const &hostn
500501
if (to_return) {
501502
if (sm->create_server_txn(to_return)) {
502503
Dbg(dbg_ctl_http_ss, "[%" PRId64 "] [acquire session] return session from shared pool", to_return->connection_id());
504+
ATS_PROBE2(http_ss_acquire_session, to_return->connection_id(), to_return->get_netvc()->get_socket());
503505
to_return->state = PoolableSession::PooledState::SSN_IN_USE;
504506
retval = HSMresult_t::DONE;
505507
} else {
506508
Dbg(dbg_ctl_http_ss, "[%" PRId64 "] [acquire session] failed to get transaction on session from shared pool",
507509
to_return->connection_id());
510+
ATS_PROBE2(http_ss_acquire_session_failed, to_return->connection_id(), to_return->get_netvc()->get_socket());
508511
// Don't close the H2 origin. Otherwise you get use-after free with the activity timeout cop
509512
if (!to_return->is_multiplexing()) {
510513
to_return->do_io_close();
@@ -534,13 +537,16 @@ HttpSessionManager::release_session(PoolableSession *to_release)
534537

535538
if (locked) {
536539
pool->releaseSession(to_release);
540+
ATS_PROBE2(http_ss_release_session_global, to_release->connection_id(), to_release->get_netvc()->get_socket());
537541
} else if (this->get_pool_type() == TS_SERVER_SESSION_SHARING_POOL_HYBRID) {
538542
// Try again with the thread pool
539543
to_release->sharing_pool = TS_SERVER_SESSION_SHARING_POOL_THREAD;
544+
ATS_PROBE2(http_ss_release_session_thread, to_release->connection_id(), to_release->get_netvc()->get_socket());
540545
return release_session(to_release);
541546
} else {
542547
Dbg(dbg_ctl_http_ss, "[%" PRId64 "] [release session] could not release session due to lock contention",
543548
to_release->connection_id());
549+
ATS_PROBE2(http_ss_release_lock_contended, to_release->connection_id(), to_release->get_netvc()->get_socket());
544550
released_p = false;
545551
}
546552
}

0 commit comments

Comments
 (0)