Skip to content
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

[FEATURE] Support configuring timezone for notification message #1744

Open
AWSHurneyt opened this issue Dec 9, 2024 · 0 comments
Open

[FEATURE] Support configuring timezone for notification message #1744

AWSHurneyt opened this issue Dec 9, 2024 · 0 comments
Labels
enhancement New feature or request good first issue Good for newcomers untriaged

Comments

@AWSHurneyt
Copy link
Collaborator

What solution would you like?
Currently, the alerting backend only supports sending notification messages with time values (e.g., trigger start and end times) in UTC.

The alerting plugin is just using the notifications plugin to send a string (the message) to the receiving notification channel; information about the recipient (e.g., the recipient's timezone) isn't shared with the plugin from the receiving webhook.

Since each action can only send a notification to a single notification channel, support could be added for configuring a timezone at the action level. Anyone to receive the notification would then see the time value converted to that timezone.

To support custom timezones:

  1. An additional field (e.g., timezone)could be added to the action data model (link) with a default value of UTC.
  2. The various asTemplateArgs() functions found throughout the alerting plugin (trigger execution context example) are what compile the values that get added to the notifications message ctx variable. These functions could be refactored, where appropriate, to use the timezone from the action when converting the Instant into a human-friendly string.
  3. The frontend could then be refactored to add a timezone selection dropdown menu to the action configuration panel (default value of UTC).
    Screenshot 2024-12-09 at 3 18 31 PM

Do you have any additional context?
For extra context:

  1. The java.time.Instant object used by the plugin automatically uses UTC for the toString() function - https://docs.oracle.com/javase/8/docs/api/java/time/Instant.html
  2. This line is the actual message string that's send to the notifications plugin - https://github.com/opensearch-project/alerting/blob/main/alerting/src/main/kotlin/org/opensearch/alerting/MonitorRunner.kt#L66
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers untriaged
Projects
None yet
Development

No branches or pull requests

1 participant