Skip to content
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

fix(rule_engine): don't increment unknown counter on unrecoverable er… #10327

Conversation

SergeTupchiy
Copy link
Contributor

@SergeTupchiy SergeTupchiy commented Apr 4, 2023

Closes: EMQX-8786

Fixes

Summary

🤖 Generated by Copilot at 7134acd

Fix rule engine crash bug and refactor is_ok_result function in emqx_rule_runtime.erl

PR Checklist

Please convert it to a draft if any of the following conditions are not met. Reviewers may skip over until all the items are checked:

  • Added tests for the changes
  • Changed lines covered in coverage report
  • Change log has been added to changes/{ce,ee}/(feat|perf|fix)-<PR-id>.en.md files
  • For internal contributor: there is a jira ticket to track this change
  • If there should be document changes, a PR to emqx-docs.git is sent, or a jira ticket is created to follow up
  • Schema changes are backward compatible

Checklist for CI (.github/workflows) changes

  • If changed package build workflow, pass this action (manual trigger)
  • Change log has been added to changes/ dir for user-facing artifacts update

@SergeTupchiy SergeTupchiy requested review from a team and kjellwinblad as code owners April 4, 2023 12:34
@@ -523,9 +525,7 @@ inc_action_metrics(R, RuleId) ->
emqx_metrics_worker:inc(rule_metrics, RuleId, 'actions.success')
end.

is_ok_result(ok) ->
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok is already matched on line 511:

inc_action_metrics(ok, RuleId) ->
    emqx_metrics_worker:inc(rule_metrics, RuleId, 'actions.success');

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if ok results has to be leaked down here anyway we can probably delete line 511 instead.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @zmstone, good point, changed it in: #10328

@SergeTupchiy
Copy link
Contributor Author

NOTE: this fix is applicable only for synchronous bridges. If a bridge is asynchronous, rule action statistics will count everything as success.

thalesmg
thalesmg previously approved these changes Apr 4, 2023
Copy link
Contributor

@thalesmg thalesmg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: could we add simple test for this case? Could be in a follow up PR to avoid blocking this fix for the release, of course.

Also, maybe we need a changelog here?

@thalesmg
Copy link
Contributor

thalesmg commented Apr 4, 2023

NOTE: this fix is applicable only for synchronous bridges. If a bridge is asynchronous, rule action statistics will count everything as success.

True, I noticed this issue yesterday as well 🙈
https://emqx.atlassian.net/browse/EMQX-9450

@SergeTupchiy SergeTupchiy force-pushed the EMQX-8786-fix-unknown-counter-inc-on-unrecoverable-err branch from 7134acd to aca65ca Compare April 4, 2023 13:00
@SergeTupchiy
Copy link
Contributor Author

Nit: could we add simple test for this case? Could be in a follow up PR to avoid blocking this fix for the release, of course.

Also, maybe we need a changelog here?
Thanks, @thalesmg, I've added a changelog, working on a test case, I think I'll add it to this PR.

@SergeTupchiy
Copy link
Contributor Author

Nit: could we add simple test for this case? Could be in a follow up PR to avoid blocking this fix for the release, of course.
Also, maybe we need a changelog here?
Thanks, @thalesmg, I've added a changelog, working on a test case, I think I'll add it to this PR.

@thalesmg , I'm going to merge it without tests in order not to block the release, as adding them may take some time.
I've added a follow-up ticket for tests https://emqx.atlassian.net/browse/EMQX-9459

@SergeTupchiy SergeTupchiy merged commit 877b828 into emqx:release-50 Apr 4, 2023
75 of 78 checks passed
@SergeTupchiy SergeTupchiy deleted the EMQX-8786-fix-unknown-counter-inc-on-unrecoverable-err branch April 21, 2023 10:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants