Skip to content

Commit fb743d9

Browse files
authored
Add stirling cli flag to opt into disabling Go TLS tracing (#1534)
1 parent c0ff63a commit fb743d9

File tree

3 files changed

+20
-5
lines changed

3 files changed

+20
-5
lines changed

src/stirling/source_connectors/socket_tracer/socket_trace_connector.cc

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,11 @@ DEFINE_int32(stirling_enable_mux_tracing, px::stirling::TraceMode::OnForNewerKer
101101
DEFINE_int32(stirling_enable_amqp_tracing, px::stirling::TraceMode::On,
102102
"If true, stirling will trace and process AMQP messages.");
103103

104+
DEFINE_bool(stirling_disable_golang_tls_tracing,
105+
gflags::BoolFromEnv("PX_STIRLING_DISABLE_GOLANG_TLS_TRACING", false),
106+
"If true, stirling will not trace TLS traffic for Go applications. This implies "
107+
"stirling_enable_http2_tracing=false.");
108+
104109
DEFINE_bool(stirling_disable_self_tracing, true,
105110
"If true, stirling will not trace and process syscalls made by itself.");
106111

@@ -484,7 +489,8 @@ Status SocketTraceConnector::InitImpl() {
484489
conn_info_map_mgr_ = std::make_shared<ConnInfoMapManager>(this);
485490
ConnTracker::SetConnInfoMapManager(conn_info_map_mgr_);
486491

487-
uprobe_mgr_.Init(protocol_transfer_specs_[kProtocolHTTP2].enabled,
492+
uprobe_mgr_.Init(FLAGS_stirling_disable_golang_tls_tracing,
493+
protocol_transfer_specs_[kProtocolHTTP2].enabled,
488494
FLAGS_stirling_disable_self_tracing);
489495

490496
openssl_trace_state_ =

src/stirling/source_connectors/socket_tracer/uprobe_manager.cc

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,9 @@ UProbeManager::UProbeManager(bpf_tools::BCCWrapper* bcc) : bcc_(bcc) {
6666
proc_parser_ = std::make_unique<system::ProcParser>();
6767
}
6868

69-
void UProbeManager::Init(bool enable_http2_tracing, bool disable_self_probing) {
69+
void UProbeManager::Init(bool disable_go_tls_tracing, bool enable_http2_tracing,
70+
bool disable_self_probing) {
71+
cfg_disable_go_tls_tracing_ = disable_go_tls_tracing;
7072
cfg_enable_http2_tracing_ = enable_http2_tracing;
7173
cfg_disable_self_probing_ = disable_self_probing;
7274

@@ -834,7 +836,7 @@ int UProbeManager::DeployGoUProbes(const absl::flat_hash_set<md::UPID>& pids) {
834836
}
835837

836838
// GoTLS Probes.
837-
{
839+
if (!cfg_disable_go_tls_tracing_) {
838840
StatusOr<int> attach_status =
839841
AttachGoTLSUProbes(binary, elf_reader.get(), dwarf_reader.get(), pid_vec);
840842
if (!attach_status.ok()) {
@@ -848,7 +850,7 @@ int UProbeManager::DeployGoUProbes(const absl::flat_hash_set<md::UPID>& pids) {
848850
}
849851

850852
// Go HTTP2 Probes.
851-
if (cfg_enable_http2_tracing_) {
853+
if (!cfg_disable_go_tls_tracing_ && cfg_enable_http2_tracing_) {
852854
StatusOr<int> attach_status =
853855
AttachGoHTTP2UProbes(binary, elf_reader.get(), dwarf_reader.get(), pid_vec);
854856
if (!attach_status.ok()) {

src/stirling/source_connectors/socket_tracer/uprobe_manager.h

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,10 +115,13 @@ class UProbeManager {
115115

116116
/**
117117
* Mandatory initialization step before RunDeployUprobesThread can be called.
118+
* @param disable_go_tls_tracing Whether to disable Go TLS tracing. Implies enable_http2_tracing
119+
* is false.
118120
* @param enable_http2_tracing Whether to enable HTTP2 tracing.
119121
* @param disable_self_tracing Whether to enable uprobe deployment on Stirling itself.
120122
*/
121-
void Init(bool enable_http2_tracing, bool disable_self_tracing = true);
123+
void Init(bool disable_go_tls_tracing, bool enable_http2_tracing,
124+
bool disable_self_tracing = true);
122125

123126
/**
124127
* Notify uprobe manager of an mmap event. An mmap may be indicative of a dlopen,
@@ -618,6 +621,10 @@ class UProbeManager {
618621
// Whether to try to uprobe ourself (e.g. for OpenSSL). Typically, we don't want to do that.
619622
bool cfg_disable_self_probing_;
620623

624+
// Whether we want to enable Go TLS tracing. When true, it implies cfg_enable_http2_tracing_ is
625+
// false.
626+
bool cfg_disable_go_tls_tracing_;
627+
621628
// Whether we want to enable HTTP2 tracing. When false, we don't deploy HTTP2 uprobes.
622629
bool cfg_enable_http2_tracing_;
623630

0 commit comments

Comments
 (0)