Vaybhaw
Vaybhaw

Reputation: 11

Adding custom properties for all telemetry log type in Application Insights metrics

I d'like to add custom properties to metrics taken by Application Insights to each type of telemetry log of my app. Which is

  1. Custom Event
  2. Request 3.Exception
  3. Trace
  4. Page View
  5. Dependency

Want to map Evn name for each and every activity which is logged in the Application Insights

To help out and filter logs no the basis of Env tag for ex QA, UAT and Prod

Am is to log all the environment log into single AI instance and use them and query filtering via log

Using .Enrich.WithProperty(env, 'QA') property did not workout for all type of log events.

Upvotes: 0

Views: 1126

Answers (1)

SaiSakethGuduru
SaiSakethGuduru

Reputation: 2440

Below is the Sample code for adding custom events in Telemetry event.

 var request = new RequestTelemetry();
 var client = new TelemetryClient();
 request.Name = "My Request";
 client.TrackRequest(request);

For cmplete information you can refer this So thread which has related discussions.

Also, as suggested by DeepDave-MT even this Microsoft Document will also help.

Upvotes: 0

Related Questions