-
Notifications
You must be signed in to change notification settings - Fork 8.2k
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
add defaultActionMessage
to index threshold alert UI type definition
#78148
Comments
Pinging @elastic/kibana-alerting-services (Team:Alerting Services) |
@dB2510 sure! Here's what I was thinking. The index threshold alert creates a context variable named kibana/x-pack/plugins/alerting_builtins/server/alert_types/index_threshold/action_context.ts Lines 52 to 66 in ae8f8e1
Specifically,
The My first take would be setting it to this string:
I believe that would be a direct replacement, and would be good enough to ship with. We should make sure there is a functional test somewhere that will end up using this as the message, so we can validate that it's rendering as we expect. I'm guessing we don't have one now, but will poke around a bit to look for one, or a place to add a new one, more when you get to that point. If you've not contributed to Kibana before, there's some guidelines here: https://www.elastic.co/guide/en/kibana/master/contributing.html - per that page, it's unlikely we'll need a release note for this change. |
@pmuellr I am moving forward with the information you have provided. Can you please guide me on how can I reproduce this issue? |
The repro would be:
Once we implement the |
@pmuellr For creating an alert, do we require TLS between elasticsearch and kibana compulsorily? |
TLS between elasticsearch and kibana is compulsorily IF security is enabled. You can run without security enabled (ES + Kibana). At development time, the easiest way to launch ES and Kibana with security is via the following commands, run in separate terminal windows:
Also for development time, you should run |
@pmuellr It worked. You said that message field of server log action should be empty but when I tried that it was saying that message is required. Then I added a 2 word message and saved the alert but was unable to observe that message whenever that alert is running in instances section of that alert. Select an index Define the condition And created a server log connector with level info. |
No, the prefix of This PR only needs to cover the index threshold alert, which is the only alert provided by the alerting team. |
Sorry, let me clarify - when you create an index threshold action today, and then add the server log action, the "message" field will be blank. We do require the user to enter some message text in there. Sounds like it's all working the way it's supposed to. Once this PR is working, when you run the same scenario, instead of the "message" field being blank, it will be initialized to the value by The idea is to provide a default message for users so they don't HAVE to enter one in themselves. The message is editable, so a user can customize it however they want, but we'd like to provide a nice default value for them to start with. |
I've started to think about how we want to test this. I would like to have some kind of test that the It seems like the test should call the exported function here in the So, we'll figure out all the different cases we want to check for - and write a jest test for each of those that sets up all the parameters to that function, calls it, and checks that the result - in this case the Those notes are basically for me :-). When you get to the point of testing this, I could probably create the initial test with all the setup and stuff, and then let you fill in the rest. |
@pmuellr What I understood now is that basically we don't want that user should bother about the action message by providing him/her a resonable default action message because action message text field is a required text field. |
Correct! This |
@pmuellr On which branch should I start contributing? |
Good question - create your branch off master. |
@pmuellr You are expecting something like this with some changes, right? |
Yes. The PR itself should reference the original issue, GH and other tooling will then associate the issue and PR. We usually add a line in the commit message, which will do this:
I see I mentioned adding a "functional" test, but in previous comment #78148 (comment) mentioned that it would probably be hard to do a functional test, and we should try to do a jest test instead. Functional tests are where we run an elasticsearch index, and kibana (instrumented with extra test code), and then the tests all run in a separate process accessing kibana via HTTP. They can be complicated to build, and are slow. Jest tests are stand-alone tests of individual modules, where we create jest mocks for all the things the module depends on. Easier to write, and typically take seconds to run, and you can easily debug them in VS Code, etc. Once you get the PR up, I can add a commit to add the necessary structure for a new test, and you can add the appropriate test body, if needed. I'm not sure where the test would go, there might already be an existing test file that would be appropriate for it. The plugin name changed (which is rare) from kibana/x-pack/plugins/stack_alerts/server/alert_types/index_threshold/action_context.ts Lines 49 to 66 in cd4df4b
|
@pmuellr Is there any way I can test my changes locally? |
Here's how I do a local test of es and kibana; run the following commands to get the packages built - you'll need
Then start elasticsearch via:
Then start Kibana via:
That will start with a trial license, and Kibana will be available at https://localhost:5601/ |
I think when selecting {{context.message}} option from above drop-down it is giving the desired result. |
That's correct - we do provide a context variable which will be set to what we want the default message set to. But what we want to happen, is when the Create Alert panel appears, and an action that can use a "message" is added, instead of the Message field being blank, it should be filled in with a default mustache template, for example
To make that work, we just need to set Lines 13 to 22 in 5ed5fda
Here's an example from another plugin: kibana/x-pack/plugins/infra/public/alerting/inventory/index.ts Lines 14 to 35 in 88c0631
That's the inventory alert. When I create one of those alerts, and then add a Slack action, you can see this string pre-filled in the Message field: |
@pmuellr I have opened the PR referencing this issue. I didn't know about the contributer-agreement so I have signed the contributer-agreement after opening the PR. |
…ion (elastic#80936) * resolves elastic#78148 Adds a `defaultActionMessage` to the index threshold alert, so that the `message` parameter for actions will be pre-filled with a useful message
It was recently noted that the index threshold alertType does not provide a
defaultActionMessage
- but it seems like it should. That would go in the object returned here:kibana/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_alert_types/threshold/index.ts
Lines 13 to 22 in 6d819b7
The text was updated successfully, but these errors were encountered: