我想使用Application Insights来监控链接多个Azure功能的逻辑应用程序。我希望链尽可能安全,如果出现问题,我想让http请求无法被函数正确处理。 我想我可以在出现问题时从Application Insights发出警报,但是我不知道如何将失败的消息发送到blob或“失败的消息队列”。
Application Insights Alert是否可以成为将数据添加到blob的函数的触发器?
答案 0 :(得分:1)
可以从警报刀片中定义具有功能触发操作类型的操作组。如下图所示,无法在该功能上启用App Service Auth。
您还可以从Google Analytics中创建的自定义查询中提醒警报。例如。搜索包含单词“Error”的最后一小时的所有跟踪日志:
traces |
where message contains "Error" and timestamp >= ago(1h)
保存查询并创建新的警报规则,并将该查询用作警报标准。
访问您的函数中的事件内容:
HttpRequestMessageFeature feature = new HttpRequestMessageFeature(request.HttpContext);
HttpRequestMessage req = feature.HttpRequestMessage;
var content = await req.Content.ReadAsStringAsync();
然后使用WindowsAzure.Storage
SDK将内容推送到blob。
var blobClient = storageAccount.CreateCloudBlobClient();
var container = blobClient.GetContainerReference(containerName);
var blockBlob = container.GetBlockBlobReference(fileName);
await blockBlob.UploadTextAsync(content).ConfigureAwait(false);