Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Receive an error when create an alter #88

Open
yuanpenc opened this issue Jun 1, 2021 · 5 comments
Open

Receive an error when create an alter #88

yuanpenc opened this issue Jun 1, 2021 · 5 comments

Comments

@yuanpenc
Copy link

yuanpenc commented Jun 1, 2021

What happened:

When I was trying to create an alter and test rules, there seemed to be a bug. The request and response is as below.

  "firing": true,
  "state": "pending",
  "conditionEvals": " = true",
  "timeMs": "179.965ms",
  "error": "tsdb.HandleRequest() response error &{POST http://proxy.druid.ke.com/druid/v2 giving up after 6 attempt(s) POST http://proxy.druid.ke.com/druid/v2 giving up after 6 attempt(s) A <nil> [] [] 0xc001913e30}",
  "logs": [
    {
      "message": "Condition[0]: Query",
      "data": {
        "from": 1622531328676,
        "queries": [
          {
            "refId": "A",
            "model": {
              "builder": {
                "aggregations": [
                  {
                    "name": "all_cnt",
                    "type": "count"
                  }
                ],
                "dataSource": {
                  "name": "commerce_adx_digv_empty_log",
                  "type": "table"
                },
                "filter": {
                  "dimension": "ip",
                  "type": "selector",
                  "value": "10.26.12.246"
                },
                "granularity": "minute",
                "intervals": {
                  "intervals": [
                    "${__from:date:iso}/${__to:date:iso}"
                  ],
                  "type": "intervals"
                },
                "postAggregations": [],
                "queryType": "timeseries",
                "virtualColumns": []
              },
              "expr": "{\"builder\":{\"queryType\":\"timeseries\",\"dataSource\":{\"name\":\"commerce_adx_digv_empty_log\",\"type\":\"table\"},\"intervals\":{\"type\":\"intervals\",\"intervals\":[\"${__from:date:iso}/${__to:date:iso}\"]},\"granularity\":\"minute\",\"filter\":{\"dimension\":\"ip\",\"type\":\"selector\",\"value\":\"10.26.12.246\"},\"aggregations\":[{\"name\":\"all_cnt\",\"type\":\"count\"}],\"postAggregations\":[],\"virtualColumns\":[]},\"settings\":{}}",
              "hide": true,
              "refId": "A",
              "settings": {}
            },
            "datasource": {
              "id": 18,
              "name": "Druid-server-alert"
            },
            "maxDataPoints": 0,
            "intervalMs": 0
          }
        ],
        "to": 1622531628676
      }
    }
  ]
}

As you can see, the parameter "intervals" seems not work properly. At lease, I think, It should not be something like "${__from:date:iso}/${__to:date:iso}".

However, When I specified a certain time range like the pic below, the problem was solved.
image

What you expected to happen:
The alter works successfully without specifying the intervals.

For an instance, when I use official grafana-prometheus. The request of an alter is like this:
image
The interval is "" (nothing here, only "from/to" specify the time range )

How to reproduce it:
Build an timeseries query without specifying the intervals. Then, create an alter and test rule. The error message will come out.

Environment:

  • Grafana version: v7.3.5
  • Data source type: druid
  • OS Grafana is installed on: Linux
  • User OS & Browser: Chrome
@jbguerraz
Copy link
Contributor

jbguerraz commented Jun 2, 2021

Hello @yuanpenc
Thank you for this issue! :)
Yes this issue is known, has been discussed here: https://grafadruid.slack.com/archives/C01EEPVTALW/p1621957357043800
We should replace the __from and __to variables from the backend, using those from and to fields from the alert query, and then apply the formaters over them (like date:iso or so: https://grafana.com/docs/grafana/latest/variables/variable-types/global-variables/#__from-and-__to ).
If you feel it, feel free to join us on slack and maybe contribute this feature ?
For short-term workaround you could use something relative to now to select the data (like now - 5 minutes or so) for your alerts.

@yuanpenc yuanpenc closed this as completed Jun 3, 2021
@yuanpenc yuanpenc reopened this Jun 3, 2021
@yuanpenc
Copy link
Author

yuanpenc commented Jun 3, 2021

Hello @yuanpenc
Thank you for this issue! :)
Yes this issue is known, has been discussed here: https://grafadruid.slack.com/archives/C01EEPVTALW/p1621957357043800
We should replace the __from and __to variables from the backend, using those from and to fields from the alert query, and then apply the formaters over them (like date:iso or so: https://grafana.com/docs/grafana/latest/variables/variable-types/global-variables/#__from-and-__to ).
If you feel it, feel free to join us on slack and maybe contribute this feature ?
For short-term workaround you could use something relative to now to select the data (like now - 5 minutes or so) for your alerts.

Of course! I am 100% willing to contribute this feature. But the thing is I don't have too much experience in Typescript project. So, Could you please add some instructions of how to compile and zip this project in the readme? Thank you for you help.

@jbguerraz
Copy link
Contributor

Hello @yuanpenc
Awesome to read! This is more a contribution on the golang side of it. I'm fully available to help you with it, feel free to ping me on https://join.slack.com/t/grafadruid/shared_invite/zt-ryrcolyp-GQCiKcOF0WhnK~iqpkrqLA

@saketbairoliya2
Copy link
Contributor

Do we have any update on this? @jbguerraz / @yuanpenc

@jbguerraz
Copy link
Contributor

nope @saketbairoliya2
If you're willing to work on it, feel free to ping me, I'll be happy to help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants