Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure the ebpf debug info supports both river and alloy #3253

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions ebpf/session.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,10 @@ type Session interface {
}

type SessionDebugInfo struct {
ElfCache symtab.ElfCacheDebugInfo `river:"elf_cache,attr,optional"`
PidCache symtab.GCacheDebugInfo[symtab.ProcTableDebugInfo] `river:"pid_cache,attr,optional"`
Arch string `river:"arch,attr"`
Kernel string `river:"kernel,attr"`
ElfCache symtab.ElfCacheDebugInfo `alloy:"elf_cache,attr,optional" river:"elf_cache,attr,optional"`
PidCache symtab.GCacheDebugInfo[symtab.ProcTableDebugInfo] `alloy:"pid_cache,attr,optional" river:"pid_cache,attr,optional"`
Arch string `alloy:"arch,atttr" river:"arch,attr"`
Kernel string `alloy:"kernel,attr" river:"kernel,attr"`
}

type pids struct {
Expand Down
4 changes: 2 additions & 2 deletions ebpf/symtab/elf.go
Original file line number Diff line number Diff line change
Expand Up @@ -317,8 +317,8 @@ func cString(bs []byte) string {
}

type ElfDebugInfo struct {
SymbolsCount int `river:"symbols_count,attr,optional"`
File string `river:"file,attr,optional"`
SymbolsCount int `alloy:"symbols_count,attr,optional" river:"symbols_count,attr,optional"`
File string `alloy:"file,attr,optional" river:"file,attr,optional"`
}

func (et *ElfTable) DebugInfo() elf2.SymTabDebugInfo {
Expand Down
8 changes: 4 additions & 4 deletions ebpf/symtab/elf/symbol_table.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,8 @@ func (st *SymbolTable) symbolName(idx int) (string, error) {
}

type SymTabDebugInfo struct {
Name string `river:"name,attr,optional"`
Size int `river:"symbol_count,attr,optional"`
File string `river:"file,attr,optional"`
LastUsedRound int `river:"last_used_round,attr,optional"`
Name string `alloy:"name,attr,optional" river:"name,attr,optional"`
Size int `alloy:"symbol_count,attr,optional" river:"symbol_count,attr,optional"`
File string `alloy:"file,attr,optional" river:"file,attr,optional"`
LastUsedRound int `alloy:"last_used_round,attr,optional" river:"last_used_round,attr,optional"`
}
4 changes: 2 additions & 2 deletions ebpf/symtab/elf_cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ func (e *ElfCache) Cleanup() {
}

type ElfCacheDebugInfo struct {
BuildIDCache GCacheDebugInfo[elf.SymTabDebugInfo] `river:"build_id_cache,attr,optional"`
SameFileCache GCacheDebugInfo[elf.SymTabDebugInfo] `river:"same_file_cache,attr,optional"`
BuildIDCache GCacheDebugInfo[elf.SymTabDebugInfo] `alloy:"build_id_cache,attr,optional" river:"build_id_cache,attr,optional"`
SameFileCache GCacheDebugInfo[elf.SymTabDebugInfo] `alloy:"same_file_cache,attr,optional" river:"same_file_cache,attr,optional"`
}

func (e *ElfCache) DebugInfo() ElfCacheDebugInfo {
Expand Down
10 changes: 5 additions & 5 deletions ebpf/symtab/gcache.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,11 +151,11 @@ func (g *GCache[K, V]) Remove(k K) {
}

type GCacheDebugInfo[T any] struct {
LRUSize int `river:"lru_size,attr,optional"`
RoundSize int `river:"round_size,attr,optional"`
CurrentRound int `river:"current_round,attr,optional"`
LRUDump []T `river:"lru_dump,block,optional"`
RoundDump []T `river:"round_dump,block,optional"`
LRUSize int `alloy:"lru_size,attr,optional" river:"lru_size,attr,optional"`
RoundSize int `alloy:"round_size,attr,optional" river:"round_size,attr,optional"`
CurrentRound int `alloy:"current_round,attr,optional" river:"current_round,attr,optional"`
LRUDump []T `alloy:"lru_dump,block,optional" river:"lru_dump,block,optional"`
RoundDump []T `alloy:"round_dump,block,optional" river:"round_dump,block,optional"`
}

func DebugInfo[K comparable, V Resource, D any](g *GCache[K, V], ff func(K, V, int) D) GCacheDebugInfo[D] {
Expand Down
8 changes: 4 additions & 4 deletions ebpf/symtab/proc.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ type ProcTable struct {
}

type ProcTableDebugInfo struct {
ElfTables map[string]elf.SymTabDebugInfo `river:"elfs,block,optional"`
Size int `river:"size,attr,optional"`
Pid int `river:"pid,attr,optional"`
LastUsedRound int `river:"last_used_round,attr,optional"`
ElfTables map[string]elf.SymTabDebugInfo `alloy:"elfs,block,optional" river:"elfs,block,optional"`
Size int `alloy:"size,attr,optional" river:"size,attr,optional"`
Pid int `alloy:"pid,attr,optional" river:"pid,attr,optional"`
LastUsedRound int `alloy:"last_used_round,attr,optional" river:"last_used_round,attr,optional"`
}

func (p *ProcTable) DebugInfo() ProcTableDebugInfo {
Expand Down
Loading