Skip to content

Commit

Permalink
feat: agent - Add a configuration option to enable go/tls trace
Browse files Browse the repository at this point in the history
  • Loading branch information
yinjiping authored and rvql committed Sep 30, 2024
1 parent 7b5f490 commit 7585e5a
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 9 deletions.
8 changes: 6 additions & 2 deletions agent/src/config/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2356,13 +2356,13 @@ impl From<&RuntimeConfig> for UserConfig {
socket: EbpfSocket {
uprobe: EbpfSocketUprobe {
golang: EbpfSocketUprobeGolang {
enabled: rc.yaml_config.ebpf.uprobe_proc_regexp.golang.is_empty(),
enabled: rc.yaml_config.ebpf.uprobe_golang_trace_enabled,
tracing_timeout: Duration::from_secs(
rc.yaml_config.ebpf.go_tracing_timeout as u64,
),
},
tls: EbpfSocketUprobeTls {
enabled: rc.yaml_config.ebpf.uprobe_proc_regexp.openssl.is_empty(),
enabled: rc.yaml_config.ebpf.uprobe_openssl_trace_enabled,
},
},
kprobe: EbpfSocketKprobe {
Expand Down Expand Up @@ -3189,6 +3189,8 @@ pub struct EbpfYamlConfig {
pub syscall_segmentation_reassembly: Vec<String>,
pub syscall_trace_id_disabled: bool,
pub map_prealloc_disabled: bool,
pub uprobe_golang_trace_enabled: bool,
pub uprobe_openssl_trace_enabled: bool,
}

impl Default for EbpfYamlConfig {
Expand Down Expand Up @@ -3223,6 +3225,8 @@ impl Default for EbpfYamlConfig {
syscall_out_of_order_cache_size: 16,
syscall_trace_id_disabled: false,
map_prealloc_disabled: false,
uprobe_golang_trace_enabled: false,
uprobe_openssl_trace_enabled: false,
}
}
}
Expand Down
2 changes: 2 additions & 0 deletions agent/src/ebpf_dispatcher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -635,6 +635,7 @@ impl EbpfCollector {
// ebpf core modules init
#[allow(unused_mut)]
let mut handle = ConfigHandle::default();
ebpf::set_uprobe_golang_enabled(config.ebpf.socket.uprobe.golang.enabled);
if config.ebpf.socket.uprobe.golang.enabled {
let uprobe_proc_regexp = config
.process_matcher
Expand Down Expand Up @@ -662,6 +663,7 @@ impl EbpfCollector {
info!("ebpf golang uprobe proc regexp is empty, skip set")
}

ebpf::set_uprobe_openssl_enabled(config.ebpf.socket.uprobe.tls.enabled);
if config.ebpf.socket.uprobe.tls.enabled {
let uprobe_proc_regexp = config
.process_matcher
Expand Down
10 changes: 5 additions & 5 deletions server/agent_config/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3321,7 +3321,7 @@ inputs:
**Schema**:
| Key | Value |
| ---- | ---------------------------- |
| Type | string |
| Type | bool |

**Description**:

Expand Down Expand Up @@ -3389,7 +3389,7 @@ inputs:
**Schema**:
| Key | Value |
| ---- | ---------------------------- |
| Type | string |
| Type | bool |

**Description**:

Expand Down Expand Up @@ -4215,7 +4215,7 @@ inputs:
| Key | Value |
| ---- | ---------------------------- |
| Type | int |
| Range | [100000, 2000000] |
| Range | [10000, 2000000] |

**Description**:

Expand Down Expand Up @@ -4246,7 +4246,7 @@ inputs:
| Key | Value |
| ---- | ---------------------------- |
| Type | int |
| Range | [100000, 2000000] |
| Range | [8000, 2000000] |

**Description**:

Expand Down Expand Up @@ -4276,7 +4276,7 @@ inputs:
| Key | Value |
| ---- | ---------------------------- |
| Type | int |
| Range | [100000, 2000000] |
| Range | [10000, 2000000] |

**Description**:

Expand Down
2 changes: 2 additions & 0 deletions server/agent_config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,8 @@ type EbpfConfig struct {
SyscallOutOfOrderCacheSize *int `yaml:"syscall-out-of-order-cache-size,omitempty"`
SyscallTraceIdDisabled *bool `yaml:"syscall-trace-id-disabled,omitempty"`
MapPreallocDisabled *bool `yaml:"map-prealloc-disabled,omitempty"`
UprobeGolangTraceEnabled *bool `yaml:"uprobe-golang-trace-enabled,omitempty"`
UprobeOpensslTraceEnabled *bool `yaml:"uprobe-openssl-trace-enabled,omitempty"`
}

type OsProcRegex struct {
Expand Down
4 changes: 2 additions & 2 deletions server/agent_config/template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2170,7 +2170,7 @@ inputs:
# name: Golang
# description:
golang:
# type: string
# type: bool
# name: Enabled
# unit:
# range: []
Expand Down Expand Up @@ -2208,7 +2208,7 @@ inputs:
# name: TLS
# description:
tls:
# type: string
# type: bool
# name: Enabled
# unit:
# range: []
Expand Down

0 comments on commit 7585e5a

Please sign in to comment.