尝试以编程方式从Azure Management API中为Web应用程序检索性能指标定义和值
使用最新的Nuget包(基于Rest)进行Azure管理:程序集Microsoft.Azure.Management.Websites.dll,v1.0.0.2
ctx.Sites.GetSiteMetrics返回内部服务器错误,无论我传入过滤器属性的参数是什么
var defs = ctx.Sites.GetSiteMetrics(site.AzureResourceGroup, site.AzureResourceName, false,
string.Format("$filter=(startTime eq '{0}')",
DateTime.UtcNow.Subtract(TimeSpan.FromMinutes(10)).ToString("yyyy-MM-ddThh:mm:ssZ"))).Value;
ctx.Sites.GetSiteMetricDefinitions返回15个空对象(不正确的序列化?)
早期版本的库(基于TokenCloudCredential)返回更加模糊的错误(未找到资源)
有什么想法吗?
根据要求,GetSiteMetricDefinitions调用的fiddler输出(看起来确实是不正确的序列化?)
{
"id":"/subscriptions/xxxxxxxxx-xxxx-xxxx-xxxx-4384e4cfd2d6/resourceGroups/ARMTest/providers/Microsoft.Web/sites/WebAppArmTest1/metricdefinitions",
"value":[
{
"name":{
"value":"CpuTime",
"localizedValue":"CPU Time"
},
"unit":"Seconds",
"primaryAggregationType":"Total",
"resourceUri":null,
"metricAvailabilities":[
{
"timeGrain":"PT1M",
"retention":"P2D"
},
{
"timeGrain":"PT1H",
"retention":"P30D"
},
{
"timeGrain":"P1D",
"retention":"P90D"
}
],
"properties":[
]
},
{
"name":{
"value":"Requests",
"localizedValue":"Requests"
},
"unit":"Count",
"primaryAggregationType":"Total",
"resourceUri":null,
"metricAvailabilities":[
{
"timeGrain":"PT1M",
"retention":"P2D"
},
{
"timeGrain":"PT1H",
"retention":"P30D"
},
{
"timeGrain":"P1D",
"retention":"P90D"
}
],
"properties":[
]
},
{
"name":{
"value":"BytesReceived",
"localizedValue":"Data In"
},
"unit":"Bytes",
"primaryAggregationType":"Total",
"resourceUri":null,
"metricAvailabilities":[
{
"timeGrain":"PT1M",
"retention":"P2D"
},
{
"timeGrain":"PT1H",
"retention":"P30D"
},
{
"timeGrain":"P1D",
"retention":"P90D"
}
],
"properties":[
]
},
{
"name":{
"value":"BytesSent",
"localizedValue":"Data Out"
},
"unit":"Bytes",
"primaryAggregationType":"Total",
"resourceUri":null,
"metricAvailabilities":[
{
"timeGrain":"PT1M",
"retention":"P2D"
},
{
"timeGrain":"PT1H",
"retention":"P30D"
},
{
"timeGrain":"P1D",
"retention":"P90D"
}
],
"properties":[
]
},
{
"name":{
"value":"Http2xx",
"localizedValue":"Http 2xx"
},
"unit":"Count",
"primaryAggregationType":"Total",
"resourceUri":null,
"metricAvailabilities":[
{
"timeGrain":"PT1M",
"retention":"P2D"
},
{
"timeGrain":"PT1H",
"retention":"P30D"
},
{
"timeGrain":"P1D",
"retention":"P90D"
}
],
"properties":[
]
},
{
"name":{
"value":"Http3xx",
"localizedValue":"Http 3xx"
},
"unit":"Count",
"primaryAggregationType":"Total",
"resourceUri":null,
"metricAvailabilities":[
{
"timeGrain":"PT1M",
"retention":"P2D"
},
{
"timeGrain":"PT1H",
"retention":"P30D"
},
{
"timeGrain":"P1D",
"retention":"P90D"
}
],
"properties":[
]
},
{
"name":{
"value":"Http401",
"localizedValue":"Http 401"
},
"unit":"Count",
"primaryAggregationType":"Total",
"resourceUri":null,
"metricAvailabilities":[
{
"timeGrain":"PT1M",
"retention":"P2D"
},
{
"timeGrain":"PT1H",
"retention":"P30D"
},
{
"timeGrain":"P1D",
"retention":"P90D"
}
],
"properties":[
]
},
{
"name":{
"value":"Http403",
"localizedValue":"Http 403"
},
"unit":"Count",
"primaryAggregationType":"Total",
"resourceUri":null,
"metricAvailabilities":[
{
"timeGrain":"PT1M",
"retention":"P2D"
},
{
"timeGrain":"PT1H",
"retention":"P30D"
},
{
"timeGrain":"P1D",
"retention":"P90D"
}
],
"properties":[
]
},
{
"name":{
"value":"Http404",
"localizedValue":"Http 404"
},
"unit":"Count",
"primaryAggregationType":"Total",
"resourceUri":null,
"metricAvailabilities":[
{
"timeGrain":"PT1M",
"retention":"P2D"
},
{
"timeGrain":"PT1H",
"retention":"P30D"
},
{
"timeGrain":"P1D",
"retention":"P90D"
}
],
"properties":[
]
},
{
"name":{
"value":"Http406",
"localizedValue":"Http 406"
},
"unit":"Count",
"primaryAggregationType":"Total",
"resourceUri":null,
"metricAvailabilities":[
{
"timeGrain":"PT1M",
"retention":"P2D"
},
{
"timeGrain":"PT1H",
"retention":"P30D"
},
{
"timeGrain":"P1D",
"retention":"P90D"
}
],
"properties":[
]
},
{
"name":{
"value":"Http4xx",
"localizedValue":"Http 4xx"
},
"unit":"Count",
"primaryAggregationType":"Total",
"resourceUri":null,
"metricAvailabilities":[
{
"timeGrain":"PT1M",
"retention":"P2D"
},
{
"timeGrain":"PT1H",
"retention":"P30D"
},
{
"timeGrain":"P1D",
"retention":"P90D"
}
],
"properties":[
]
},
{
"name":{
"value":"Http5xx",
"localizedValue":"Http Server Errors"
},
"unit":"Count",
"primaryAggregationType":"Total",
"resourceUri":null,
"metricAvailabilities":[
{
"timeGrain":"PT1M",
"retention":"P2D"
},
{
"timeGrain":"PT1H",
"retention":"P30D"
},
{
"timeGrain":"P1D",
"retention":"P90D"
}
],
"properties":[
]
},
{
"name":{
"value":"MemoryWorkingSet",
"localizedValue":"Memory working set"
},
"unit":"Bytes",
"primaryAggregationType":"Total",
"resourceUri":null,
"metricAvailabilities":[
{
"timeGrain":"PT1M",
"retention":"P2D"
},
{
"timeGrain":"PT1H",
"retention":"P30D"
},
{
"timeGrain":"P1D",
"retention":"P90D"
}
],
"properties":[
]
},
{
"name":{
"value":"AverageMemoryWorkingSet",
"localizedValue":"Average memory working set"
},
"unit":"Bytes",
"primaryAggregationType":"Average",
"resourceUri":null,
"metricAvailabilities":[
{
"timeGrain":"PT1M",
"retention":"P2D"
},
{
"timeGrain":"PT1H",
"retention":"P30D"
},
{
"timeGrain":"P1D",
"retention":"P90D"
}
],
"properties":[
]
},
{
"name":{
"value":"AverageResponseTime",
"localizedValue":"Average Response Time"
},
"unit":"Seconds",
"primaryAggregationType":"Average",
"resourceUri":null,
"metricAvailabilities":[
{
"timeGrain":"PT1M",
"retention":"P2D"
},
{
"timeGrain":"PT1H",
"retention":"P30D"
},
{
"timeGrain":"P1D",
"retention":"P90D"
}
],
"properties":[
]
}
]
}