flant / grafana-statusmap

Grafana panel plugin to visualize status of multiple objects over time
MIT License
831 stars 43 forks source link

Cannot read property 'map' of undefined #143

Open di97mni opened 4 years ago

di97mni commented 4 years ago

Grafana 7.2.2 Statusmap : 0.3.4

Getting this error when upgrading to Grafana 7.2.2 and Statusmap 0.3.4 Any ideas what to look for?

image

image

image

image

diafour commented 4 years ago

Hello. My first thought it is a 'no data' case. It is a known and long-lasting bug.

di97mni commented 4 years ago

Hi, and thanks for answering The query, to log analytics in Azure, returns data. This is what it looked like before the upgrade.

image

di97mni commented 4 years ago

Example of data from Azure

image

diafour commented 4 years ago

Yep, it is definitely not a "No data" issue. Unfortunately, I have no access to Log Analytics Workspace to reproduce the issue. I've tried Azure Monitor queries and it works as expected.

Can you please help gather some debug information to fix this issue? You need to navigate to a 'module.ts' in 'Sources' pane of DevTools and set a breakpoint on line 365. Then press 'reload' button in a dashboard. Next scroll to Scope and expand 'dataList' variable.

Example 1 with Prometheus datasource with 2 queries:

Снимок экрана 2020-10-23 в 21 00 37

Example 2 with Azure Monitor also with 2 queries.

Снимок экрана 2020-10-23 в 21 03 27
di97mni commented 3 years ago

Haven't forgot this but I haven't been able to test it again. Needed to roll back to 7.0.0. Will test it again as soon as I can

shurup commented 3 years ago

Hi @di97mni, are there any news on that?

tambetliiv commented 3 years ago

Had the same problem

Console errors: image

Debug tools: image

Let me know if there is any extra info needed for debugging.

diafour commented 3 years ago

@tambetliiv statusmap doesn't support "table" data from datasources, only "timeseries".

tambetliiv commented 3 years ago

Ok, thanks for the quick answer, seems like datasource provides "table". When testing with timeseries, no issues, and after changing to "table" it produces that error.

Will try to find a way to provide data as a "timeseries"

di97mni commented 3 years ago

Today I tried to upgrade again. Sorry for the delay. Grafana 7.0.0 => 7.4.3

I've set the breakpoint in module.ts but it's never hit

image

Instead I see this errors in the console.log Now I don't even come to getting any data from Azure.

image

My javascript knowledge is very limited...

@shurup have you had the same issue?

di97mni commented 3 years ago

Looking in the issue list I can see the plugin isn’t compatible with Grafana 7.4 I’ll try this again when it’s compatible

di97mni commented 3 years ago

Testing with 7.3.6 and using a query from the docs we can see that in 7.0.0 it's a time series whereas in 7.3.6 the same query is returned as a table Haven't found the reason why it, at least from 7.2.2, behaves like this

AzureActivity
| where $__timeFilter(TimeGenerated)
| summarize count() by Category, bin(TimeGenerated, 1h)
| order by TimeGenerated asc

image

image

diafour commented 3 years ago

Thank you for debugging! You've also shed the light on the mystery with Grafana 7.3.6 from https://github.com/flant/grafana-statusmap/issues/176

di97mni commented 3 years ago

Changing to a query from the help section and using Graph panel we can see the same issue with type: "table". Looks like the Graph panel supports it though.

Maybe this issue should go to the Grafana issue list instead? I have looked in the list for similar issue but no success.

image

joshhunt commented 3 years ago

@di97mni I'm taking a look at this from Grafana POV - it looks like you're having problems with both Azure Monitor (Logs) and ADX?

Do you have a sample query (preferably using the datatable fn?) I could run to try and dig into this? Unfortunately none of our Workspaces have AzureActivity data populated

di97mni commented 3 years ago

@joshhunt we are not using ADX, only log analytics and application insights. I don't think it matters what log analytics query you are writing, we get the same issue. I can create a sample workspace for you if you need something to query.

joshhunt commented 3 years ago

@di97mni Is it possible to reproduce this with the datatable operator within a Logs query with just a couple of rows? Unforunately I'm not too familiar with Statusmap and the fields it expects in the results.

Just trying to figure out exactly what's breaking down here - it is likely that Statusmap adding support for Dataframes could fix this, but Grafana should be automatically converting back to the older format anyway.

di97mni commented 3 years ago

@joshhunt I've added a docker compose and some Grafana datasource and dashboard to hopefully make it easier to find it. The dashboard contains datatable. However, due to it's not supported to use environment variables in Grafana dashboard you need to manually set WS and subscription ID in the dashboard file

"REPLACE_WITH_WORKSPACE_ID" "REPLACE_WITH_SUBSCRIPTION_ID"

You also need to set the values for your Azure account in the docker compose file

Then when I open panel in Grafana 7.0.0 I see this

http://localhost:3000/d/Z3lF6oQGz/flant_grafana-statusmap_issues_143?orgId=1&editPanel=2 image

But when open it in Grafana 7.2.2 I see this

http://localhost:3001/d/Z3lF6oQGz/flant_grafana-statusmap_issues_143?orgId=1&editPanel=2

image

di97mni commented 3 years ago

Hi @joshhunt Any updates on this? Do you need more info from me? Thanks!

di97mni commented 2 years ago

Probably same as #227