fgprof icon indicating copy to clipboard operation
fgprof copied to clipboard

"No source information" in pprof format

Open bboreham opened this issue 3 years ago • 4 comments

I added github.com/felixge/fgprof to one of the Prometheus unit tests, which gives me good charts but no source line info:

$ go tool pprof -list processWALSamples ./tsdb.test cpu2
Total: 59.55s
No source information for github.com/prometheus/prometheus/tsdb.(*walSubsetProcessor).processWALSamples

I can work on a repro if it's interesting; didn't know whether I should expect it to work.

I'm running go version go1.17.8 linux/amd64.

bboreham avatar Jun 10 '22 16:06 bboreham

Hey, sorry for the very late reply!

I just took a look, and this is currently broken because I initially was just targeting brendan gregg's folded text format (which doesn't contain file/line info) and then didn't rework the code to propagate this information when I added pprof support.

So in theory it should be a relatively easy fix! I don't know if I'll get a around to it soon, but I'd be happy to merge a patch for this quickly!

felixge avatar Jul 24 '22 17:07 felixge

I don't know whether I'll get around to it either, but could you suggest a file or function which is a good place to start looking how to add it?

bboreham avatar Jul 25 '22 09:07 bboreham

Let's perhaps change the title of this issue to Missing file and line information in pprof format. (:

bwplotka avatar Jul 31 '22 16:07 bwplotka

I needed this to work so I hacked it in the simplest way.

It works but it is inefficient and ugly, as Felix mentions in a TODO comment the interface between the functions need to be improved.

I didn't bother to make a PR as it is clearly not the right way of solving this, but it does work (at least for my use case, have not tried this extensively). If anyone needs this short term or want to fix this properly: https://github.com/zingneo/fgprof/commit/0bffb36c8f2941ce73812e3c7440aaf2ad5580c2

zingneo avatar Aug 08 '22 14:08 zingneo

Alright, I've just implemented this in https://github.com/felixge/fgprof/pull/22 . I've tested it, but it would also be great if somebody else could try it out and let me know if it works :).

@zingneo that's a nice hack! Doing it "properly" required quite some code changes. My initial abstraction was not very good 🙈 .

felixge avatar Aug 31 '22 21:08 felixge

Tried out the new version and the file and line number info seems to be working as it should for my use case.

Thanks!

zingneo avatar Sep 04 '22 21:09 zingneo