open-telemetry / opentelemetry-collector-contrib

Contrib repository for the OpenTelemetry Collector
https://opentelemetry.io
Apache License 2.0
3.1k stars 2.39k forks source link

Recombine: Multiline golang stack trace example #36275

Open Fresa opened 1 week ago

Fresa commented 1 week ago

Component(s)

pkg/stanza

Is your feature request related to a problem? Please describe.

I would like to recombine golang stack traces.

Describe the solution you'd like

The documentation for recombine has an example for how to recombine a java stack trace. Would be great to have something similar for a golang stack trace.

Describe alternatives you've considered

No response

Additional context

No response

github-actions[bot] commented 1 week ago

Pinging code owners:

VihasMakwana commented 1 week ago

Hi.

Can you attach a golang stack trace example? I can help with this.

Fresa commented 1 week ago

@VihasMakwana here are two examples, one using zap: https://go.dev/play/p/fRdYSlGjtUZ

1.257894e+09    error   sandbox3052195497/prog.go:28    stacktrace from panic
main.main.func1
    /tmp/sandbox3052195497/prog.go:28
runtime.gopanic
    /usr/local/go-faketime/src/runtime/panic.go:785
runtime.goPanicIndex
    /usr/local/go-faketime/src/runtime/panic.go:115
main.main
    /tmp/sandbox3052195497/prog.go:34
runtime.main
    /usr/local/go-faketime/src/runtime/proc.go:272

and second one using runtime/debug: https://go.dev/play/p/krPo2EYA9Iz

stacktrace from panic: goroutine 1 [running]:
runtime/debug.Stack()
    /usr/local/go-faketime/src/runtime/debug/stack.go:26 +0x5e
main.main.func1()
    /tmp/sandbox38606549/prog.go:11 +0x25
panic({0x4a74a0?, 0xc00001a018?})
    /usr/local/go-faketime/src/runtime/panic.go:785 +0x132
main.main()
    /tmp/sandbox38606549/prog.go:16 +0x35