Skip to content

Commit

Permalink
Fix debug info attribute (#3258)
Browse files Browse the repository at this point in the history
* Fix debug info attribute

This is something that would be nice to test, but I guess we don't want
to get into circular dependecies with alloy 😢

* Provide structured debug info
  • Loading branch information
simonswine authored Apr 26, 2024
1 parent 960fc32 commit 8575ca6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
9 changes: 5 additions & 4 deletions ebpf/sd/target.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ type containerID string
type TargetFinder interface {
FindTarget(pid uint32) *Target
RemoveDeadPID(pid uint32)
DebugInfo() []string
DebugInfo() []map[string]string
Update(args TargetsOptions)
}
type TargetsOptions struct {
Expand Down Expand Up @@ -252,14 +252,15 @@ func (tf *targetFinder) resizeContainerIDCache(size int) {
tf.containerIDCache.Resize(size)
}

func (tf *targetFinder) DebugInfo() []string {
func (tf *targetFinder) DebugInfo() []map[string]string {
tf.sync.Lock()
defer tf.sync.Unlock()

debugTargets := make([]string, 0, len(tf.cid2target))
debugTargets := make([]map[string]string, 0, len(tf.cid2target))
for _, target := range tf.cid2target {

_, ls := target.Labels()
debugTargets = append(debugTargets, ls.String())
debugTargets = append(debugTargets, ls.Map())
}
return debugTargets
}
Expand Down
2 changes: 1 addition & 1 deletion ebpf/session.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ type Session interface {
type SessionDebugInfo struct {
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"`
Arch string `alloy:"arch,attr" river:"arch,attr"`
Kernel string `alloy:"kernel,attr" river:"kernel,attr"`
}

Expand Down

0 comments on commit 8575ca6

Please sign in to comment.