I d\'like to add custom properties to metrics taken by Application Insights to each request of my app. For example, I want to add the user login and the ten
As mentioned by Alan, you could implement the IContextInitializer
interface to add custom properties to ALL telemetry sent by Application Insights. However, I would also suggest looking into the ITelemtryInitializer
interface. It is very similar to the context initializer, but it is called for every piece of telemetry sent rather than only at the creation of a telemetry client. This seems more useful to me for logging property values that might change over the lifetime of your app such as user and tenant related info like you had mentioned.
I hope that helps you out. Here is a blog post with an example of using the ITelemetryInitializer
.