MarcusCalidus / marcuscalidus-svg-panel

Grafana panel for displaying metric sensitive SVG images using the snap svg library
MIT License
63 stars 28 forks source link

Raw document: Cannot read property 'toString' of undefined #31

Closed zoell closed 5 years ago

zoell commented 5 years ago

I am trying to use raw document metrics with elasticsearch but receiving the mentioned error.

Is this not compatible with raw document?

MarcusCalidus commented 5 years ago

Could you please provide some more information? I need the portion of the script that you use to access the raw document please.

zoell commented 5 years ago

I actually did not do anything on the scripting side yet.

I have a json document in elasticsearch and I want to get the last one, for that I configured the metrics this way:

raw

In other panels it seems to be working.

MarcusCalidus commented 5 years ago

I have never used elastic search before. I'm not sure how the dataSource is structured. could you please look into the browser's console and post any error output. Maybe it tells which module casts the error. My own code has no single .toString() in it.

zoell commented 5 years ago

Here it is: /public/app/features/panel/metrics_panel_ctrl.ts:177

Panel data error: TypeError: Cannot read property 'toString' of undefined
    at t.isMsResolutionNeeded (time_series2.ts:362)
    at new t (time_series2.ts:165)
    at SVGCtrl.seriesHandler (svg_ctrl.js:260)
    at Array.map (<anonymous>)
    at SVGCtrl.onDataReceived (svg_ctrl.js:249)
    at s.emit (index.js:129)
    at t.emit (config.html:4)
    at SVGCtrl.t.handleQueryResult (metrics_panel_ctrl.ts:303)
    at angular.js:17051
    at angular.js:17095

The referenced row is: const timeFromInterpolated = this.templateSrv.replace(this.panel.timeFrom, this.panel.scopedVars);

zoell commented 5 years ago

And here is the raw query and response:

{
  "xhrStatus": "complete",
  "request": {
    "method": "POST",
    "url": "api/datasources/proxy/14/_msearch",
    "data": "{\"search_type\":\"query_then_fetch\",\"ignore_unavailable\":true,\"index\":[\"MY-INDEX-NAME-2018\"],\"max_concurrent_shard_requests\":256}\n{\"size\":1,\"query\":{\"bool\":{\"filter\":[{\"range\":{\"Timestamp\":{\"gte\":\"1545292800000\",\"lte\":\"1545328799999\",\"format\":\"epoch_millis\"}}},{\"query_string\":{\"analyze_wildcard\":true,\"query\":\"*\"}}]}},\"sort\":{\"Timestamp\":{\"order\":\"desc\",\"unmapped_type\":\"boolean\"}},\"script_fields\":{},\"docvalue_fields\":[\"Timestamp\"]}\n"
  },
  "response": {
    "responses": [
      {
        "took": 0,
        "timed_out": false,
        "_shards": {
          "total": 1,
          "successful": 1,
          "skipped": 0,
          "failed": 0
        },
        "hits": {
          "total": 2,
          "max_score": null,
          "hits": [
            {
              "_index": "MY-INDEX-NAME-2018",
              "_type": "myIndexType",
              "_id": "R5nJy2cBXDM0sPvEudx1",
              "_score": null,
              "_source": { ...HERE IS MY JSON DOCUMENT... },
              "fields": {
                "Timestamp": [
                  "2018-12-20T13:24:14.223Z"
                ]
              },
              "sort": [
                1545312254223
              ]
            }
          ]
        },
        "status": 200
      }
    ]
  }
}

Any way you can see from these what could be the problem?

MarcusCalidus commented 5 years ago

thx for the info. As I expected the elastic search raw data is neither used as time series nor table data - ok that was a no brainer :) currently I only differenciate between those two datasources image

I would have to investigate that further. Is there any open elastic search endpoint around where I can get free test data?

zoell commented 5 years ago

Where can I send you a test ES access?

MarcusCalidus commented 5 years ago

MarcusCalidus[at]gmail.com

zoell commented 5 years ago

OK sent you the details.

MarcusCalidus commented 5 years ago

Fixed in this Pull Request: https://github.com/grafana/grafana-plugin-repository/pull/353

MarcusCalidus commented 5 years ago

@zoell please let me know if the applied fix worked - so we can close the issue. Thank you

zoell commented 5 years ago

Yes it works. Thanks!