grafana / opensearch-datasource

Apache License 2.0
25 stars 20 forks source link

Metric Raw Data error - input data must be a wide series but got type long #360

Open omarhadary opened 5 months ago

omarhadary commented 5 months ago

What happened: Getting error "[sse.readDataError] [A] got error: input data must be a wide series but got type long (input refid)" when trying to create an OpenSearch alert rule with a query that uses "Raw Data" as the metric.

What you expected to happen: Expect to be able to get back "Raw Data" when alert rule evaluates

How to reproduce it (as minimally and precisely as possible): Create a new alert using OpenSearch datasource and select "Raw Data" as the metric

Anything else we need to know?: End goal is to create an alert with the error message in the notification. Tried a few different ways but seems OpenSearch plugin uses aggregations when defining a query for the alert rule and we don’t have access to the whole document. Checking to see if this is intended behavior / if there's a way around this.

Environment: Grafana v10.4.1 OpenSearch v 1.3.2

sarahzinger commented 5 months ago

Hi @omarhadary I can reproduce this as well. I believe we may need to implement something like a Format As Dropdown like we have in some of our sql datasources, I've tried to write up that solution here: https://github.com/grafana/opensearch-datasource/issues/365

Basically the data is coming back by default in a Long Time Series format, but our Alerting feature only supports alerts on a Wide Time Series format...there may be a way to manipulate the data you're getting back so that it comes back in a wide format with transforms or something like that but I'm not sure. I've opened a ticket for us to research the best solution for this, but as a heads up it might take a bit of time to think through on our end. Thanks so much for reporting this challenge!

omarhadary commented 5 months ago

Thanks @sarahzinger - in the meantime and until someone looks at this feature request, is there an option to use something like promql / logql function count_over_time like in this example with Loki https://grafana.com/tutorials/create-alerts-with-logs/ Haven't been able to find tutorials / examples / docs

sarahzinger commented 4 months ago

Hi @omarhadary I believe that's just a promql feature.

I'm a bit unclear why the aggregations don't work for you, maybe that's a place to start?

Here is an example of us doing a count over time for example:

Image