Skip to content

[SLO] Improve custom equation validation #170962

Closed
@simianhacker

Description

🍒 Summary

Currently the custom equation field on the Timeslice Metric and Custom Metric only validates the string using a REGEX to ensure the user doesn't use any invalid characters: A-Z, +, -, /, *, (, ), ?, !, &, :, |, >, <, =. This doesn't stop the user from creating an invalid equation, even though it validates the REGEX, like INVALID.

🎯 Acceptance Criteria

  • When a user types valid characters but not a valid equation, we should mark the equation as "invalid" when ES is returning an error for that invalid equation.
  • Update the GetPreviewData API to return an optional error when the query fails. { data: Data[], error?: string }

🧠 Additional Thoughts

We should use the preview request to validate the equation since it runs the actual equation via painless. If we don't get a valid response, we should set the field to "invalid". Ideally, users wouldn't save an equation which doesn't work in the preview, we just need to enforce that.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions