Unable to instrument go binary file which doesn't contain ".gosymtab" section
gongzh opened this issue · comments
Expected Behavior
When a go binary file doesn't contain ".gosymtab" section, it should be able to instrument it.
Actual Behavior
Analyze process stops when it can't find ".gosymtab" section in target go binary file.
Steps to Reproduce the Problem
- ./launch goapp (launch binary copied from image keyval/launcher:v0.1)
- start instrumentation:
OTEL_SERVICE_NAME=goapp OTEL_TARGET_EXE=/goapp OTEL_EXPORTER_OTLP_ENDPOINT=localhost:4317 /kv-go-instrumentation
- kv-go-instrumentation logs error and exits, error message are as below:
{"level":"info","ts":1667322994.3850787,"caller":"cli/main.go:22","msg":"starting Go OpenTelemetry Agent ..."}
{"level":"info","ts":1667322994.385147,"caller":"opentelemetry/controller.go:92","msg":"Establishing connection to OpenTelemetry collector ..."}
{"level":"info","ts":1667322996.387433,"caller":"process/discover.go:42","msg":"found process","pid":19}
{"level":"info","ts":1667322996.3889744,"caller":"process/analyze.go:73","msg":"found addr of keyval map","addr":140331000791040}
{"level":"error","ts":1667322996.3974175,"caller":"cli/main.go:61","msg":"error while analyzing target process","error":".gosymtab section not found in target binary, make sure this is a Go application","stacktrace":"main.main\n\t/app/cli/main.go:61\nruntime.main\n\t/usr/local/go/src/runtime/proc.go:250"}
- operation-system/kernel version:
Output ofawk -F '=' '/PRETTY_NAME/ { print $2 }' /etc/os-release
:
Output ofuname -r
:"CentOS Linux 7 (Core)" 5.16.11-1.el7.elrepo.x86_64
The corresponding source code is from:
https://github.com/keyval-dev/opentelemetry-go-instrumentation/blob/master/pkg/process/analyze.go
line 117 to 120:
sec := elfF.Section(".gosymtab")
if sec == nil {
return nil, fmt.Errorf("%s section not found in target binary, make sure this is a Go application", ".gosymtab")
}