SOLVED

Render operator ignoring ymin and ymax values

Copper Contributor

I'm having a problem with the analytics tools, specifically the Analytics inside Application Insights as well as the Logs analytics inside a Log Analytics workspace. Regardless of query or chart type, when I specify with(ymin=x, ymax=y) values to the render function those values are ignored.

 

Example query:

Heartbeat
| summarize heartbeatPerHour = count() by bin_at(TimeGenerated, 1m, ago(30d)), Computer
| extend availablePerHour = iff(heartbeatPerHour > 0, true, false)
| summarize totalAvailableHours = countif(availablePerHour == true) by Computer 
| extend availabilityRate = totalAvailableHours*100.0/(1440 * 30)
| extend MeetsSLA = availabilityRate > 99.9
| project Computer, availabilityRate 
| render barchart with(title="Last 30 Days Availability (DEMO)", ymin=0, ymax=100)

In this particular case the expeced values are between 2-3% uptime because the system's only been logging for a day or so yet the query covers a month. The resulting graph has a range of 0-3 instead of the requested 0-100. There doesn't seem to be an "automatic range" option that I need to turn off; by all accounts including MS's documentation this should just work, yet it isn't. Result from example:

 

https://i.stack.imgur.com/TOuKT.png

 

I've tried this with queries from App Insights as well as a Log Analytics workspace, and across multiple browsers (FireFox, Chrome, IE, Edge).  I know the render operator's documentation clearly states that some user agents might not support certain features, however this looks more like no user agents support this feature.

 

Is there something I'm doing wrong, or need to do differently in order to make this work?  Is this something that isn't currently implemented?  Open to any advice or suggestions, thanks!

9 Replies

This is the example from the portal with a project-away and your chart syntax pasted in at the end

// Calculate availability rate for connected computers
Heartbeat
// bin_at is used to set the time grain to 1 hour, starting exactly 24 hours ago
| summarize heartbeatPerHour = count() by bin_at(TimeGenerated, 1h, ago(24h)), Computer
| extend availablePerHour = iff(heartbeatPerHour > 0, true, false)
| summarize totalAvailableHours = countif(availablePerHour == true) by Computer
| extend availabilityRate = totalAvailableHours*100.0/24
| project-away totalAvailableHours
| render barchart with(title="Last 30 Days Availability (DEMO)", ymin=0, ymax=100)
 
Untitled.jpg
 

@CliveWatsonThanks for getting back to me; even this demo doesn't work on my data set- I get a graph from 90 to 112 across browsers.  I suspect that the values are simply ignored; I can create a graph that looks like the demo, but only when I include a value near 0.

@the_irk

 

I have a similar issue trying to graph free space on the Logical drives of all my Azure VMs, my data set luckily has the right values to push the ymax to 100 on it's own, but it's ignoring the ymin = 0 (or any ymax other than 100) that I'm trying to define.

 

Perf
| where TimeGenerated > ago(60d)
| where ObjectName == "LogicalDisk" | where CounterName == "% Free Space"
| project CounterPath, TimeGenerated, InstanceName, CounterName, CounterValue
| summarize max(CounterValue) by bin(TimeGenerated, 12h), CounterPath
| render timechart with (title ="Virtual Machine Disk Usage", ymin=0, ymax=100)

 

 

Annotation 2019-09-30 170320.png

 

Would appreciate if anyone as any clues, tips or tricks!

@chrisbutler 

 

render is slightly different in Log Analytics to Azure Data Explorer (the docs are merged).  You need to use range or make-series - would this example work for you?

 

Perf
| where ObjectName == "LogicalDisk" | where CounterName == "% Free Space"
| make-series    pctDiskFreeSpace = max(CounterValue)  default=0 on TimeGenerated  in range(ago(60d), now(), 12h) by Computer
| render timechart title ="Virtual Machine Disk Usage" 

 

Hey @CliveWatson ,

 

That certainly sorts the Y axis range issue, thanks!

What I've lost using your code as is however is the spilt per instance name (machine/disk), it's now only showing one series per machine, rather than per disk. Pretty sure I can fix this with a bit of fooling around, I'll play with it through my day and let you know how I get on!

 

Thanks

 

@chrisbutler 

 

Its a busy chart but...this maybe?

 

Perf
| where TimeGenerated > ago(60d)
| where ObjectName == "LogicalDisk" | where CounterName == "% Free Space"
| where InstanceName has ":"  // just drive letters
| make-series pctDiskFreeSpace = max(CounterValue)  default=0 on TimeGenerated  in range(ago(60d), now(), 12h) by CounterPath
| render timechart title ="Virtual Machine Disk Usage" 

 

