Skip to content

Commit

Permalink
Send metrics for notifications delivered by API
Browse files Browse the repository at this point in the history
This metric is the complement of the same metrics sent from the
notifications controller.
The metrics sent by the notifications model correspond to the API
requests, whereas the metrics sent by the controller correspond to the
UI requests (bulk update).
  • Loading branch information
saraycp committed May 19, 2022
1 parent 497bbe8 commit 9576788
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/api/app/models/notification.rb
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,11 @@ def track_notification_creation
"notification.create,notifiable_type=#{notifiable_type},web=#{web},rss=#{rss} value=1")
end

# This is only called when the request come from the API. The UI performs 'update_all' that does not trigger callbacks.
# This metrics complements the same metrics tracked in Webui::Users::NotificationsController#send_notifications_information_rabbitmq
def track_notification_delivered
RabbitmqBus.send_to_bus('metrics',
"notification.delivered,notifiable_type=#{notifiable_type},web=#{web},rss=#{rss} value=1")
"notification,action=#{delivered ? 'read' : 'unread'} value=1")
end
end

Expand Down

0 comments on commit 9576788

Please sign in to comment.