Giter Club home page Giter Club logo

Comments (15)

simPod avatar simPod commented on June 7, 2024 1

I'll try it on my own tomorrow

from grafanajsondatasource.

simPod avatar simPod commented on June 7, 2024 1

@cmoroexpedia can you try upgrading ur grafana?

I've only discovered that selecting All doesn't pass all values. I didn't notice that as I use it in a bit non-standard way so I have never manually selected variable before :) I have created an issue for that #31

from grafanajsondatasource.

simPod avatar simPod commented on June 7, 2024

This has been fixed recently based on #26 (comment) with #28 Try to put quotes around.

Have to update documentation, thanks!

from grafanajsondatasource.

cmoroexpedia avatar cmoroexpedia commented on June 7, 2024

Thanks for the quick response!

Enclosing my variable name in quotes worked, but I also had to change the variable configs to return all values between quotes:

Screen Shot 2019-03-18 at 5 37 28 PM

Also, the All option doesn't work because that's not between quotes.

from grafanajsondatasource.

simPod avatar simPod commented on June 7, 2024

@cmoroexpedia I meant something like this:

{ "additional": "optional json", "testvar": "$testvar" }

Try it and let me know

from grafanajsondatasource.

cmoroexpedia avatar cmoroexpedia commented on June 7, 2024

Correct, that's what I did but I still got an error saying Unexpected token t in JSON. I found strange that it was complaining about token t that is the first char of the value of my variable, so I also enclosed the variable value in quotes and it worked. Basically double quoting.

I think I'll go a different route and get my variable content from scopedVars field instead. Thanks for your help!

from grafanajsondatasource.

simPod avatar simPod commented on June 7, 2024

All value handling is implemented in #33

from grafanajsondatasource.

skyever avatar skyever commented on June 7, 2024

@simPod I have the same problem in grafana v5.3.4, but it works well in grafana v6.0.2.

the additional json data is

{"nodename": "$node"}

and the erros in chrome is :

metrics_panel_ctrl.ts:177 Panel data error: SyntaxError: Unexpected token h in JSON at position 15
    at JSON.parse (<anonymous>)
    at eval (datasource.ts:156)
    at Array.map (<anonymous>)
    at t.buildQueryTargets (datasource.ts:136)
    at t.query (datasource.ts:35)
    at t.issueQueries (metrics_panel_ctrl.ts:287)
    at t.issueQueries (module.ts:254)
    at angular.js:17051
    at angular.js:17095
    at c.$digest (angular.js:18232)

the $node should be "hz".

Correct, that's what I did but I still got an error saying Unexpected token t in JSON. I found strange that it was complaining about token t that is the first char of the value of my variable, so I also enclosed the variable value in quotes and it worked. Basically double quoting.

I think I'll go a different route and get my variable content from scopedVars field instead. Thanks for your help!

from grafanajsondatasource.

simPod avatar simPod commented on June 7, 2024

I still have not updated the docs :/

You can try this: {"nodename": $node}

If that doesn't work, you can try to check what value comes to JSON.parse in datasource.ts.

But there have been some variable processing changes in Grafana till v5 so I'll maybe just bump the version requirement to v6.

from grafanajsondatasource.

simPod avatar simPod commented on June 7, 2024

Documentation issue resolved via 0c2b628

from grafanajsondatasource.

skyever avatar skyever commented on June 7, 2024

when I try : {"nodename": $node}, it doesn't work in grafana v6 and v5. And I don't know how to print the value comes to JSON.parse. I tried with {"nodename": $node}, and I just saw the value or $node in grafana v5 is "hz" (in quotes)。

from grafanajsondatasource.

simPod avatar simPod commented on June 7, 2024

@skyever what version of this DS do you have?

To print the value you have to clone the repo and then add console.log, then build it, see https://github.com/simPod/grafana-json-datasource#development-setup

from grafanajsondatasource.

skyever avatar skyever commented on June 7, 2024

@simPod the version is v0.1.3. And I will try this, thanks.

from grafanajsondatasource.

skyever avatar skyever commented on June 7, 2024

I decide to update all of my grafana to v6.

from grafanajsondatasource.

simPod avatar simPod commented on June 7, 2024

Ayright, I'll just bump it. Tagging 0.1.4.

from grafanajsondatasource.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.