Отслеживание запросов TelemetryClient от начала до конца с трассировкой - PullRequest
0 голосов
/ 19 июня 2019

Можно отследить запрос вместе с любыми трассами, которые я добавил через TelemetryClient.Короче говоря, я использую:

var id = "a very unique id";
using (telemetryClient.StartOperation<RequestTelemetry>("Name", id, id))
{
telemetryClient.Trace("I have done something", new Dictionary<string, string> { { "uniqueId", id } );
telemetryClient.Trace("I am doing something else", new Dictionary<string, string> { { "uniqueId", id } );
}

Проблема здесь в том, что operationId не установлен, ни operationParentId.

Возможно, я использую это неправильно, но я надеялся сделать join между traces и requests на operationParentId, чтобы я мог получить полную картину.

1 Ответ

1 голос
/ 20 июня 2019

Я предлагаю вам использовать последнюю версию Microsoft.ApplicationInsights 2.10.0

Когда установлен последний пакет nuget, я проверяю предоставленный вами код, OperationId / operationParentId установлены правильно.

Код:

        static void Main(string[] args)
        {    
            TelemetryClient client = new TelemetryClient() { InstrumentationKey = "xxxx" };

            string id = "b123456";
            using (client.StartOperation<RequestTelemetry>("op_name",id,id))
            {
                client.TrackTrace("I have done something", new Dictionary<string, string> { { "my_uniqueId", id } } );
                client.TrackTrace("I am doing something else", new Dictionary<string, string> { { "my_uniqueId", id } } );    
            }    

            Console.ReadLine();
        }

На портале:

Запрос телеметрии:

enter image description here

Телеметрия трассировки:

enter image description here

...