We use cookies or similar technologies to personalize your online experience and tailor marketing to you. Many of our product features require cookies to function properly. Your use of this site and online product constitutes your consent to these personalization technologies. Read our Privacy Policy to find out more.



What can you observe?

A publish and subscribe model is a specialized form of event-driven model where subscriptions to resources can lead to multiple asynchronous events from the publisher. In this case, we are taking the perspective of the subscriber instead of the publisher, and very often can contain multiple different subscription with multiple events published per subscription, often handled in parallel. (From a publisher point of view, these usually look like Service Calls.) To set up observability for a pub/sub system then implies observing the sequencing of each of these commands and the subsequent work done resulted from each event.

What is the top of the stack?

There are two sites in this scenarios, the first in places where resources are subscribed to and unsubscribed from, and second in places where the consumer is being notified of events and responding to them.

What is the unit of work?

We can treat each subscribe or unsubscribe as a unit of work, and each event handled and the work done after as a unit of work,

What context is useful to capture?

What comes next?

Now that the events are being instrumented, try connecting the subscription with the events using tracing semantics. The subscribe and unsubscribe on a particular topic should be correlated and can act as a parent span to multiple published events of the same subscription. You can also tie multiple different subscriptions together using the session as a virtual root. In practice, this looks a lot like a pipeline.