0

I have a trace policy in my API and I want to read the content of the trace into Application Insight. App Insight is associated with my APIM instance because I can see all traces into AppInsight.

I can see that a "trace" record is added to Application Insight. But what I'm looking for is the ability to add a custom property into the "Request" trace. Is it possible?

David GROSPELIER
  • 772
  • 1
  • 9
  • 35

1 Answers1

0

It looks like adding new properties to existing request is possible using ITelemetryInitializer as mentioned here.

var request = new RequestTelemetry();
request.Name = "My Request";
request.Context.Properties["User_Name"] = userName;
request.Context.Properties["Tenant_Code"] = tenantCode;
var client = new TelemetryClient();
client.TrackRequest(request);

Use telemetry initializers to enrich telemetry with additional information and/or to override telemetry properties set by the standard telemetry modules. Refer to this issue.

Joey Cai
  • 18,968
  • 1
  • 20
  • 30