azureazure-application-insightsazure-log-analyticsazure-monitorazure-log-analytics-workspace

How do I split Y-axis in App Insights when using timechart?


I'm trying to split the y-axis but I'm not sure if I'm making a mistake or perhaps it's just not possible in App Insights. I tried my query in both Application Insights and Azure Monitor:

App Insights

let grain = 1h;
let ago = 30d;
let dependencyName = "SQL: <servername>.database.windows.net | <database>";
dependencies
| where timestamp > ago(ago)
| where name has dependencyName
| summarize avgDuration=avg(duration) by bin(timestamp, grain)
| order by timestamp asc
| summarize DurationSeries = make_list(avgDuration), Timestamps = make_list(bin(timestamp, grain))
| extend series_fit_2lines(DurationSeries)
| project-rename LineFit = series_fit_2lines_DurationSeries_line_fit
| mv-expand Timestamps, DurationSeries, LineFit
| project todatetime(Timestamps), todecimal(DurationSeries), todecimal(LineFit)
| render timechart with (ysplit=axes, ytitle="Duration")

Azure Monitor

let grain = 1h;
let ago = 30d;
let dependencyName = "SQL: <servername>.database.windows.net | <database>";
AppDependencies
| where TimeGenerated > ago(ago)
| where Name has dependencyName
| summarize avgDuration=avg(DurationMs) by bin(TimeGenerated, grain)
| order by TimeGenerated asc
| summarize DurationSeries = make_list(avgDuration), Timestamps = make_list(bin(TimeGenerated, grain))
| extend series_fit_2lines(DurationSeries)
| project-rename LineFit = series_fit_2lines_DurationSeries_line_fit
| mv-expand Timestamps, DurationSeries, LineFit
| project todatetime(Timestamps), todecimal(DurationSeries), todecimal(LineFit)
| render timechart with (ysplit=axes, ytitle="Duration")

When I run the query from this answer the y axis doesn't split. Has something changed or does it only work in some specific product(s)?


Solution

  • The render operators (Y-Split) doesn't support to retrieve some client logs and the same happened in your case.

    An alternative workaround to split y-axis is to use Azure Monitor workbooks or create a new chart under the metrics explorer. Go to chart settings in that step of the workbook and tell it the y-axis is Durations, and it will be adding the appropriate units for you in the labels as shown below.

    enter image description here

    I have also tried retrieving the logs for other metrics to check whether the render operator y-axis split is working properly. And it worked as expected with the App requests. So, the metrics chart split has a dependence on the metrics we retrieve.

    AppRequests
    | render timechart with (ysplit=axes, ytitle="Duration")
    

    enter image description here