-
Notifications
You must be signed in to change notification settings - Fork 16
Update SirCAL logging #786
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
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -37,14 +37,6 @@ def run_module(): | |
| params["sources"], params.get("grace", 0), LOGGER)) | ||
|
|
||
| if len(complaints) > 0: | ||
| for complaint in complaints: | ||
| LOGGER.critical(event="signal out of SLA", | ||
| message=complaint.message, | ||
| data_source=complaint.data_source, | ||
| signal=complaint.signal, | ||
| geo_types=complaint.geo_types, | ||
| last_updated=complaint.last_updated.strftime("%Y-%m-%d")) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This argument is dropped below. Was that intentional?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, in the new code it's been pulled directly into the aggregated message. |
||
|
|
||
| report_complaints(complaints, slack_notifier) | ||
|
|
||
| elapsed_time_in_seconds = round(time.time() - start_time, 2) | ||
|
|
@@ -60,12 +52,12 @@ def split_complaints(complaints, n=49): | |
| def report_complaints(all_complaints, slack_notifier): | ||
| """Post complaints to Slack.""" | ||
| if not slack_notifier: | ||
| LOGGER.info("(dry-run)") | ||
| print("(dry-run)") | ||
| return | ||
|
|
||
| for complaints in split_complaints(all_complaints): | ||
| blocks = format_complaints_aggregated_by_source(complaints) | ||
| LOGGER.info(f"blocks: {len(blocks)}") | ||
| print(f"blocks: {len(blocks)}") | ||
| slack_notifier.post_message(blocks) | ||
|
|
||
| def get_maintainers_block(complaints): | ||
|
|
@@ -108,6 +100,11 @@ def message_for_source(complaint): | |
| signal=complaint.signal, | ||
| geo_types=", ".join(complaint.geo_types)) | ||
|
|
||
| LOGGER.critical(event="Signal out of SLA", | ||
| message=message, | ||
| data_source=source, | ||
| signal_and_geo_types=signal_and_geo_types) | ||
|
|
||
| blocks.extend([ | ||
| { | ||
| "type": "divider" | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Why does this need to be moved?
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.
Old: each line-level complaint was being logged one at a time (one line per type/source/signal/geo combo)
New: only the aggregated complaint is logged (one line per type/source; signal/geo aggregated)
(this makes it much more useful for alerting)