Blog Logo
TAGS

Building End-to-End Diagnostics: Activity and Span Correlation

In this series of posts, Jimmy Bogard explains how to build end-to-end diagnostics for microservices with activity and span correlation. In this particular post, he examines how to correlate start and stop events for observed events, using the MongoDB .NET Driver as an example. He shows how to use the IEventSubscriber interface and provides a DiagnosticsActivityEventSubscriber implementation that wraps the ReflectionEventSubscriber. This allows for handling multiple TEvent types, such as CommandStartedEvent, CommandSucceededEvent, and CommandFailedEvent, and correlating them with the appropriate Activity. The post also covers the OpenTelemetry Integration, ActivitySource and OpenTelemetry 1.0, as well as how to use User-Defined Context with Correlation Context for more complex scenarios.