As far as I know, the TelemetryClient.TrackException could add custom properties.
After adding these properties, you could find values in the azure insights portal.
More details about how to add the custom properties in web api, you could refer to below codes:
public class AiExceptionLogger : ExceptionLogger
{
public override void Log(ExceptionLoggerContext context)
{
if (context != null && context.Exception != null)
{//or reuse instance (recommended!). see note above
var ai = new TelemetryClient();
//Here you need get the CustomerId, JobId, and other. For example get the current user id
string re = HttpContext.Current.User.Identity.Name;
// Set up some properties:
//Here you need get what you need and add them to the properties
var properties = new Dictionary<string, string> {{ "Users", "vvvvv" } };
// Send the exception telemetry:
ai.TrackException(context.Exception, properties);
}
base.Log(context);
}
}
You could find it in the See all properties as below:

But I have other question, How can I do to send data from my controller to "AiExceptionLogger". i.e: I have my controller a POST method Post(user, jobId), I want to add jobId to TrackException. Note: I don't want to use try{} catch(){} for every method in my controller, If I can add that information to context, it will be grat!. Thanks!
According to your description, I suggest you could try another way registered a filter and override the OnActionExecuted method.
In this method, you could firstly check the Exception is null. If the exception isn't null, you could get the ActionArguments from the HttpActionExecutedContext.
Then you could add this arguments in the properties and send them to the azure Application Insights.
More details, you could refer to below codes:
WebApiConfig:
public static void Register(HttpConfiguration config)
{
// Web API configuration and services
// Web API routes
config.MapHttpAttributeRoutes();
config.Routes.MapHttpRoute(
name: "DefaultApi",
routeTemplate: "api/{controller}/{id}",
defaults: new { id = RouteParameter.Optional }
);
//config.Services.Add(typeof(IExceptionLogger), new AiExceptionLogger());
config.Filters.Add(new AAA());
}
public class AAA : ActionFilterAttribute
{
public override void OnActionExecuted(HttpActionExecutedContext actionExecutedContext)
{
if (actionExecutedContext.Exception != null)
{
var ai = new TelemetryClient();
//here get the arguments
string d1 = (string)actionExecutedContext.ActionContext.ActionArguments["id"];
var properties = new Dictionary<string, string> { { "Users", d1 } };
ai.TrackException(actionExecutedContext.Exception, properties);
}
base.OnActionExecuted(actionExecutedContext);
}
}
Result:


TelemetryInitializers
, see docs.microsoft.com/en-us/azure/application-insights/…. You can add custom properties to all items like requests and exceptions etc. Its up to you to inject the proper values though. You could create a factory class that does that for your JobId etc. It depends how you can access that information. - Peter Bons