-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Added matcher syntax support for Routing tree editor. #2065
Conversation
* feat: Added matcher syntax support for Alertmanager visual editor. First four examples from here https://prometheus.io/docs/alerting/latest/configuration/#matcher should be fine. The last one has an issue, escaped quotes make regexp test fail. Signed-off-by: Alex Antipin <[email protected]>
* fix: parseSearch method behave incorrect for matchers syntax: It's intended to split string to label\value pairs, but it would split values also if comma is present there. It is legitimate to have comma in values according to matcher value rules listed here https://prometheus.io/docs/alerting/latest/configuration/#matcher Also it couldn't handle strings properly by ignoring escaped quotes that is produced after new syntax parsing. Signed-off-by: Alex Antipin <[email protected]>
Hi, thanks! I played around with it a bit at https://deploy-preview-2065--prometheus-docs.netlify.app/webtools/alerting/routing-tree-editor/ and it seems to only work when not putting any spaces around the match op, e.g. Also, should a regex matcher like Generally: For now going about it in this direction seems fine, but long term I think this piece of JS is not easy to maintain or get fully correct. At some point it would be great for this to have a Go backend that could do proper validation of everything and reuse the Go datatypes + code for all of this and just return a tree to the UI... kind of like PromLens (https://promlens.com/) is doing for PromQL. |
I understood the comments. I'll see what can be done You are right about maintainability of that solution and using existing code base would be preferable over reinventing the wheel in JS. |
@Evreke Maybe webasm could be a solution, but I know very little about it so far... the other option would be just having a Go backend. Of course that would need to be hosted somewhere, which is annoying. But yeah, the current piece of JS:
...which is not great. |
* fix: there could be zero or one heading\trailing spaces around selector Signed-off-by: Alex Antipin <[email protected]>
@juliusv About comments.
I think 2,3 is just a waste of time in case if we want to rewrite this part of code to be evaluated by WASM\external API or something else. Correct me if i'm wrong. In summary: |
@juliusv So we have to look at hosted backend for reusing existing code base. |
@Evreke Thanks, yeah, makes sense! I'll be honest, I won't have too much time to put into something completely new with a hosted backend (especially since that needs to be run somewhere separately and maintained by the team). I think we have two options:
|
Sounds reasonable. I'll watch what could be done on your second and third comment if you insist but from my point of view it is not necessary. |
With the third one, do you mean the one about |
7851681
to
56c6541
Compare
@juliusv |
@juliusv |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks and sorry for the extended pause on my side! Looks pretty good to me, one small question.
6c475d8
to
83fba0c
Compare
* add: Matcher enum-like object holding relevant PromQL matcher operators * add: matchNewSyntax method to check equality for values using Matcher operator * fix: negative matchers should not be considered as Regexp Signed-off-by: Alex Antipin <[email protected]>
83fba0c
to
3500e07
Compare
Great, thank you again for the work and the patience :) 👍 |
* Added feature for matcher syntax to Visual Editor. (prometheus#1638) * feat: Added matcher syntax support for Alertmanager visual editor. First four examples from here https://prometheus.io/docs/alerting/latest/configuration/#matcher should be fine. The last one has an issue, escaped quotes make regexp test fail. Signed-off-by: Alex Antipin <[email protected]> * Added feature for matcher syntax to Visual Editor. (prometheus#1638) * fix: parseSearch method behave incorrect for matchers syntax: It's intended to split string to label\value pairs, but it would split values also if comma is present there. It is legitimate to have comma in values according to matcher value rules listed here https://prometheus.io/docs/alerting/latest/configuration/#matcher Also it couldn't handle strings properly by ignoring escaped quotes that is produced after new syntax parsing. Signed-off-by: Alex Antipin <[email protected]> * Added feature for matcher syntax to Visual Editor. (prometheus#1638) * fix: there could be zero or one heading\trailing spaces around selector Signed-off-by: Alex Antipin <[email protected]> * Added feature for matcher syntax to Visual Editor. (prometheus#1638) * add: Matcher enum-like object holding relevant PromQL matcher operators * add: matchNewSyntax method to check equality for values using Matcher operator * fix: negative matchers should not be considered as Regexp Signed-off-by: Alex Antipin <[email protected]> Signed-off-by: cstef <[email protected]>
I added matchers syntax support to alertmanager routing tree editor
PR closes #1638 closes #1965