getredash / redash

Make Your Company Data Driven. Connect to any data source, easily visualize, dashboard and share your data.
http://redash.io/
BSD 2-Clause "Simplified" License
26.18k stars 4.36k forks source link

TypeError: float() argument must be a string or a number, not 'NoneType' in `redash.models.next_state` #5618

Open bluetech opened 3 years ago

bluetech commented 3 years ago

Issue Summary

Using a self-hosted redash instance running in docker-compose with image redash/redash:10.0.0.b50363. The instance was upgraded from redash 8, with celery replaced with rq according to the release notes.

Every once in a while redash emits this traceback to sentry/logs:

TypeError: float() argument must be a string or a number, not 'NoneType'
  File "rq/worker.py", line 934, in perform_job
    rv = job.perform()
  File "rq/job.py", line 686, in perform
    self._result = self._execute()
  File "rq/job.py", line 692, in _execute
    return self.func(*self.args, **self.kwargs)
  File "redash/tasks/alerts.py", line 42, in check_alerts_for_query
    new_state = alert.evaluate()
  File "redash/models/__init__.py", line 1012, in evaluate
    new_state = next_state(op, value, threshold)
  File "redash/models/__init__.py", line 945, in next_state
    value = float(value)

Some of the values Sentry catches are:

{columns: [{friendly_name: 'col1', name: 'col1', type: 'integer'}, {friendly_name: 'col2', name: 'col2', type: 'integer'}], rows: [{col1: None, col2: None}]}

and the alert is on col1 > 0. It looks like redash 8 handled col1 = None (in which case, not triggering the alert), but redash 10 doesn't.

Steps to Reproduce

I admittedly didn't try it, but it would probably be:

Technical details:

Cheesom99 commented 2 years ago

Try and check if it is a spelling problem, maybe you left a space where you were not supposed to. I just solved this issue in my OOP project

susodapop commented 2 years ago

Sorry to only just get to this. Yep this is a real bug and your reproduction steps are correct. I've self-assigned

[edit] What is the desired behaviour in this case?

zachliu commented 1 year ago

i have the same issue 2022-12-05_10-20

What is the desired behaviour in this case?

ideally, still send an alert but mention that the value is none?