Error when trying to log metric Azure Function

Solution 1:

To handle this error we need to check the logger whether it is initialized with any other logger functions like ConsoleLogger

Also check the SO answer from saftimufti. If the log metrics are custom, then check custommetrics.

Sample code to track the metric:

TelemetryConfiguration.Active.InstrumentationKey = "your key";
TelemetryClient client = new TelemetryClient(); 
client.TrackMetric("my metric", 60);
client.GetMetric("my metric").TrackValue(89);
client.Flush();