此跟踪消息在我们的AppInsights实例中弹出。我不知道这意味着什么,或者可能是什么原因。我很乐意提供任何有助于调试的细节。
跟踪消息
AI(内部):错误:EventSource的命令处理异常Microsoft-ApplicationInsights-Core:带有Guid 74af9f20-af6a-5582-9382-f21f674fb271的EventSource实例已经存在。
sdkVersion:dotnet:2.7.2-23439
代码示例:
[FunctionName("UpdateFunction")]
public async static Task Run(
[EventHubTrigger("Product-events", Connection = "EventHubConnectionString", ConsumerGroup = "%ConsumerGroupName%")]Message[] objMessage,
[Blob("%ProductBlobContainerName%", System.IO.FileAccess.Read, Connection = "BlobStorageConnectionString")] CloudBlobContainer productblobContainer,
[CosmosDB(databaseName: "DatabaseName", collectionName: "procudtCollectionName", ConnectionStringSetting = "DBConnectionString")]DocumentClient client,
ExecutionContext context, ILogger log)
{
TelemetryClient telemetry = TelemetryCreation.Instantiate(context);
ConcurrentBag<int> DocumentToInsert= new ConcurrentBag<int>();
ConcurrentBag<Message> DocumentToBeDeleted = new ConcurrentBag<Message>();
try
{
telemetry.TrackTrace($"{context.FunctionName} Started", SeverityLevel.Information, new Dictionary<string, string>
{
{
"PrefixName",
objMessage[0].ToString()
},
{
"NumberOfMsgs",
objMessage.Length.ToString()
}
});
await UpsertProvider(objMessage, productblobContainer, client, telemetry, DocumentToInsert, DocumentToBeDeleted);
if (DocumentToBeDeleted.Count > 0)
{
DeleteProviders.DeleteProvider(DocumentToBeDeleted.ToArray(), client, context, telemetry);
}
telemetry.TrackTrace($"{context.FunctionName} Completed", SeverityLevel.Information);
}
catch (Exception ex)
{
telemetry.TrackException(ex, new Dictionary<string, string> {
{ "Azure Background Function Name",context.FunctionName },
{ "Read Data from container > folder", productblobContainer.ToString() + ">" + objMessage[0].PrefixName.ToString()},
{ "Total Documents received", objMessage.Length.ToString() },
{ "Number of documents to insert", DocumentToInsert.Count.ToString() },
{ "List of Documents to be updated", JsonConvert.SerializeObject(DocumentToInsert).ToString() },
{ "Number of documents skipped (Location is null)", DocumentToBeDeleted.Count.ToString() },
{ "List of Documents skipped", JsonConvert.SerializeObject(DocumentToBeDeleted).ToString() },
{ "Exception Message",ex.Message },
{ "Exception InnerMessage",ex.InnerException.ToString() }
});
throw;
}
}