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

Expression browser doesn't handle empty responses well. #3515

Closed
noony opened this Issue Nov 27, 2017 · 3 comments

Comments

Projects
None yet
3 participants
@noony
Copy link

noony commented Nov 27, 2017

What did you do?
I'm testing rules before integration in alert manager .rules.yml. So I'm running this querying on prometheus with and hour.

(hour() >= bool 1) and on (instance) (up == 1)

What did you expect to see?
the list of targets with up == 1 because there is targets with up == 1 and hour() is > to 1

What did you see instead? Under which circumstances?
Javascript error in console :

Uncaught TypeError: Cannot read property 'length' of null
    at Prometheus.Graph.handleConsoleResponse (graph.js?v=0a74f98628a0463dddc90528220c94de5032d1a0:723)
    at success (graph.js?v=0a74f98628a0463dddc90528220c94de5032d1a0:418)
    at Object.success (graph.js?v=0a74f98628a0463dddc90528220c94de5032d1a0:432)
    at i (jquery.min.js?v=0a74f98628a0463dddc90528220c94de5032d1a0:2)
    at Object.fireWith [as resolveWith] (jquery.min.js?v=0a74f98628a0463dddc90528220c94de5032d1a0:2)
    at A (jquery.min.js?v=0a74f98628a0463dddc90528220c94de5032d1a0:4)
    at XMLHttpRequest.<anonymous> (jquery.min.js?v=0a74f98628a0463dddc90528220c94de5032d1a0:4)

Json return by the query string /api/v1/query?query=(hour()%20>%3D%20bool%201)%20and%20on%20(instance)%20(up%20%3D%3D%201)&time=1511781829.405&_=1511781184970

{"status":"success","data":{"resultType":"vector","result":null}}

Environment

  • System information:

    Linux 4.4.0-96-generic x86_64

  • Prometheus version:

prometheus, version 2.0.0 (branch: HEAD, revision: 0a74f98628a0463dddc90528220c94de5032d1a0)
  build user:       root@615b82cb36b6
  build date:       20171108-07:11:59
  go version:       go1.9.2

@noony noony changed the title Rules and dates functions are not working Queries with dates functions are not working Nov 27, 2017

@noony noony changed the title Queries with dates functions are not working Queries with date functions are not working Nov 27, 2017

@brian-brazil

This comment has been minimized.

Copy link
Member

brian-brazil commented Nov 27, 2017

That's a bug in the graph code, but the empty response is correct.

@brian-brazil brian-brazil changed the title Queries with date functions are not working Expression browser doesn't handle empty responses well. Nov 27, 2017

@roidelapluie

This comment has been minimized.

Copy link
Contributor

roidelapluie commented Nov 29, 2017

Fix proposed in #3521

roidelapluie added a commit to roidelapluie/prometheus that referenced this issue Nov 30, 2017

Correctly handle empty data set in the console view
When there is an empty result set, the Prometheus server replies with

{"status":"success","data":{"resultType":"vector","result":null}}

That "null" reply was not handled correctly by the graphing library.
This commit handles that case and shows "no data" in the UI console view
instead of throwing an error in the browser javascript console.

Fixes prometheus#3515

Signed-off-by: Julien Pivotto <roidelapluie@inuits.eu>

brian-brazil added a commit that referenced this issue Nov 30, 2017

Correctly handle empty data set in the console view (#3521)
When there is an empty result set, the Prometheus server replies with

{"status":"success","data":{"resultType":"vector","result":null}}

That "null" reply was not handled correctly by the graphing library.
This commit handles that case and shows "no data" in the UI console view
instead of throwing an error in the browser javascript console.

Fixes #3515

Signed-off-by: Julien Pivotto <roidelapluie@inuits.eu>
@lock

This comment has been minimized.

Copy link

lock bot commented Mar 23, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked and limited conversation to collaborators Mar 23, 2019

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.