A stack trace is the list of function calls that were on the call stack at the moment an error was thrown, linking the function that failed to the entry point that started the chain. It answers where the failure happened and how the program got there.
Which end you read first depends on the language. Python prints the most recent call last, so the frame that raised the exception sits at the bottom, directly above the error message. JavaScript and Java print the raising frame first, with its callers listed below it down to the request handler or main.
Example
Traceback (most recent call last):
File "/app/api/views.py", line 41, in create_invoice
total = line_total(line_item)
File "/app/api/billing.py", line 88, in line_total
return line_item.amount * line_item.quantity
TypeError: unsupported operand type(s) for *: 'NoneType' and 'int'
The last frame, line 88 of billing.py, is where the TypeError was raised, because line_item.amount is None. The frame above it shows that create_invoice in views.py passed that line item in, so that is where to look next for how a line item with no amount got this far.
What Rollbar does with stack traces
Rollbar parses stack traces in many languages and groups errors according to their root cause using the structure of the frames rather than the message text. Rollbar’s grouping engine carries knowledge of languages, frameworks, and common open source libraries, and it recognizes and ignores boilerplate framework frames so the grouping reflects your code rather than the library you called. Rollbar renders each frame with the file, method, and code context when you enable code context in a traceback.
Related terms
Send your first stack trace to Rollbar.
Sources
- Rollbar Docs, Rollbar Terminology: https://docs.rollbar.com/docs/rollbar-terminology
- Rollbar Docs, Default Grouping Algorithm: https://docs.rollbar.com/docs/grouping-algorithm