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

Execute a single rule in isolation #14892

Merged
merged 37 commits into from Apr 4, 2023
Merged

Execute a single rule in isolation #14892

merged 37 commits into from Apr 4, 2023

Conversation

patrickmann
Copy link
Contributor

@patrickmann patrickmann commented Mar 9, 2023

Resolves #14891

Leverage existing code in PipelineInterpreter to simulate a single rule in isolation, i.e.

  • no codecs
  • no pipelines and stages
  • no stream input
  • no changes to state

We just take in a message string and run the rule on it.

Introduces a new API, which takes in a rule and an input message. It returns the processed message.

POST /system/pipelines/rule/simulate/{messageString}
      Body: RuleSource

Screenshot 2023-03-15 at 16 20 36

@patrickmann patrickmann marked this pull request as draft March 9, 2023 08:48
@patrickmann patrickmann force-pushed the rulesimulator branch 2 times, most recently from 60b6ee3 to d290bb6 Compare March 9, 2023 11:31
@gally47 gally47 self-assigned this Mar 14, 2023
@patrickmann patrickmann requested a review from bernd March 16, 2023 12:02
@patrickmann patrickmann requested review from a team and removed request for bernd March 21, 2023 14:34
@patrickmann patrickmann marked this pull request as ready for review March 22, 2023 15:21
@patrickmann patrickmann requested review from AntonEbel and removed request for a team March 24, 2023 08:56
Copy link
Contributor

@AntonEbel AntonEbel left a comment

Choose a reason for hiding this comment

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

Backend LGTM

Copy link
Contributor

@grotlue grotlue left a comment

Choose a reason for hiding this comment

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

Works and looks good! 👍

@@ -46,7 +46,9 @@ class MessageFields extends React.Component {

render() {
const { message } = this.props;
const formattedFields = message.formatted_fields;
// eslint-disable-next-line no-unused-vars
const { _id, ...formatted_fields } = message.fields;
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do we need the _id? I think we can use _ and eslint might not complain, but not sure.

Copy link
Contributor

Choose a reason for hiding this comment

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

We basically need formatted_fields only, so we needed to add _id to get the rest.

Copy link
Contributor

@ousmaneo ousmaneo left a comment

Choose a reason for hiding this comment

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

LGTM!

@patrickmann patrickmann merged commit 028c130 into master Apr 4, 2023
5 checks passed
@patrickmann patrickmann deleted the rulesimulator branch April 4, 2023 07:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Simulate a single rule
6 participants