StackStorm / StackStorm/st2

Feature Request - More friendly error logs

Open
#4,605 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement logging
Dominant language
Python
Stars
6.5k
Forks
787
PR merge metrics
No merged PRs in 30d

Description

SUMMARY

Sometimes figuring out what an error in a log file means takes more work than just fixing the problem that caused the error. It would be nice to be able to have more-friendly errors being output.

ISSUE TYPE

Pick one below and delete the rest:

  • Feature Idea
STACKSTORM VERSION

st2 2.10.1, on Python 2.7.5

OS / ENVIRONMENT / INSTALL METHOD

centos7 both docker and bare metal. rpm install.

STEPS TO REPRODUCE

In my latest scenario, a misplaced yaql function wasn't being evaluated.

My webhook jinja looked like:

action:
    ref: "ostk_dbsa.modify_db_connection_limits"
    parameters:
    database: "{{ trigger.body.database.lower() | default('postgres') }}"

when it should have been this:

action:
    ref: "ostk_dbsa.modify_db_connection_limits"
    parameters:
    database: "{{ trigger.body.database | default('postgres') | lower() }}"
EXPECTED RESULTS

less cryptic output?

ACTUAL RESULTS
2019-03-20 09:37:13,225 139865561968304 DEBUG param [-] Failed to render database: 'mongoengine.base.datastructures.BaseDict
object' has no attribute 'database'
Traceback (most recent call last):
  File "/opt/stackstorm/st2/lib/python2.7/site-packages/st2common/util/param.py", line 210, in _resolve_dependencies
    context[name] = _render(node, context)
  File "/opt/stackstorm/st2/lib/python2.7/site-packages/st2common/util/param.py", line 189, in _render
    result = ENV.from_string(str(node['template'])).render(render_context)
  File "/opt/stackstorm/st2/lib/python2.7/site-packages/jinja2/environment.py", line 1008, in render
    return self.environment.handle_exception(exc_info, True)
  File "/opt/stackstorm/st2/lib/python2.7/site-packages/jinja2/environment.py", line 780, in handle_exception
    reraise(exc_type, exc_value, tb)
  File "<template>", line 1, in top-level template code
  File "/opt/stackstorm/st2/lib/python2.7/site-packages/jinja2/environment.py", line 430, in getattr
    return getattr(obj, attribute)
UndefinedError: 'mongoengine.base.datastructures.BaseDict object' has no attribute 'database'

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with st2common/util/param.py, especially _resolve_dependencies and _render, and reproduce the webhook template example from the issue. Define what friendlier output should communicate for the invalid attribute or filter usage, then verify the resulting log explains the failure more clearly than the current traceback.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.