POC to have end-to-end correlation stitching operations across services together in the Azure Application Insights Application Map.
Provide end-to-end correlation stitching operations across services together in the Azure Application Insights Application Map.
When creating an order, the following flow occurs:
As per the guidance:
Application Insights defines a data model for distributed telemetry correlation. To associate telemetry with a logical operation, every telemetry item has a context field called
operation_Id
. This identifier is shared by every telemetry item in the distributed trace. So even if you lose telemetry from a single layer, you can still associate telemetry reported by other components.A distributed logical operation typically consists of a set of smaller operations that are requests processed by one of the components. These operations are defined by request telemetry. Every request telemetry item has its own
id
that identifies it uniquely and globally. And all telemetry items (such as traces and exceptions) that are associated with the request should set theoperation_parentId
to the value of the requestid
.Every outgoing operation, such as an HTTP call to another component, is represented by dependency telemetry. Dependency telemetry also defines its own
id
that's globally unique. Request telemetry, initiated by this dependency call, uses thisid
as itsoperation_parentId
.You can build a view of the distributed logical operation by using
operation_Id
,operation_parentId
, andrequest.id
withdependency.id
. These fields also define the causality order of telemetry calls.
This means that we are handling the operation ID (aka operation_Id
) correctly today, but we need to:
operation_ParentId
)Learn more in this example.
Here is what the end-to-end correlation across component looks like:
When looking at the telemetry tree, it looks as following:
Before you can run this, you need to:
orders
in the Azure Service Bus namespacedocker-compose.override.yml
file and set the Application Insights instrumentation key and Service Bus connectionstringdocker compose up
from the folder where the docker-compose.yml
file is locatedYou can use a tool like Postman to perform API requests, or you can use the Swagger UI page which is available at
localhost:787/api/docs
for the Market API and atlocalhost:789/api/docs
for the Bacon API.
{
"amount": 2
}
💡 This is currently achieved by using the Azure Application Insights SDK. We will port this to purely
TelemetryClient
to know where we need to track what.
Here is what the end-to-end correlation across component looks like:
When looking at the telemetry tree, it looks as following:
You can download the raw telemetry here.
operationId
is identical in every component, so we have to propogate it to correlate across components.id
of the dependency in the initial component must match the operationParentId
of the request in the second component.We can leverage the same capabilities through Serilog if we get inspiration from the Azure Application Insights SDK:
OperationCorrelationTelemetryInitializer
RequestTrackingTelemetryModule
OperationNameTelemetryInitializer
AuthenticatedUserIdTelemetryInitializer
:
HttpClient
Some of the action items can be easily found by searching for TODO: Contribute Upstream
or using the Task List.
None at the moment.