-
Notifications
You must be signed in to change notification settings - Fork 94
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
Alerting Enhancements: Alerting Comments (Experimental) #663
Alerting Enhancements: Alerting Comments (Experimental) #663
Conversation
Signed-off-by: Dennis Toepker <toepkerd@amazon.com>
Signed-off-by: Dennis Toepker <toepkerd@amazon.com>
Signed-off-by: Dennis Toepker <toepkerd@amazon.com>
Signed-off-by: Dennis Toepker <toepkerd@amazon.com>
Signed-off-by: Dennis Toepker <toepkerd@amazon.com>
Signed-off-by: Dennis Toepker <toepkerd@amazon.com>
Signed-off-by: Dennis Toepker <toepkerd@amazon.com>
src/main/kotlin/org/opensearch/commons/alerting/action/DeleteCommentRequest.kt
Show resolved
Hide resolved
src/main/kotlin/org/opensearch/commons/alerting/action/DeleteCommentResponse.kt
Show resolved
Hide resolved
src/main/kotlin/org/opensearch/commons/alerting/action/IndexCommentRequest.kt
Show resolved
Hide resolved
src/main/kotlin/org/opensearch/commons/alerting/action/IndexCommentRequest.kt
Show resolved
Hide resolved
src/main/kotlin/org/opensearch/commons/alerting/action/IndexCommentResponse.kt
Show resolved
Hide resolved
src/main/kotlin/org/opensearch/commons/alerting/action/IndexCommentResponse.kt
Outdated
Show resolved
Hide resolved
src/main/kotlin/org/opensearch/commons/alerting/action/SearchCommentRequest.kt
Show resolved
Hide resolved
src/test/kotlin/org/opensearch/commons/alerting/action/DeleteCommentRequestTests.kt
Outdated
Show resolved
Hide resolved
src/test/kotlin/org/opensearch/commons/alerting/action/DeleteCommentResponseTests.kt
Outdated
Show resolved
Hide resolved
Signed-off-by: Dennis Toepker <toepkerd@amazon.com>
@@ -21,6 +21,9 @@ object AlertingActions { | |||
const val SUBSCRIBE_FINDINGS_ACTION_NAME = "cluster:admin/opensearch/alerting/findings/subscribe" | |||
const val GET_MONITOR_ACTION_NAME = "cluster:admin/opendistro/alerting/monitor/get" | |||
const val SEARCH_MONITORS_ACTION_NAME = "cluster:admin/opendistro/alerting/monitor/search" | |||
const val INDEX_COMMENT_ACTION_NAME = "cluster:admin/opendistro/alerting/alerts/comments/write" |
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.
no need for opendistro
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.
check latest actions for naming convention
content = sin.readString(), | ||
createdTime = sin.readInstant(), | ||
lastUpdatedTime = sin.readOptionalInstant(), | ||
user = if (sin.readBoolean()) { |
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.
use ternary op for better readability
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.
Kotlin does not seem to have a ternary operator (https://discuss.kotlinlang.org/t/ternary-operator/2116), and favors directly using if else as it is more idiomatic. I can make it one line to resemble a ternary operator structure more.
val content: String, | ||
val createdTime: Instant, | ||
val lastUpdatedTime: Instant?, | ||
val user: User? |
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.
will this be optional field?
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.
lastUpdatedTime
will be an optional field because upon a Comment's creation, it will not have a last updated time, only a created time. lastUpdatedTime
is only assigned when a User makes a subsequent call to the same Comment to edit/update it. user
will also be an optional field because there's no guarantee that the Security Plugin will be installed.
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.
nullable because of security and without security
if you've have a github issue for this feature, add it in PR description for ref |
Signed-off-by: Dennis Toepker <toepkerd@amazon.com>
Looks good to me as long as other folks' comments are addressed. I've resolved the comments I left. |
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.
@toepkerd Oh actually, could you confirm whether this should be merged to main
or a feature branch?
src/main/kotlin/org/opensearch/commons/alerting/action/DeleteCommentRequest.kt
Outdated
Show resolved
Hide resolved
src/main/kotlin/org/opensearch/commons/alerting/action/DeleteCommentResponse.kt
Show resolved
Hide resolved
src/main/kotlin/org/opensearch/commons/alerting/action/IndexCommentRequest.kt
Show resolved
Hide resolved
src/main/kotlin/org/opensearch/commons/alerting/action/SearchCommentRequest.kt
Show resolved
Hide resolved
src/main/kotlin/org/opensearch/commons/alerting/action/SearchCommentRequest.kt
Show resolved
Hide resolved
val content: String, | ||
val createdTime: Instant, | ||
val lastUpdatedTime: Instant?, | ||
val user: User? |
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.
nullable because of security and without security
Signed-off-by: Dennis Toepker <toepkerd@amazon.com>
@@ -31,6 +31,12 @@ data class DataSources( | |||
/** Configures a custom index pattern for alertHistoryIndex alias.*/ | |||
val alertsHistoryIndexPattern: String? = "<.opendistro-alerting-alert-history-{now/d}-1>", // AlertIndices.ALERT_HISTORY_INDEX_PATTERN | |||
|
|||
/** Configures a custom index alias to store comments associated with alerts.*/ | |||
val commentsIndex: String = ".opensearch-alerting-comments-history-write", // AlertIndices.COMMENTS_HISTORY_WRITE_INDEX |
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.
this should be optional??
existing usage of dataSources like SEcurity analytics will not be setting this field.
* initial commit, functional but needs refactoring Signed-off-by: Dennis Toepker <toepkerd@amazon.com> * added lastUpdatedTime to Note object Signed-off-by: Dennis Toepker <toepkerd@amazon.com> * changed name from alert id to entity id Signed-off-by: Dennis Toepker <toepkerd@amazon.com> * import cleanup Signed-off-by: Dennis Toepker <toepkerd@amazon.com> * changing name from Alerting Notes to Alerting Comments Signed-off-by: Dennis Toepker <toepkerd@amazon.com> * misc fixes and cleanup Signed-off-by: Dennis Toepker <toepkerd@amazon.com> * adding unit test coverage Signed-off-by: Dennis Toepker <toepkerd@amazon.com> * misc cleanup Signed-off-by: Dennis Toepker <toepkerd@amazon.com> * misc review-based cleanup Signed-off-by: Dennis Toepker <toepkerd@amazon.com> * added validation exception messages Signed-off-by: Dennis Toepker <toepkerd@amazon.com> --------- Signed-off-by: Dennis Toepker <toepkerd@amazon.com> Co-authored-by: Dennis Toepker <toepkerd@amazon.com> (cherry picked from commit acaa844) Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
* initial commit, functional but needs refactoring * added lastUpdatedTime to Note object * changed name from alert id to entity id * import cleanup * changing name from Alerting Notes to Alerting Comments * misc fixes and cleanup * adding unit test coverage * misc cleanup * misc review-based cleanup * added validation exception messages --------- (cherry picked from commit acaa844) Signed-off-by: Dennis Toepker <toepkerd@amazon.com> Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Dennis Toepker <toepkerd@amazon.com>
Description
Common utils additions for the Alerting Comments experimental feature
Issues Resolved
opensearch-project/alerting#1500: direct request for adding Alert notes when acknowledging an Alert and showing who acknowledged an Alert.
This feature intends to be a superset of this ask, though adding comments or notes specifically when acknowledging an Alert will be a later extension.
Check List
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.