best response confirmed by CliveWatson (Microsoft)
Solution

@CliveWatson 

 

Hey Clive,

 

Yes it is a busy chart, I have extra WHERE statements similar to yours in the Query I'm actually using that filter our a bunch of the disks that I'm not particularly interested in (Azure VM BEK and Temp storage drives especially) however I've left those out of my post as it identifies some of the machine names (and therefore could be extrapolated to the DNS name with enough trial and error).

The issue with just using:

 

 

| where InstanceName has ":"

 

 

.......and specifying specific drive letters is that the Azure BEK encryption drives don't seem to always end up with the same drive letter, so my WHERE statement has to be a bit more complex to pick specific drives from certain machines.

 

Back on topic, the make-series statement that you suggested yesterday has worked perfectly to get the y axis to go from 0 - 100, it also allowed me to give the Y axis a custom name label which I hadn't yet worked out how to do.

 

I also used this extend and strcat() statement to create a new series for the X axis with a better name and data that reads easier in the legend:

 

 

| extend DiskName = strcat(Computer," (", InstanceName,")")

 

 

You might have noticed I then used the new series in my version of your make-series to spilt the X series up the way I wanted.

 

After all that, I've ended up with something very similar to this:

 

 

Perf
| where TimeGenerated > ago(60d)
| where ObjectName == "LogicalDisk" | where CounterName == "% Free Space"
| where InstanceName == "C:" or InstanceName == "F:" or InstanceName == "E:"
| extend DiskName = strcat(Computer," (", InstanceName,")")
| make-series DiskFreeSpace = max(CounterValue)  default=0 on TimeGenerated  in range(ago(60d), now(), 12h) by DiskName
| render timechart title ="Virtual Machine Disk Usage" 

 

 

 

Which results in this:

 

Annotation 2019-10-02 085027.png

 

The data is quite spiky as the VMs are all relatively new, so the series will smooth out over a couple of months, and I still have some work to do to try and get it to display in local time (+12 GMT NZST), move the legend to the bottom (more like the built in Azure charts) and remove the dots off the series lines....... but fundamentally, this gives me what I need.

Thank you very much for you help! I'm learning a lot as I go!

Great feed back Chris, thanks for sharing the example to help others! Best wishes Clive
Hi all,

There is now a working solution and more options in render are supported, see my example:

https://cloudblogs.microsoft.com/industry-blog/en-gb/cross-industry/2020/05/11/log-analytics-improve...
1 best response

Accepted Solutions
best response confirmed by CliveWatson (Microsoft)
Solution

@CliveWatson 

 

Hey Clive,

 

Yes it is a busy chart, I have extra WHERE statements similar to yours in the Query I'm actually using that filter our a bunch of the disks that I'm not particularly interested in (Azure VM BEK and Temp storage drives especially) however I've left those out of my post as it identifies some of the machine names (and therefore could be extrapolated to the DNS name with enough trial and error).

The issue with just using:

 

 

| where InstanceName has ":"

 

 

.......and specifying specific drive letters is that the Azure BEK encryption drives don't seem to always end up with the same drive letter, so my WHERE statement has to be a bit more complex to pick specific drives from certain machines.

 

Back on topic, the make-series statement that you suggested yesterday has worked perfectly to get the y axis to go from 0 - 100, it also allowed me to give the Y axis a custom name label which I hadn't yet worked out how to do.

 

I also used this extend and strcat() statement to create a new series for the X axis with a better name and data that reads easier in the legend:

 

 

| extend DiskName = strcat(Computer," (", InstanceName,")")

 

 

You might have noticed I then used the new series in my version of your make-series to spilt the X series up the way I wanted.

 

After all that, I've ended up with something very similar to this:

 

 

Perf
| where TimeGenerated > ago(60d)
| where ObjectName == "LogicalDisk" | where CounterName == "% Free Space"
| where InstanceName == "C:" or InstanceName == "F:" or InstanceName == "E:"
| extend DiskName = strcat(Computer," (", InstanceName,")")
| make-series DiskFreeSpace = max(CounterValue)  default=0 on TimeGenerated  in range(ago(60d), now(), 12h) by DiskName
| render timechart title ="Virtual Machine Disk Usage" 

 

 

 

Which results in this:

 

Annotation 2019-10-02 085027.png

 

The data is quite spiky as the VMs are all relatively new, so the series will smooth out over a couple of months, and I still have some work to do to try and get it to display in local time (+12 GMT NZST), move the legend to the bottom (more like the built in Azure charts) and remove the dots off the series lines....... but fundamentally, this gives me what I need.

Thank you very much for you help! I'm learning a lot as I go!

View solution in original post