in src/main/scala/com/gu/mobile/content/notifications/lib/MessageSender.scala [28:44]
private def sendNotification(notification: ContentAlertPayload): Unit = {
val start = System.currentTimeMillis()
lazy val duration = System.currentTimeMillis() - start
if (config.guardianNotificationsEnabled) {
logger.info(s"Sending notification $notification")
apiClient.send(notification) match {
case Right(id) =>
logger.info(s"Successfully sent notification $id for : ${notification.title}")
metrics.send(MetricDataPoint(name = "SendNotificationLatency", value = duration.toDouble, unit = StandardUnit.Milliseconds))
case Left(error) =>
logger.error(s"Error sending notification: $notification. error: $error")
metrics.send(MetricDataPoint(name = "SendNotificationErrorLatency", value = duration.toDouble, unit = StandardUnit.Milliseconds))
}
}
}