簡體   English   中英

如何以編程方式訪問Azure Functions使用情況指標?

[英]How can I programmatically access Azure Functions usage metrics?

我想為基於消耗的Azure函數檢索精細的GB /秒使用情況數據。 我怎樣才能做到這一點?

使用數據可通過Azure Monitor REST API獲得。 有關如何使用此API的一般概述,請參見此處

相關指標是FunctionExecutionUnits 該單位為MB毫秒,因此要將其轉換為GB-秒,您需要將值除以1,024,000。 這是一個查詢示例,該查詢檢索功能應用程序的每分鍾使用情況數據:

GET /subscriptions/<subid>/resourcegroups/<rg>/providers/Microsoft.Web/sites/<appname>/providers/microsoft.insights/metrics?api-version=2016-06-01&$filter=(name.value eq 'FunctionExecutionUnits') and timeGrain eq duration'PT1M' and startTime eq 2016-12-10T00:00:00Z and endTime eq 2016-12-10T00:05:00Z and (aggregationType eq 'Total')

您將獲得類似以下內容的信息:

{
  "value": [
    {
      "data": [
        {
          "timeStamp": "2016-12-10T00:00:00Z",
          "total": 0
        },
        {
          "timeStamp": "2016-12-10T00:01:00Z",
          "total": 140544
        },
        {
          "timeStamp": "2016-12-10T00:02:00Z",
          "total": 0
        },
        {
          "timeStamp": "2016-12-10T00:03:00Z",
          "total": 0
        },
        {
          "timeStamp": "2016-12-10T00:04:00Z",
          "total": 0
        }
      ],      
      "name": {
        "value": "FunctionExecutionUnits",
        "localizedValue": "Function Execution Units"
      },
      "type": "Microsoft.Insights/metrics",
      "unit": "0"
    }
  ]
}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM