-
Notifications
You must be signed in to change notification settings - Fork 79
Add HTTP Input type for monitors (Inherited from PR #82) #347
Conversation
* Adding new type of input for Monitors - HttpInput * change the field name of 'params' field of HttpInput to be consistent with CustomWebhook Co-authored-by: Annie Lee <[email protected]>
…cause it returns boolean value
| scheme = clusterHosts[clusterIndex].schemeName, | ||
| host = clusterHosts[clusterIndex].hostName, | ||
| port = clusterHosts[clusterIndex].port, | ||
| path = "_cat/plugins", |
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.
I changed the path from _cluster/health to _cat/plugins ( Here is the code in the original PR)
| const val HOST_FIELD = "host" | ||
| const val PORT_FIELD = "port" | ||
| const val PATH_FIELD = "path" | ||
| const val PARAMS_FIELD = "query_params" |
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.
I changed the name of PARAMS_FIELD from "params" to "query_params". (Here is the code in the original PR)
| // httpasyncclient 4.1.4 depends on httpcore-nio 4.4.10 which causes the conflict | ||
| force "org.apache.httpcomponents:httpcore-nio:4.4.12" | ||
| // httpasyncclient 4.1.4 depends on httpclient 4.5.6 which causes the conflict | ||
| force "org.apache.httpcomponents:httpclient:${versions.httpclient}" |
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.
I changed the version number of some dependencies and add some comments (Here is the code in the original PR)
| // Verify parameters are valid during creation | ||
| init { | ||
| require(areFieldsValid()) { | ||
| "Either one of url or scheme + host + port + path + params can be set." |
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.
I changed the function name from validateFields to areFieldsValid, and removed a duplicate + from the error message. (Here is the code in the original PR)
|
The feature is replaced by ClusterMetrics monitor (PR: opensearch-project/alerting#221), and is released in OpenSearch 1.3.0 (Release notes: https://github.com/opensearch-project/opensearch-build/blob/1.3.0/release-notes/opensearch-release-notes-1.3.0.md#opensearch-alerting). 🎉 |
Issue #, if available:
#47
Description of changes:
This PR is inherited from #82 here are the additional changes. I have also marked them in the code.
paramstoquery_paramsin the JSON string builder in funtionHttpInput:toXContent()to be able to reuseURLInfocomponent for the custom webhook URL in Kibana plugintest monitor HttpInput with non JSON responsedue to the hidden index changealerting/build.gradle, add comments for the new configuration of the dependency versions, and removehttpasyncclientfrom dependency as it has been declared inalerting-coresubprojectMinor changes:
validateFieldstoareFieldsValidto because it returns a boolean valuevalidateFields()validation functionimportclasses to reduce file differences of the PRAs the original PR has been merged (but reverted later on: #161, #162), I assume all the changes are reviewed, so I changed the code as less as possible.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.