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

Support for aligning Slack message grouping intervals #1473

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

RobertSzefler
Copy link
Contributor

No description provided.

@RobertSzefler RobertSzefler force-pushed the feature/main-1744/slack-grouping-aligned-periods branch 3 times, most recently from 2936b00 to d0856f1 Compare June 25, 2024 13:48
@RobertSzefler RobertSzefler marked this pull request as ready for review June 25, 2024 14:07
@RobertSzefler RobertSzefler force-pushed the feature/main-1744/slack-grouping-aligned-periods branch 2 times, most recently from ea1839d to 40729f9 Compare June 25, 2024 14:12
@RobertSzefler RobertSzefler force-pushed the feature/main-1744/slack-grouping-aligned-periods branch from 40729f9 to 53c880a Compare July 8, 2024 08:09
if values is None:
return {"summary": SummaryNotificationModeParams()}
def validate_interval_alignment(cls, values: Dict):
if values["aligned"]:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what if values is none? wont this throw? i would handle that case first

Copy link
Contributor Author

@RobertSzefler RobertSzefler Jul 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's marked as required, so the only possible values should be True and False. If somehow it's not set (should not be possible but can be forced), I think it should indeed throw an exception. If somehow it's set to None (again, should not be possible..) it will be evaluated to False, which I think is sensible here.

def validate_interval_alignment(cls, values: Dict):
if values["aligned"]:
if values["interval"] < 24 * 3600:
if (24 * 3600) % values["interval"]:
Copy link
Contributor

@Avi-Robusta Avi-Robusta Jul 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure i understand, we allow the interval to be seconds but we dont support seconds, shouln't we change it to minutes or have it round up to the nearest minute instead of failing ? (inorder to support backward compatibility)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There will be no backwards compatibility problems, as prior users don't use the interval aligning mechanism (it's not been released yet).

Also, we support aligning on thresholds shorter than a minutes here without problem. For example, if the user specs interval as 15 seconds, the intervals will be automatically aligned at x:00, x:15, x:30, x:45 (for consecutive minutes x).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

got it

idx = 1 if resolved else 0
if now_ts - self.start_ts > interval or not self.summary_table:
# Expired or the first summary ever for this group_key, reset the data
if not self.end_ts or now_ts > self.end_ts:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what if not self.summary_table?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If end_ts is not set it means that the whole object is not initialized, and so summary_table is also not set. I basically simplified the condition here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants