firest
2bc014db69
fix(events): call `client.check_authn_complete` even if authentication fails
2024-05-09 18:15:32 +08:00
firest
d2ca4e9f11
chore: update change
2024-05-09 11:04:56 +08:00
Kjell Winblad
916168c755
fix: make rule engine unescape convert \a to the terminal alarm char
...
The rule engine unescape function should convert the escape sequence \a
to the alarm bell symbol (ASCII 7). This bug was created as it was
assumed that Erlang convert $\a to 7 but Erlang does not handle the \a
escape sequence and instead convert it to 97 (ASCII code for a).
Fixes:
https://emqx.atlassian.net/browse/EMQX-12313
2024-05-08 15:18:13 +02:00
JianBo He
4403b4f5ce
Merge pull request #12976 from HJianBo/fix-duplicated-disconnect
...
Fix duplicated disconnect event
2024-05-08 14:43:19 +08:00
Kjell Winblad
d5324e295f
test: do cleanup in emqx_common_test_helpers:on_exit function
...
Thanks @thalesmg for the suggestion.
2024-05-07 18:18:18 +02:00
Kjell Winblad
09ee7ec0e2
fix(rule tracing): make sure that recoverable errors are traced
2024-05-07 15:49:38 +02:00
firest
f641d0b2b7
feat(events): add new hook && event `client.check_authn_complete`
2024-05-07 16:24:31 +08:00
Kjell Winblad
feecc36607
fix(rule tracing): clean up error tuple in the action_failed trace
2024-05-07 09:13:55 +02:00
JianBo He
1642b06bf9
test: add tests
2024-05-07 10:30:53 +08:00
Kjell Winblad
5bfe31b691
fix: issues found during PR review (thanks @thalesmg and @zmstone)
...
* Simpler handling of true and false in best effort JSON formatter
* inet:ntoa/1 to format IP addresses
* Made a record for lazy formatted trace values and formatter to improve
maintainability
* Added callback to format return value from connector
* Extended test case to check that the format return value callback
works
* Added handling of "lazy" trace entry data to the text formatter. Do we
need to handle this data in the normal log formatters as well?
2024-05-03 15:04:57 +02:00
Kjell Winblad
e32745bca6
test(apply rule trace): add test case for republish and console print
2024-05-03 15:02:37 +02:00
Kjell Winblad
76ccef7ce3
fix(trace api): trace should be ready after create
...
Fixes:
https://emqx.atlassian.net/browse/EMQX-12276
2024-05-03 15:02:37 +02:00
Kjell Winblad
9576efb716
fix(rule apply test): do not crash when the rule is not found
2024-05-03 15:02:37 +02:00
Kjell Winblad
3ba5cb7858
fix(apply rule): make sure we return something JSON compatible
...
Fixes:
https://emqx.atlassian.net/browse/EMQX-12275
2024-05-03 15:02:37 +02:00
Kjell Winblad
ea7633c484
fix: rule trace formatting, republish and console stop after rendering
...
* Better rule trace formatting for many trace entries
* The republish and console actions have got working stop after
rendering functionality
2024-05-03 15:02:36 +02:00
Thales Macedo Garitezi
607bf0fe44
Merge pull request #12952 from thalesmg/fix-dont-list-mv-rule-event-r57-20240429
...
fix(rule events): don't list validation failure event in CE API
2024-05-02 09:20:53 -03:00
Thales Macedo Garitezi
7a44746492
fix(rule events): don't list validation failures in CE
...
Fixes https://emqx.atlassian.net/browse/EMQX-12284
2024-04-30 14:41:09 -03:00
zmstone
c8d6976b14
feat: add conditions to variform expressions
...
- refactored `coalesce` function to allow lazy evaluation
- added `iif(Cond, IfExpr, EleseExpr)` to allow simple conditions
2024-04-30 07:28:27 +02:00
Kjell Winblad
ef9884cf47
refactor(rule trace): templates rendered trace to increase code reuse
...
* The code for passing the trace context to a sub process has been
improved to increase code reuse. This code is used when the action
templates are rendered in a sub process.
* A macro has also been added for the error term that is thrown when the
action shall be stopped after the templates has been rendered. This is
also done to reduce code duplication and to reduce the risk of
introducing bugs due to typos.
* Fix incorrect type spec
Thanks to @zmstone for suggesting these improvements in comments to a PR
(https://github.com/emqx/emqx/pull/12916 ).
2024-04-25 13:15:36 +02:00
Kjell Winblad
b2811f96b2
refactor(rule trace): simplify function for setting trace meta data
...
This commit simplifies a function to set trace meta data in line with a
suggestion from @zmstone:
https://github.com/emqx/emqx/pull/12912#discussion_r1576053856
2024-04-25 11:51:46 +02:00
Kjell Winblad
e9d498dde2
feat(rule tracing): add rule trigger time meta data field
...
Fixes:
https://emqx.atlassian.net/browse/EMQX-12025
2024-04-22 13:51:48 +02:00
Kjell Winblad
09b414f368
test: add necessary application to test suites
2024-04-18 17:39:52 +02:00
Kjell Winblad
285bfa9367
fix: improve rendering of action_template_rendered trace
2024-04-18 17:00:47 +02:00
Kjell Winblad
7be18730e8
test(emqx_rule_engine_api_rule_apply_SUITE): remove unnecessary code
2024-04-18 15:16:18 +02:00
Kjell Winblad
8f1486f6d3
fix: clean up trace messages to make it easier to interpret
...
This commit removes some redundant trace messages and renames some to
make it easier to interpret what is happening for the user.
2024-04-18 14:28:01 +02:00
Kjell Winblad
2a2fadfbff
Merge pull request #12827 from kjellwinblad/kjell/emqx_rule_tracing/EMQX-11966
...
Add rule ID tracing support
2024-04-18 09:06:31 +02:00
Kjell Winblad
95891db29a
test: clean up created resources in the end of test case
2024-04-17 18:43:19 +02:00
Kjell Winblad
6cf29ba688
fix: clean up traces to make them easier to parse and understand
2024-04-17 18:20:17 +02:00
Kjell Winblad
cf56050759
feat: avoid mixing request with and without the stop_after_render flag
...
Previously a batch of requests that was sent to a connector could
contain both requests with the stop_after_rendering flag and requests
without this flag. When this happened a warning message was generated and
the stop_after_render flags for the batch would be ignored. This commit
fixes so that a mixed batch is never created so there is no longer any
need for a warning message or ignoring flags.
2024-04-17 16:21:21 +02:00
zmstone
f80d078de3
feat(variform): Add more functions
2024-04-15 16:56:52 +02:00
zmstone
b76b6fbe63
feat(variform): initialize client_attrs with variform
...
Moved regular expression extraction as a variform function.
2024-04-14 10:13:24 +02:00
Kjell Winblad
f444c6fc32
fix: pass stop_action_after_render=true in trace meta data
...
Even if there is no trace we still need to pass
stop_action_after_render=true in the trace meta data so that the action
will be stopped.
2024-04-12 11:38:01 +02:00
Kjell Winblad
9998940aa2
fix(trace): several improvements thanks to comments from @zmstone
2024-04-11 16:48:43 +02:00
Kjell Winblad
31142df5cf
fix: default value of stop_action_after_template_rendering to true
...
This commit changes the default value for the
stop_action_after_template_rendering option of the apply rule HTTP API
endpoint so that it is true instead of false.
2024-04-09 16:20:37 +02:00
Kjell Winblad
7bcd553786
test: move test case with rule_engine dep from emqx to emqx_rule_engine
2024-04-09 14:08:46 +02:00
Kjell Winblad
958748cf7f
test: fix inter test suite problem
2024-04-09 11:10:39 +02:00
Kjell Winblad
9628a00a82
docs(emqx_rule_api apply rule): fix doc strings
2024-04-08 15:34:29 +02:00
Kjell Winblad
02ee873094
docs(emqx_rule_api_schema): fix type spec
2024-04-08 13:42:15 +02:00
Kjell Winblad
79440064fe
style: fix problems reported by elvis
2024-04-08 11:03:55 +02:00
Kjell Winblad
5479932190
feat(apply rule test): make option to stop action after render work
...
This commit makes the apply rule HTTP API option to stop an action work
for the HTTP action, and adds infrastructure that makes it easy to add
this functionality to other actions.
2024-04-06 17:21:12 +02:00
Kjell Winblad
ef705c2285
feat: add apply rule API, clientid/ruleid tracing for rule and connector
...
This commit adds:
* Support for forwarding the rule id and client id to the connector so
that events such as template rendered successfully can be traced.
* HTTP API for for applying/activating a rule with the given context
2024-04-06 17:20:47 +02:00
Kjell Winblad
59a442cdb5
feat(rule trace): add support for ruleid as a trace type
2024-04-04 14:55:32 +02:00
zmstone
5f26e4ed5e
feat(variform): implement variform engine
2024-03-28 19:34:57 +01:00
zmstone
ad95473aae
refactor: move string functions to emqx_variform
2024-03-28 18:03:37 +01:00
Ivan Dyachkov
db9efb9317
chore: bump apps versions
2024-03-28 10:19:09 +01:00
Thales Macedo Garitezi
59ff43ec87
feat(message validation): implement metrics
...
Fixes https://emqx.atlassian.net/browse/EMQX-12071
2024-03-25 10:55:01 -03:00
Thales Macedo Garitezi
00aa7b5621
feat: create new `message.validation_failed` hookpoint and rule engine event
2024-03-21 13:46:27 -03:00
Ivan Dyachkov
923fd0a2a6
Merge pull request #12737 from id/0319-sync-release56
...
sync release-56
2024-03-19 19:09:41 +01:00
Ivan Dyachkov
f2dc940436
Merge remote-tracking branch 'upstream/release-56' into 0319-sync-release56
2024-03-19 15:20:08 +01:00
Thales Macedo Garitezi
f84a996671
feat: implement message validation
...
Fixes https://emqx.atlassian.net/browse/EMQX-11980
2024-03-18 13:11:39 -03:00
Serge Tupchii
8f8b023429
refactor: simplify match spec holder construction
2024-03-18 18:00:26 +02:00
Kjell Winblad
5a6f96212d
feat(rule engine SQL): add an `unescape` function
...
The added `unescape` function unescapes escape sequences, transforming
them back to their represented characters. The following escape
sequences are supported:
- Standard C escape sequences:
- `\n` for newline (LF)
- `\t` for horizontal tab (HT)
- `\r` for carriage return (CR)
- `\b` for backspace (BS)
- `\f` for formfeed (FF)
- `\v` for vertical tab (VT)
- `\'` for single quote (')
- `\"` for double quote (")
- `\\` for backslash (\)
- `\?` for question mark (?)
- `\a` for alert (bell, BEL)
- Hexadecimal escape codes:
- `\xH...` where `H...` is one or more hexadecimal digits (0-9, A-F,
a-f), allowing for the encoding of arbitrary utf32 characters.
If an escape sequence is not recognized, or if the hexadecimal escape
does not form a valid Unicode character, the function generates an
exception.
Fixes:
https://github.com/emqx/emqx/issues/12460
https://emqx.atlassian.net/browse/EMQX-11847
2024-03-08 12:05:06 +01:00
Kjell Winblad
060e02c4c4
Merge pull request #12653 from kjellwinblad/kjell/rule_engine/fix/subbits/support_non_byte_sizes/EMQX-11943
...
fix(rule_engine): support non-byte sized input to bin2hexstr
2024-03-08 09:41:03 +01:00
Kjell Winblad
6054499607
Merge pull request #12657 from kjellwinblad/kjell/rule_engine/fix/fun_calls_as_array_items/EMQX-11953
...
fix(rule SQL): allow expressions as array items
2024-03-08 09:39:46 +01:00
Shawn
163d095dca
fix: port the changes for date_to_unix_ts SQL fun from 4.4
2024-03-08 10:48:08 +08:00
zmstone
e99546e009
Merge remote-tracking branch 'origin/release-56' into sync-5.5.1
2024-03-06 17:27:54 +01:00
Kjell Winblad
c206ee37e0
fix(rule SQL): allow expressions as array items
...
Fixes:
https://github.com/emqx/emqx/issues/12465
https://emqx.atlassian.net/browse/EMQX-11953
2024-03-06 15:38:19 +01:00
Kjell Winblad
69114bc6c2
fix(rule_engine): support non-byte sized input to bin2hexstr
...
The rule engine subbits function can return a bitstring which size is
not divisible by 8. Therefore, it makes sense that the rule engine
function bin2hexstr can handle such bitstrings as well. This is fixed by
this commit.
Fixes:
https://github.com/emqx/emqx/issues/12586
https://emqx.atlassian.net/browse/EMQX-11943
2024-03-06 15:26:49 +01:00
Kjell Winblad
365d054e01
fix: add subbits/4 and subits/5 rule_engine functions
...
The documentation for the family of subbits functions says that the
fifth and sixth parameters are optional (since they only make sense when
the forth parameter is 'integer'). However, before this commit
`subbits/4` and `subbits/5` did not exist.
Fixes:
https://emqx.atlassian.net/browse/EMQX-11942
https://github.com/emqx/emqx/issues/12587
2024-03-05 13:27:07 +01:00
zmstone
9929025820
fix(rule_func): time zone shift at wrong precision
2024-03-04 21:25:49 +01:00
firest
6d9b2a95c3
Merge remote-tracking branch 'origin/release-55'
2024-03-04 20:47:20 +08:00
Thales Macedo Garitezi
0dd9990f24
Merge remote-tracking branch 'origin/release-55' into sync-r55-r56-20240304
2024-03-04 09:44:30 -03:00
JimMoen
0a33f9d027
fix(calendar): leap year time to unix timestamp
2024-03-04 15:37:49 +08:00
Zaiming (Stone) Shi
46877e979b
chore: update copyright-year
2024-02-23 08:21:06 +01:00
Thales Macedo Garitezi
d469f4158e
chore: bump app vsns
2024-02-20 16:53:57 -03:00
zhongwencool
e9c8446d57
feat: upgrade erlfmt to support maybe syntax
2024-01-31 20:06:49 +08:00
Shawn
4afba8eb94
feat: port emqx/emqx-enterprise#1892 , add some SQL functions
2024-01-24 18:50:57 +08:00
Thales Macedo Garitezi
cc24fe6e93
feat(mqtt_consumer): add support for rule engine `FROM`
2024-01-16 10:42:52 -03:00
Zaiming (Stone) Shi
23ded313ec
chore: update app versions
2023-12-22 15:29:22 +01:00
Zaiming (Stone) Shi
322b7bb7d2
chore: bump app vsn
2023-12-22 13:00:37 +01:00
Thales Macedo Garitezi
18b69809da
Merge branch 'release-54' into sync-r54-m-20231221
2023-12-21 10:05:13 -03:00
Thales Macedo Garitezi
b61ccf3373
fix(bridges_v1): don't list v2-only bridges in API
...
Fixes https://emqx.atlassian.net/browse/EMQX-11614
2023-12-20 10:46:35 -03:00
Thales Macedo Garitezi
cf9331a95f
Merge branch 'release-54' into sync-r54-m-20231218
2023-12-18 17:21:08 -03:00
Zaiming (Stone) Shi
35504bd323
refactor: move ntoa (ip address formatting) code to emqx_utils
2023-12-17 21:03:16 +01:00
Thales Macedo Garitezi
57a8f2351d
feat(rule_engine): also bump `unknown` counter for unrecoverable action errors
...
Fixes https://emqx.atlassian.net/browse/EMQX-11494
2023-12-14 13:42:28 -03:00
Thales Macedo Garitezi
99399c6e95
Merge pull request #12098 from thalesmg/revert-downgrade-bridge-id-m-20231205
...
chore: stop downgrading action id in rule API responses
2023-12-05 14:26:23 -03:00
Thales Macedo Garitezi
e5a4be11f5
chore: stop downgrading action id in rule API responses
...
Fixes https://emqx.atlassian.net/browse/EMQX-11405
2023-12-05 11:48:46 -03:00
Thales Macedo Garitezi
cea857cb8e
fix(rule_api): fix sql test when testing against events
...
Fixes https://emqx.atlassian.net/browse/EMQX-11449
2023-12-04 15:24:09 -03:00
Zaiming (Stone) Shi
7f4d91d490
Merge remote-tracking branch 'origin/release-54' into 1201-sync-release-54
2023-12-01 08:32:22 +01:00
Ivan Dyachkov
9fd2fa95a8
chore: bump apps versions
2023-11-30 20:01:12 +01:00
Ivan Dyachkov
ec10c51073
Merge remote-tracking branch 'upstream/release-53' into 1129-sync-r53
2023-11-30 19:51:12 +01:00
Zaiming (Stone) Shi
14644988e0
chore: change triple-quotes to single-quotes
2023-11-29 16:15:18 +01:00
zhongwencool
0aec2f7605
feat: redis bridge v2
2023-11-29 16:06:46 +08:00
JianBo He
c8b5c51bbc
chore: fix failed test cases
2023-11-28 09:53:46 +08:00
JianBo He
dc99651690
test(bridge): ensure almost test cases passed
2023-11-28 09:53:46 +08:00
Stefan Strigler
84ff7b0b38
feat(emqx_bridge): action_info with dynamic lookup
...
This allows a n:1 relation between v1 bridge_types to action/connector types as
it's the case with mongodb for instance, where we had `mongodb_single`
`mongodb_sharded` etc and the new implementation will just have `mongodb`.
2023-11-20 10:22:37 +01:00
Ivan Dyachkov
7c0e345d3a
Merge remote-tracking branch 'upstream/release-54'
2023-11-14 19:38:21 +01:00
Ivan Dyachkov
28a577ad09
chore: bump apps versions
2023-11-14 11:02:26 +01:00
Ivan Dyachkov
1c57993c91
Merge remote-tracking branch 'upstream/release-53' into 1114-sync-r53
2023-11-14 10:44:35 +01:00
Kjell Winblad
d26a1b9afb
fix(bridge_v1): no hard coded downgrade and upgrade type functions
2023-11-14 09:20:46 +01:00
Zaiming (Stone) Shi
86110824eb
feat: upgrade hocon to 0.40.0 which supports union type display name
2023-11-10 13:41:51 +01:00
Zaiming (Stone) Shi
d603de10e6
refactor(schema): add namespace/0 to all schema modules
2023-11-10 13:41:51 +01:00
Ivan Dyachkov
0bf5deaed9
chore: merge master into release-54
2023-11-09 08:32:26 +01:00
Ivan Dyachkov
0c91bec98d
chore: merge 'upstream/release-53'
2023-11-08 09:24:38 +01:00
Thales Macedo Garitezi
f17b762596
chore: don't disable rule that references non-existent bridge
...
After feedback from QA, we decided to rollback enforcing the rule to be disabled.
2023-11-06 10:09:14 -03:00
Thales Macedo Garitezi
0ee74cd8ae
fix(rules_api): downgrade bridge id
...
Fixes https://emqx.atlassian.net/browse/EMQX-11312
2023-11-03 15:57:13 -03:00
Thales Macedo Garitezi
c84e4a4187
fix(rule_engine): don't enable a rule that references non-existent bridge
2023-11-03 09:24:53 -03:00
Andrew Mayorov
910e81bc41
Merge pull request #10442 from keynslug/ft/EMQX-9257/placeholder
...
feat(tpl): split `emqx_placeholder` into a couple of modules
2023-11-02 22:50:05 +07:00
Andrew Mayorov
729c6edff6
chore(repub): simplify error handling in MQTT props templating
2023-11-02 20:13:32 +07:00
Andrew Mayorov
02c1bd70b6
feat(tpl): factor out loose json concept into a separate module
...
Which is called `emqx_jsonish`. Also introduce an _access module_
abstraction to extract information from such data during rendering.
2023-11-02 20:13:31 +07:00