diff --git a/fcm.go b/fcm.go index b1cb310..dece97f 100644 --- a/fcm.go +++ b/fcm.go @@ -463,17 +463,29 @@ func (c *Client) doSendEachInBatch( // Wait for all Validate/Send calls to finish wg.Wait() - successCount := 0 + successAmount := 0 for _, r := range responses { if r.Success { - successCount++ + successAmount++ } } + failedAmount := len(responses) - successAmount + + span.SetAttributes( + attribute.Int("res.total", len(responses)), + attribute.Int("res.sent", successAmount), + attribute.Int("res.failed", failedAmount), + ) + + if failedAmount > 0 { + span.SetStatus(codes.Error, "Got errors from method Client.Send().") + } + return MessageMultiSendResponse{ Responses: responses, - Sent: successCount, - Failed: len(responses) - successCount, + Sent: successAmount, + Failed: failedAmount, }, nil }