Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
Metabase
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Engineering Digital Service
Metabase
Commits
24c55f8a
Unverified
Commit
24c55f8a
authored
3 months ago
by
github-automation-metabase
Committed by
GitHub
3 months ago
Browse files
Options
Downloads
Patches
Plain Diff
Add more logs for sending notification (#50836) (#50849)
Co-authored-by:
Ngoc Khuat
<
qn.khuat@gmail.com
>
parent
e48212bc
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/metabase/notification/send.clj
+28
-28
28 additions, 28 deletions
src/metabase/notification/send.clj
with
28 additions
and
28 deletions
src/metabase/notification/send.clj
+
28
−
28
View file @
24c55f8a
...
...
@@ -99,7 +99,7 @@
(
log/debugf
"[Notification %d] Sent to channel %s with %d retries"
notification-id
(
handler->channel-name
handler
)
(
count
@
retry-errors
))))
(
catch
Throwable
e
(
log/errorf
e
"[Notification %d] Error sending notification!"
(
:
notification
_
id
handler
)
))))
(
log/errorf
e
"[Notification %d] Error sending notification!"
notification
-
id
))))
(
defn-
noti-handlers
[
notification-info
]
...
...
@@ -136,33 +136,33 @@
"Send the notification to all handlers synchronously. Do not use this directly, use *send-notification!* instead."
[
notification-info
:-
notification.payload/Notification
]
(
try
(
l
et
[
handlers
(
noti-handlers
notification-info
)
notification-payload
(
notification.payload/notification-payload
notification-info
)]
(
if
(
notification.payload/should-send-notification?
notification-
payload
)
(
do
(
log/debugf
"[Notification %d] Found %d
handlers
"
(
:id
notification-info
)
(
count
handlers
)
)
(
task-history/with-task-history
{
:task
"
notification-
send"
:task_details
{
:notification_id
(
:id
notification-info
)
:notification_
handlers
(
map
#
(
select-keys
%
[
:id
:channel_type
:channel_id
:template_id
])
handlers
)
}}
(
doseq
[
handler
handlers
]
(
let
[
channel-type
(
:channel_type
handler
)
messages
(
channel/render-notification
channel-type
notification-payload
(
:template
handler
)
(
:recipients
handler
))]
(
log/debugf
"[Notification %d] Got %d messages for channel %s with template %d"
(
:id
notification-info
)
(
count
messages
)
(
handler->channel-name
handler
)
(
->
handler
:template
:id
))
(
doseq
[
message
messages
]
(
log/infof
"[Notification %d] Sending message to channel %s"
(
:id
notification-info
)
(
:channel_type
handler
))
(
channel-send-retrying!
(
:id
notification-info
)
(
:payload_type
notification-info
)
handler
message
))))
(
do-after-notification-sent
notification-info
)
(
log/infof
"[Notification %d] Sent successfully"
(
:id
notification-info
)))
)
(
log/infof
"[Notification %d] Skipping"
(
:id
notification-info
))))
(
l
og/infof
"[Notification %d] Sending"
(
:id
notification-info
)
)
(
let
[
handlers
(
noti-handlers
notification-info
)]
(
task-history/with-task-history
{
:task
"
notification-
send"
:task_details
{
:notification_id
(
:id
notification-info
)
:notification_
handlers
(
map
#
(
select-keys
%
[
:id
:channel_type
:channel_id
:template_id
])
handlers
)
}}
(
let
[
notification-payload
(
notification.payload/notification-payload
notification-info
)]
(
if
(
notification.payload/should-send-notification?
notification-
payload
)
(
do
(
log/debugf
"[Notification %d] Found %d
handlers
"
(
:id
notification-info
)
(
count
handlers
)
)
(
doseq
[
handler
handlers
]
(
let
[
channel-type
(
:channel_type
handler
)
messages
(
channel/render-notification
channel-type
notification-payload
(
:template
handler
)
(
:recipients
handler
))]
(
log/debugf
"[Notification %d] Got %d messages for channel %s with template %d"
(
:id
notification-info
)
(
count
messages
)
(
handler->channel-name
handler
)
(
->
handler
:template
:id
))
(
doseq
[
message
messages
]
(
log/infof
"[Notification %d] Sending message to channel %s"
(
:id
notification-info
)
(
:channel_type
handler
))
(
channel-send-retrying!
(
:id
notification-info
)
(
:payload_type
notification-info
)
handler
message
))))
(
do-after-notification-sent
notification-info
)
(
log/infof
"[Notification %d] Sent successfully"
(
:id
notification-info
)))
(
log/infof
"[Notification %d] Skipping"
(
:id
notification-info
))))
))
(
catch
Exception
e
(
log/errorf
e
"[Notification %d] Failed to send"
(
:id
notification-info
))
(
throw
e
)))
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment