mirror of
https://github.com/kubeshark/kubeshark.git
synced 2025-08-17 16:08:12 +00:00
Add MIZU_GLOBAL_GOLANG_PATH
environment variable
This commit is contained in:
parent
b6b269eb19
commit
4e8d760a12
@ -293,6 +293,15 @@ func startTlsTapper(extension *api.Extension, outputItems chan *api.OutputChanne
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// A quick way to instrument Go `crypto/tls` using executable path - used for debuging and troubleshooting
|
||||||
|
//
|
||||||
|
if os.Getenv("MIZU_GLOBAL_GOLANG_PATH") != "" {
|
||||||
|
if err := tls.GlobalGolangTapPath(os.Getenv("MIZU_GLOBAL_GOLANG_PATH")); err != nil {
|
||||||
|
tlstapper.LogError(err)
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
var emitter api.Emitter = &api.Emitting{
|
var emitter api.Emitter = &api.Emitting{
|
||||||
AppStats: &diagnose.AppStats,
|
AppStats: &diagnose.AppStats,
|
||||||
OutputChannel: outputItems,
|
OutputChannel: outputItems,
|
||||||
|
@ -86,6 +86,10 @@ func (t *TlsTapper) GlobalGolangTap(procfs string, pid string) error {
|
|||||||
return t.tapGolangPid(procfs, uint32(_pid), api.UNKNOWN_NAMESPACE)
|
return t.tapGolangPid(procfs, uint32(_pid), api.UNKNOWN_NAMESPACE)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (t *TlsTapper) GlobalGolangTapPath(exePath string) error {
|
||||||
|
return t.tapGolangPath(exePath)
|
||||||
|
}
|
||||||
|
|
||||||
func (t *TlsTapper) AddSsllibPid(procfs string, pid uint32, namespace string) error {
|
func (t *TlsTapper) AddSsllibPid(procfs string, pid uint32, namespace string) error {
|
||||||
sslLibrary, err := findSsllib(procfs, pid)
|
sslLibrary, err := findSsllib(procfs, pid)
|
||||||
|
|
||||||
@ -219,6 +223,18 @@ func (t *TlsTapper) tapGolangPid(procfs string, pid uint32, namespace string) er
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (t *TlsTapper) tapGolangPath(exePath string) error {
|
||||||
|
hooks := golangHooks{}
|
||||||
|
|
||||||
|
if err := hooks.installUprobes(&t.bpfObjects, exePath); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
t.golangHooksStructs = append(t.golangHooksStructs, hooks)
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
func LogError(err error) {
|
func LogError(err error) {
|
||||||
var e *errors.Error
|
var e *errors.Error
|
||||||
if errors.As(err, &e) {
|
if errors.As(err, &e) {
|
||||||
|
Loading…
Reference in New Issue
Block a user