-
-
Notifications
You must be signed in to change notification settings - Fork 777
Log non-fatal errors during service bootstrap phase under DEBUG instead of ERROR #4630
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 1 commit
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
bfbd06a
Log non-fatal errors during service startup phase (internal trigger type
Kami 9e46cbd
Don't include traceback on non fatal error.
Kami 1462533
Merge branch 'master' of github.com:StackStorm/st2 into fix_non_fatal…
Kami 39ae2d7
Add changelog entry.
Kami File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -14,6 +14,7 @@ | |
| # limitations under the License. | ||
|
|
||
| from __future__ import absolute_import | ||
|
|
||
| import six | ||
|
|
||
| from mongoengine import ValidationError | ||
|
|
@@ -23,7 +24,8 @@ | |
| from st2common import log as logging | ||
| from st2common.constants.triggers import (INTERNAL_TRIGGER_TYPES, ACTION_SENSOR_TRIGGER) | ||
| from st2common.exceptions.db import StackStormDBObjectConflictError | ||
| from st2common.services.triggers import create_trigger_type_db, create_shadow_trigger | ||
| from st2common.services.triggers import create_trigger_type_db | ||
| from st2common.services.triggers import create_shadow_trigger | ||
| from st2common.services.triggers import get_trigger_type_db | ||
| from st2common.models.system.common import ResourceReference | ||
|
|
||
|
|
@@ -36,7 +38,8 @@ | |
|
|
||
| def _register_internal_trigger_type(trigger_definition): | ||
| try: | ||
| trigger_type_db = create_trigger_type_db(trigger_type=trigger_definition) | ||
| trigger_type_db = create_trigger_type_db(trigger_type=trigger_definition, | ||
| log_not_unique_error_as_debug=True) | ||
| except (NotUniqueError, StackStormDBObjectConflictError): | ||
| # We ignore conflict error since this operation is idempotent and race is not an issue | ||
| LOG.debug('Internal trigger type "%s" already exists, ignoring...' % | ||
|
|
@@ -52,12 +55,13 @@ def _register_internal_trigger_type(trigger_definition): | |
| # trigger types with parameters do no require a shadow trigger. | ||
| if trigger_type_db and not trigger_type_db.parameters_schema: | ||
| try: | ||
| trigger_db = create_shadow_trigger(trigger_type_db) | ||
| trigger_db = create_shadow_trigger(trigger_type_db, | ||
| log_not_unique_error_as_debug=True) | ||
|
|
||
| extra = {'trigger_db': trigger_db} | ||
| LOG.audit('Trigger created for parameter-less internal TriggerType. Trigger.id=%s' % | ||
| (trigger_db.id), extra=extra) | ||
| except StackStormDBObjectConflictError: | ||
| except (NotUniqueError, StackStormDBObjectConflictError): | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 |
||
| LOG.debug('Shadow trigger "%s" already exists. Ignoring.', | ||
| trigger_type_db.get_reference().ref, exc_info=True) | ||
|
|
||
|
|
@@ -73,7 +77,11 @@ def register_internal_trigger_types(): | |
| """ | ||
| Register internal trigger types. | ||
|
|
||
| Note: This method blocks until all the trigger types have been registered. | ||
| NOTE 1: This method blocks until all the trigger types have been registered. | ||
|
|
||
| NOTE 2: We log "NotUniqueError" errors under debug and not error. Those errors are not fatal | ||
| because this operation is idempotent and NotUniqueError simply means internal trigger type | ||
| has already been registered by some other service. | ||
| """ | ||
| action_sensor_enabled = cfg.CONF.action_sensor.enable | ||
|
|
||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note: We want to default this to
Falseeverywhere because in other context, this error would indeed be fatal.