[英]How can I monitor number of instances of a function app when it scales out?
一种方法是使用 App Insights 查询。 这将为您提供过去 24 小时内每 30 秒运行的不同实例的数量。
您可以根据自己的选择编辑粒度和时间跨度,但请记住,粒度越大,查询的准确度就越低,因为实例可以随时启动和关闭。
let grainTime = 30sec;
traces
| where timestamp >= ago(24h)
| summarize ['rate/minute'] = dcount(cloud_RoleInstance) by bin(timestamp, grainTime)
| render timechart
然后您可以将其固定到您的仪表板!
作为预览功能,现在我们可以让 scale controller 发出带有推理的日志,以帮助理解应用程序在不同点扩展的原因和方式。 您必须将 function 配置添加为SCALE_CONTROLLER_LOGGING_ENABLED=AppInsights:Verbose
。 然后您可以查询您的规模 controller 日志以了解此 Microsoft 文档中的原因和实例计数。
我修改了链接文档中的 kusto 查询,使其在过去 24 小时内具有 function 缩放图
traces
| where customDimensions.Category == "ScaleControllerLogs"
| where customDimensions.Action == "ScaleResult"
| where customDimensions.AppName == "my-function-app-name"
| extend currentInstanceCount = toint(customDimensions.CurrentInstanceCount)
| make-series rawInstanceCounts = max(currentInstanceCount) default=-1 on timestamp in range(ago(24h), now(), 5m)
| extend instanceCountsForwardFilled = series_fill_forward(rawInstanceCounts, -1)
| project timestamp, instanceCountsForwardFilled
| render timechart
您还可以将 controller 规模的日志发送到 Blob 存储。 在上面的示例中,我选择了 AppInsights 进行快速查询。 此外,为了避免应用洞察定价影响,请在了解扩展行为后考虑禁用配置参数。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.