Hey I created canvas widget using below script but widgets failed to load in 8.4.2 Version

I'm facing an issue of failed loading of widgets and even assets like images when elasticsearch moves to 8.3.2 to 8.4.2.

I have two kinds of widgets like Status count and percentage of status (Also handle divide by zero) in canvas
1st Type of Query:

kibana
| selectFilter
| essql 
  query="SELECT COUNT(DISTINCT Hex_Hostname) AS UP FROM \"heartbeat-*\" WHERE monitor.name = 'Core Switch' AND monitor.status = 'up' AND \"@timestamp\" > NOW() - INTERVAL 5 MINUTES"
| math "UP"
| metric "UP" 
  metricFont={font size=48 family="'Open Sans', Helvetica, Arial, sans-serif" color={if {all {gt 0}} then="#7BBB58" else="#C30721"} align="center" lHeight=48} 
  labelFont={font size=14 family="'Open Sans', Helvetica, Arial, sans-serif" color={if {all {gt 0}} then="#7BBB58" else="#C30721"} align="center"} metricFormat="0,0.[000]"
| render

2nd Query

kibana

| selectFilter

| essql

query="SELECT COUNT(DISTINCT Hex_Hostname) AS UP FROM \"heartbeat-*\" WHERE monitor.name = 'Access Points' AND monitor.status = 'up' AND \"@timestamp\" > NOW() - INTERVAL 5 MINUTES"

| var_set name="UPvar" value={getCell "UP"}

| filters

| essql

query="SELECT COUNT(DISTINCT Hex_Hostname) AS total FROM \"heartbeat-*\" WHERE monitor.name = 'Access Points' AND \"@timestamp\" > NOW() - INTERVAL 5 MINUTES"

| var_set name="totalvar" value={getCell "total"}

| if {any {getCell "total" | compare "lt" to=0.01}} then={var_set name="totalvar" value=1}

| math {string {var "UPvar"} " / " {var "totalvar"}}

| metric "Access Point"

metricFont={font align="center" color={if {all {gt 0.95}} then="#7BBB58" else="#EFE634"} family="'Open Sans', Helvetica, Arial, sans-serif" italic=false size=36 underline=false weight="normal"}

labelFont={font size=14 family="'Open Sans', Helvetica, Arial, sans-serif" color={if {all {gt 0.95}} then="#7bbb58" else="#EFE634"} align="center"} metricFormat="0,0%"

| render

Here 2 screenshots available when I did refresh 2 times.

Some widgets works and some are not each time I refresh.


Hello @Nabeel_Ahmed_NAK !

Would you mind sharing the error messages that are being returned for those visualisations? They should appear when you click on them.

Here are some screenshots of widgets with errors.

Appreaciated

HI @JLeysens
The issue I'm facing here is sometimes it will load properly but most of the time widgets are not loading.

Thanks

As time passes your datatable sometimes has data other times not (since you are looking at the last 5 minutes based on your query this is probably a smallish sample set).

See this solution for handling a potentially empty datatable:

You should be able to prevent the empty datatable from causing issues for your getCell call too (note: getCell defaults to using row 0 if now value is provided, see the docs)

Hi @JLeysens

Here the issue is not handling the errors. I issue is that it was working properly when I created it at V8.2.3 but after upgrading version canvas not able to load widgets as well as images that were stored in assets ? So do images have the issue of datatable while it was store in assets?

I was monitoring data every 2m from heartbeat so data is their but not loading properly

Is there any thing that I can do to avoid loading issues.

I don't want to use exception handling while elasticsearch has data but loading it.

Thanks

Hm, sounds like two different issues...

From your screenshots it definitely looks like you need to do error handling, this would have also thrown in previous versions of Canvas.

Canvas assets not loading between versions sounds like a bug. Would you share some screenshots of that specific issue along with logs/error messages from the UI, console and network tab. We may need to file a bug report.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.