2016-12-13 8 views

答えて

9

使用量データは、Azure Monitor REST APIから入手できます。このAPIの使用方法の概要については、hereを参照してください。

関連するメトリックは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" 
    } 
    ] 
}