Developing Solutions for Microsoft Azure: Dependency Tracking with Azure Application Insights

Dependency Telemetry Properties for Third-Party Database Calls

Question

You are developing an ASP.NET Core Web API web service.

The web service uses Azure Application Insights for all telemetry and dependency tracking.

The web service reads and writes data to a database other than Microsoft SQL Server.

You need to ensure that dependency tracking works for calls to the third-party database.

Which two dependency telemetry properties should you use? Each correct answer presents part of the solution.

NOTE: Each correct selection is worth one point.

Answers

Explanations

Click on the arrows to vote for the correct answer

A. B. C. D. E.

BD.

Example: public async Task Enqueue(string payload) { // StartOperation is a helper method that initializes the telemetry item // and allows correlation of this operation with its parent and children.

var operation = telemetryClient.StartOperation<DependencyTelemetry>("enqueue " + queueName); operation.Telemetry.Type = "Azure Service Bus"; operation.Telemetry.Data = "Enqueue " + queueName; var message = new BrokeredMessage(payload); // Service Bus queue allows the property bag to pass along with the message.

// We will use them to pass our correlation identifiers (and other context) // to the consumer.

message.Properties.Add("ParentId", operation.Telemetry.Id); message.Properties.Add("RootId", operation.Telemetry.Context.Operation.Id); Reference: https://docs.microsoft.com/en-us/azure/azure-monitor/app/custom-operations-tracking.

When using Azure Application Insights to track dependencies, it is important to ensure that all external dependencies, including those made to a third-party database, are tracked. To enable dependency tracking for calls to the third-party database, you can use the following two dependency telemetry properties:

D. Telemetry.Context.Operation.Id E. Telemetry.Context.Session.Id.

The explanation for each option is as follows:

D. Telemetry.Context.Operation.Id: This property is used to group related telemetry events together as part of a larger operation. When a request is made to the web service, Application Insights generates a unique operation ID for that request, which is used to correlate all telemetry events associated with that request. By including this property in dependency telemetry, you can ensure that calls to the third-party database are grouped together with other telemetry events for that request.

E. Telemetry.Context.Session.Id: This property is used to identify a specific user session. When a user interacts with the web service, a new session ID is generated for each session. By including this property in dependency telemetry, you can ensure that calls to the third-party database are associated with the correct user session.

The other options, A, B, and C are not related to dependency tracking:

A. Telemetry.Context.Cloud.RoleInstance: This property is used to identify the role instance for cloud services.

B. Telemetry.Id: This property is used to identify a unique telemetry event.

C. Telemetry.Name: This property is used to specify the name of the telemetry event.

Therefore, the correct options for this question are D and E.