Skip to content

fix(metrics) Check custom rules are created only for transaction (back-end)#58232

Merged
RaduW merged 1 commit into
masterfrom
fix/metrics/custom-rule-transaction-only-be
Oct 18, 2023
Merged

fix(metrics) Check custom rules are created only for transaction (back-end)#58232
RaduW merged 1 commit into
masterfrom
fix/metrics/custom-rule-transaction-only-be

Conversation

@RaduW

@RaduW RaduW commented Oct 17, 2023

Copy link
Copy Markdown
Contributor

This PR changes the CustomRulesEndpoint endpoint to only accept rules for transactions.
Previously any rule was accepted although the condition was generated for transactions only.

Resolves #57900

@RaduW RaduW requested a review from a team October 17, 2023 13:23
@github-actions github-actions Bot added the Scope: Backend Automatically applied to PRs that change backend components label Oct 17, 2023

@iambriccardo iambriccardo left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is the constraint of our system that a query has to contain event.type:transaction since it's the only way we can reliably infer the dataset from a discover query?

Comment on lines +274 to +280
for searchFilter in searchFilters:
if searchFilter.key.name == "event.type" and searchFilter.value.value == "transaction":
transaction_filter = True
break
if not transaction_filter:
return UnsupportedSearchQueryReason.NOT_TRANSACTION_QUERY
return None

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Are you planning on extending this method? If not, I would simplify it:

Suggested change
for searchFilter in searchFilters:
if searchFilter.key.name == "event.type" and searchFilter.value.value == "transaction":
transaction_filter = True
break
if not transaction_filter:
return UnsupportedSearchQueryReason.NOT_TRANSACTION_QUERY
return None
for searchFilter in searchFilters:
if searchFilter.key.name == "event.type" and searchFilter.value.value == "transaction":
return None
return UnsupportedSearchQueryReason.NOT_TRANSACTION_QUERY

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes, I presume that it will get more complex in time.

@iambriccardo iambriccardo self-requested a review October 18, 2023 07:32

@iambriccardo iambriccardo left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is the constraint of our system that a query has to contain event.type:transaction since it's the only way we can reliably infer the dataset from a discover query?

@RaduW RaduW merged commit 1a002c6 into master Oct 18, 2023
@RaduW RaduW deleted the fix/metrics/custom-rule-transaction-only-be branch October 18, 2023 08:35
@github-actions github-actions Bot locked and limited conversation to collaborators Nov 2, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Scope: Backend Automatically applied to PRs that change backend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Enable Investigation Rules in Discovery only when the user explicitly asks for transactions

2 participants