2017-06-02 37 views
2

我試圖在Application Insights Analytics中呈現兩個日期之間的差異,但時間跨度不是時間表的y軸支持的類型。在Google Analytics搜索語言中獲取總時間毫秒數

例子查詢:

customMetrics 
| extend dateDiff = timestamp - (timestamp - 1m) 
// my second date comes from customDimensions 
| summarize max(dateDiff) by bin(timestamp, 10m) 
| order by timestamp desc 
| render timechart 

我想我DateDiff的時間跨度轉換爲代表的毫秒數的整數,但我無法找到自己的文檔中的任何支持此功能。我基本上想要C#的TimeSpan.TotalMilliseconds()。

回答

4

您可以將時間範圍除以另一個時間範圍。所以,讓你可以做以下的毫秒數:

customMetrics 
| extend dateDiff = timestamp - (timestamp - 1m) 
// get total milliseconds 
| extend dateDiffMilliseconds = dateDiff/time(1ms) 
// my second date comes from customDimensions 
| summarize max(dateDiff) by bin(timestamp, 10m) 
| order by timestamp desc 
| render timechart 

更多關於日期和時間表達式可以在這裏找到:https://docs.microsoft.com/en-us/azure/application-insights/app-insights-analytics-reference#date-and-time-expressions

相關問題