Netflix / flamescope

FlameScope is a visualization tool for exploring different time ranges as Flame Graphs.
Apache License 2.0
3k stars 168 forks source link

Ability to view Golang graphs #5

Closed richardartoul closed 6 years ago

richardartoul commented 6 years ago

This tool looks really awesome and I'd like to try it out on some profiles taken from our production services, but the tool seems to be having trouble with profiles generated using the go tool pprof command.

Has anyone tried or gotten this to work with Golang profiles yet?

Here's the stacktrace I'm getting:

Traceback (most recent call last):
  File "/usr/local/lib/python2.7/site-packages/flask/app.py", line 1997, in __call__
    return self.wsgi_app(environ, start_response)
  File "/usr/local/lib/python2.7/site-packages/flask/app.py", line 1985, in wsgi_app
    response = self.handle_exception(e)
  File "/usr/local/lib/python2.7/site-packages/flask/app.py", line 1540, in handle_exception
    reraise(exc_type, exc_value, tb)
  File "/usr/local/lib/python2.7/site-packages/flask/app.py", line 1982, in wsgi_app
    response = self.full_dispatch_request()
  File "/usr/local/lib/python2.7/site-packages/flask/app.py", line 1614, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/usr/local/lib/python2.7/site-packages/flask/app.py", line 1517, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/usr/local/lib/python2.7/site-packages/flask/app.py", line 1612, in full_dispatch_request
    rv = self.dispatch_request()
  File "/usr/local/lib/python2.7/site-packages/flask/app.py", line 1598, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/Users/richardartoul/Documents/flamescope/app/views/heatmap.py", line 34, in get_heatmap
    return jsonify(generate_heatmap(filename, rows))
  File "/Users/richardartoul/Documents/flamescope/app/util/heatmap.py", line 120, in generate_heatmap
    cols = int(ceil(end) - floor(start))
OverflowError: cannot convert float infinity to integer

EDIT: Ah ok it looks like this tool is designed to handle the linux perf output whereas golang generates pprof-formatted files.

Liron24 commented 5 years ago

Hi, I'm getting the same stacktrace and I'm running Java application, any ideas about it?

spiermar commented 5 years ago

@Liron24 what kind of profile are you trying to open?

Liron24 commented 5 years ago

@spiermar not sure about the answer to your question. I have performed the basic example you have provided: $ sudo perf record -F 49 -a -g -- sleep 120 $ sudo perf script --header > stacks.myproductionapp.2018-03-30_01

It produces a perf file, I moved it to the examples folder, saw it on the flamescope but when I tried to open the stacktrace showed here appeared. Any ideas?

spiermar commented 5 years ago

Ok, so the previous issue was that the trace was generated from trying to open a non-perf profile. Can you share profile with us to reproduce?

Liron24 commented 5 years ago

@spiermar it's our production application, I can't really share it, is there any other information I can provide you to understand what's going on? Or any other instructions for me to try and troubleshoot this?

spiermar commented 5 years ago

@Liron24 if it's that exact error

cols = int(ceil(end) - floor(start))
OverflowError: cannot convert float infinity to integer

Likely the error is caused by a failure to parse a start and/or end timestamps of the profile:

https://github.com/Netflix/flamescope/blob/master/app/util/heatmap.py#L84

If you compare your profile with the examples in the repo, do they look similar? Same format?

Liron24 commented 5 years ago

@spiermar my generated perf.data is a binary and I can't really read it while the other examples I can clearly open and read. Is there any other command to generate a profile to be similar to the examples?

spiermar commented 5 years ago

Ok, so looks like you're trying to open the raw perf record data, not the output of perf script, which it's text format.

Liron24 commented 5 years ago

@spiermar you were right. I managed to view an heat map of the stacks output, however, all the classes shows as "unknown", could it stems from the errors I got when creating the stacks? Failed to open <> , continuing without symbols

spiermar commented 5 years ago

Yes, unknowns are missing symbols.

felixge commented 1 year ago

It's now possible to use FlameScope with go1.19+ - I've written a tool and blog post for it here: https://blog.felixge.de/flamescope-for-go/