sumerc / yappi

Yet Another Python Profiler, but this time multithreading, asyncio and gevent aware.
MIT License
1.47k stars 73 forks source link

Filtering by module name is mis-documented #34

Closed MatthewWilkes closed 4 years ago

MatthewWilkes commented 4 years ago

The documentation says that to filter function call stats by module name to use {"module": "..."}

https://github.com/sumerc/yappi/blob/f638a12d074fef6190ad9be808e0f223386d0a6e/doc/api.md#L90-L94

However, the C code has the following:

https://github.com/sumerc/yappi/blob/f638a12d074fef6190ad9be808e0f223386d0a6e/yappi/_yappi.c#L1594-L1618

This can be demonstrated by working with the actual code:

(Pdb) all_results = yappi.get_func_stats()
(Pdb) len(all_results)
2558
(Pdb) len(yappi.get_func_stats(filter={"module": all_results[0].module}))
2558
(Pdb) len(yappi.get_func_stats(filter={"modname": all_results[0].module}))
55

In addition, there are no automated tests for filtering by module name.

sumerc commented 4 years ago

You are %100 right. It will be also perfect if we simply raise Exception if there is an unsupported key passed as a filter to get_func_stats API.

MatthewWilkes commented 4 years ago

Yeah, a fall-through exception would be a great addition.

sumerc commented 4 years ago

Fixed in master.

Thanks!