DEV Community

Cover image for Notification Service, Part 8: Delivery Status and Observability
Surhid Amatya
Surhid Amatya

Posted on

Notification Service, Part 8: Delivery Status and Observability

A notification service only helps if you can tell whether it's working. Support needs to answer "did this user get the message?", and engineers want to see failures before customers report them. This last post covers what the service records and exposes.

Delivery status per notification

Every stored in-app notification has a delivery status that follows the push attempt:

  • PENDING: stored, dispatch not finished yet.
  • SENT: the push call to Firebase completed.
  • FAILED: the push call failed, or the circuit breaker was open.
  • SKIPPED: nothing to send, for example because the event had no device tokens.

Two limits are worth knowing. SENT means the provider accepted the message. It doesn't mean the device showed it. And the status tracks the push attempt, since the in-app record is what gets stored.

The status update runs asynchronously, so recording it never holds up the next event.

Read state

Separately from delivery, each notification is either UNREAD or READ. The unread count lives on a per-user summary item, so the badge number is one lookup (Part 4).

Metrics

The service counts deliveries with a single Micrometer metric, notification.delivery, which has two tags: channel (email, sms, push or in-app) and outcome (success or failure).

Tag values come from a small fixed set. They never contain user IDs, phone numbers or email addresses, which keeps cardinality low and keeps personal data out of monitoring.

Push is counted per device token, not per call. A multicast to 3 devices where 1 fails records 2 successes and 1 failure, which gives a more honest delivery rate.

The counters are exposed through Actuator in Prometheus format. Only the health, info, metrics and Prometheus endpoints are exposed. Environment, bean and heap-dump endpoints stay off.

What you can answer with this

  • Is a channel degrading? Watch the failure share per channel. A rising push failure rate next to an open circuit breaker points at Firebase.
  • Is a user missing messages? Look at that user's timeline and delivery statuses.
  • Are duplicates arriving? The idempotency check logs every duplicate event it rejects.

What isn't there

There's no click or open tracking, and no analytics pipeline, in this service. Delivery status says a message was handed to a provider, not that anyone did anything with it. Measuring engagement would need the client apps to report events, and that's a separate piece of work.

Wrapping up the series

Events come in through Kafka, one listener per type. The in-app timeline is stored idempotently in DynamoDB. Push, email and SMS go out through guarded provider clients. Bounded concurrency and circuit breakers contain failures, and statuses and metrics show what happened.

The gaps are known ones: no automatic retries for external sends, external channels are at-least-once, and there's no engagement analytics. Each has an obvious place to be added.

Top comments (0)