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

Selecting "Raw Document" metric breaks graph permanently #6367

Closed
1 of 3 tasks
jacobweber opened this issue Oct 24, 2016 · 7 comments
Closed
1 of 3 tasks

Selecting "Raw Document" metric breaks graph permanently #6367

jacobweber opened this issue Oct 24, 2016 · 7 comments
Labels
area/datasource datasource/Elasticsearch help wanted prio/medium Important over the long term, but may not be staffed and/or may need multiple releases to complete. type/bug
Milestone

Comments

@jacobweber
Copy link

  • I'm submitting a ...
  • Bug report
  • Feature request
  • Question / Support request: Please do not open a github issue. Support Options

Please include this information:

  • What Grafana version are you using? 3.1.1
  • What datasource are you using? Elasticsearch
  • What OS are you running grafana on? CentOS 6.8
  • What did you do? Select Metric = "Raw Document", then change Metric back to something else, like "Max".
  • What was the expected result? Sub-fields appear for editing selected metric, e.g. selecting "Max" shows another field next to it, to enter the name of the field to use in the metric.
  • What happened instead? Panel stops working. If you save it in this state, it becomes permanently broken. The next time you open the editor, the Metrics panel shows "{{ctrl.target.refId}} ({{ctrl.target.datasource}}" instead of the metrics fields.

IMPORTANT If it relates to metric data viz:

  • An image or text representation of your metric query
  • The raw query and response for the network request (check this in chrome dev tools network tab, here you can see metric requests and other request, please include the request body and request response)

When you select "Raw Document", it performs a query, which returns valid results. In the JS console, an error appears:

TypeError: Cannot read property 'toString' of undefined
    at a.isMsResolutionNeeded (https://grafana.dev.scivantage.com/public/app/boot.1649cbaa.js:19:17889)
    at h.seriesHandler (https://grafana.dev.scivantage.com/public/app/boot.1649cbaa.js:17:18589)
    at Array.map (native)
    at h.onDataReceived (https://grafana.dev.scivantage.com/public/app/boot.1649cbaa.js:17:17896)
    at e.emit (https://grafana.dev.scivantage.com/public/app/boot.1649cbaa.js:39:22558)
    at a.emit (https://grafana.dev.scivantage.com/public/app/boot.1649cbaa.js:39:24649)
    at h.f.handleQueryResult (https://grafana.dev.scivantage.com/public/app/boot.1649cbaa.js:41:18076)
    at h (https://grafana.dev.scivantage.com/public/app/boot.1649cbaa.js:36:20031)
    at https://grafana.dev.scivantage.com/public/app/boot.1649cbaa.js:36:20203
    at n.$eval (https://grafana.dev.scivantage.com/public/app/boot.1649cbaa.js:36:27720)
Panel data error: TypeError: Cannot read property 'toString' of undefined(…)

Then when you select a different metric type, like "Sum", another error appears:

Object {message: "Invalid query"}
@torkelo
Copy link
Member

torkelo commented Oct 25, 2016

You cannot use Sum with Raw Document you need a bucket aggregation (Terms or date histogram).

The graph panel does not support Raw Document queries currently, only table panel.

But the "Invalid Query" error that breaks the query editor is a bug that should be fixed.

@torkelo torkelo added type/bug prio/medium Important over the long term, but may not be staffed and/or may need multiple releases to complete. datasource/Elasticsearch help wanted labels Oct 25, 2016
@torkelo torkelo added this to the 4.1.0 milestone Oct 25, 2016
@jacobweber
Copy link
Author

Just to clarify, I wasn't try to use both Sum and Raw Document; I was trying to switch between them. And when I selected Raw Document, all the "group by" fields disappeared, so I couldn't do a bucket aggregation.

Same behavior on the Table panel.

@torkelo torkelo removed this from the 4.1.0 milestone Dec 14, 2016
@widgetpl
Copy link

widgetpl commented Mar 3, 2017

I have the same problem but with Prometheus datasource. Not sure why this error appeared ( maybe because of templated datasource and switching between them ).

Message:

Cannot read property 'replace' of undefined

Stack trace:

TypeError: Cannot read property 'replace' of undefined
    at k (http://172.16.239.3:3000/public/app/plugins/datasource/prometheus/datasource.js?bust=1488531981383:4:156)
    at l (http://172.16.239.3:3000/public/app/boot.6d63bd8b.js:52:14654)
    at Function.Sg [as map] (http://172.16.239.3:3000/public/app/boot.6d63bd8b.js:53:15348)
    at interpolateQueryExpr (http://172.16.239.3:3000/public/app/plugins/datasource/prometheus/datasource.js?bust=1488531981383:4:809)
    at Object.formatValue (http://172.16.239.3:3000/public/app/boot.6d63bd8b.js:10:25506)
    at http://172.16.239.3:3000/public/app/boot.6d63bd8b.js:10:26856
    at RegExp.[Symbol.replace] (<anonymous>)
    at String.replace (native)
    at Object.replace (http://172.16.239.3:3000/public/app/boot.6d63bd8b.js:10:26579)
    at eval (http://172.16.239.3:3000/public/app/plugins/datasource/prometheus/datasource.js?bust=1488531981383:4:1153)

Running dockerized Grafana v4.1.2 (commit: v4.1.2)

@RalfJung
Copy link

Same problem here with a 4.1.2 Debian package.

@pathikmehta
Copy link

I am facing the same problem with version 5.3.2 as well.

@volter
Copy link
Contributor

volter commented Nov 6, 2018

Can somebody correct the typo in "Documnent" in the title?

@marefr marefr changed the title Selecting "Raw Documnent" metric breaks graph permanently Selecting "Raw Document" metric breaks graph permanently Nov 6, 2018
@marefr
Copy link
Contributor

marefr commented Nov 6, 2018

Let us know if anyone interested in contributing a fix for this? We'll be available with guidance and helping out reviewing etc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/datasource datasource/Elasticsearch help wanted prio/medium Important over the long term, but may not be staffed and/or may need multiple releases to complete. type/bug
Projects
None yet
Development

No branches or pull requests

7 participants