Git Product home page Git Product logo

grafana-json-datasource's Introduction

JSON API data source for Grafana

The Grafana JSON Datasource plugin empowers you to seamlessly integrate JSON data into Grafana. JSON is a versatile and widely used data format, and with this plugin, you can easily transform your JSON data into meaningful visualizations within Grafana dashboards.

Documentation

For comprehensive instructions on setting up and configuring the Grafana JSON API Datasource, please consult our official documentation.

Contributing

We welcome and appreciate contributions from the open-source community to make this project better. Whether you want to report a bug, request a new feature, or submit code changes, please follow the guidelines below:

Reporting issues

If you encounter a bug or have a suggestion for improvement, please check our issues to see if a similar issue has already been reported. If not, feel free to open a new issue. When creating an issue, please provide as much detail as possible, including the version of the datasource you are using, your version of grafana and steps to reproduce the issue.

Requesting features

If you have an idea for a new feature or enhancement, we encourage you to create an issue. This can help gather feedback and refine the proposal.

Pull requests

If you'd like to contribute code to this project, please follow these steps:

  1. Fork the repository to your GitHub account.
  2. Create a new branch for your feature or bug fix: git checkout -b feature-name.
  3. Make your changes and commit them with a clear, descriptive message.
  4. Push your branch to your fork: git push origin feature-name.
  5. Create a pull request (PR) to the main branch of this repository. Please provide a detailed description of your changes in the PR.
  6. Be prepared to address any feedback or requested changes during the review process.
  7. Once your PR is approved, it will be merged, and your contribution will be part of the datasource.

grafana-json-datasource's People

Contributors

amng avatar assisgui avatar cletter7 avatar dependabot[bot] avatar foosel avatar gabor avatar gwdawson avatar jirkafajfr avatar ledor473 avatar manjrekarom avatar marcusolsson avatar pgillich avatar rejohnst avatar saltedpotatos avatar sh0rez avatar timunderhay avatar titilambert avatar tolzhabayev avatar totalus avatar yesoreyeram avatar zoltanbedi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

grafana-json-datasource's Issues

Update the variable query editor with new design

0.9.0 introduced a brand new query editor. Unfortunately, the query editor for variables uses a separate query editor. Extract the new query editor into a generic editor so that it can be used in dashboard and for variables.

Can I add a custom http parameter?

I am getting some data back using this against sprinklr. woot! To get data back from their listening stream (actual verbatim comments), an http parameter is required. For example:

request.AddParameter(@"application/json", "{\n\t\"sinceTime\":" + epochFromInMilliseconds + ",\n\t\"untilTime\":" + epochNowInMilliseconds + ",\n\t\"details\": {\n\t\t\"widgetType\": \"STREAM\"\n\t},\n\t\"messageFormatOptions\": \"strip_html,strip_url\",\n\t\"filters\": [\n\t\t{\n\t\t\t\"dimension\": \"TOPIC\",\n\t\t\t\"filterValues\": [\n\t\t\t\t\"" + definedTopic.Id + "\"\n\t\t\t]\n\t\t},\n\t\t{\n\t\t\t\"dimension\": \"MEDIA_SOURCE\",\n\t\t\t\"filterValues\": [\n\t\t\t\t\"REDDIT\",\n\t\t\t\t\"TWITTER\",\n\t\t\t\t\"FACEBOOK\"\n\t\t\t]\n\t\t}\n\t],\n\t\"metric\": \"MENTIONS\",\n\t\"start\": 0,\n\t\"rows\": 150\n}", ParameterType.RequestBody);

Does this support that as is? Thanks!

data cache problems

when i use a json api datasource , i found a data cache problem.
i tried to update my json api , but the result on grafana not changed .
when i use curl command , it could show latest result , but grafana cannot.

Minified React error #130

I installed this plugin on a Debian server and I encountered an issue when I tried to add a JSON API data source. "Invariant Violation: Minified React error #130; visit https://reactjs.org/docs/error-decoder.html?invariant=130&args[]=undefined&args[]= for the full message or use the non-minified dev environment for full errors and additional helpful warnings. " When I checked the URL, it showed that "Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined." Is this a compatibility issue?

Feature request: support sending a json body with http request

#39
In order to use this as a way to get any valuable info from the sprinklr api, it would need to support being able to send a json body. For example:
request.AddParameter(@"application/json", "{\n\t\"sinceTime\":" + epochFromInMilliseconds + ",\n\t\"untilTime\":" + epochNowInMilliseconds + ",\n\t\"details\": {\n\t\t\"widgetType\": \"STREAM\"\n\t},\n\t\"messageFormatOptions\": \"strip_html,strip_url\",\n\t\"filters\": [\n\t\t{\n\t\t\t\"dimension\": \"TOPIC\",\n\t\t\t\"filterValues\": [\n\t\t\t\t\"" + definedTopic.Id + "\"\n\t\t\t]\n\t\t},\n\t\t{\n\t\t\t\"dimension\": \"MEDIA_SOURCE\",\n\t\t\t\"filterValues\": [\n\t\t\t\t\"REDDIT\",\n\t\t\t\t\"TWITTER\",\n\t\t\t\t\"FACEBOOK\"\n\t\t\t]\n\t\t}\n\t],\n\t\"metric\": \"MENTIONS\",\n\t\"start\": 0,\n\t\"rows\": 150\n}", ParameterType.RequestBody);

I believe many people would find this useful. Sprinklr is the best enterprise tool for understanding what people are talking about across all public domain social platforms. This information is valuable for corporations, research, etc.

Please let me know if I can provide any more info. Thank you!

Unable to display data returned from Jenkins

Hello!

I'm trying to parse this data:

{ "_class" : "org.jenkinsci.plugins.workflow.job.WorkflowJob", "builds" : [ { "_class" : "org.jenkinsci.plugins.workflow.job.WorkflowRun", "number" : 220, "result" : "SUCCESS" }, { "_class" : "org.jenkinsci.plugins.workflow.job.WorkflowRun", "number" : 219, "result" : "UNSTABLE" }, { "_class" : "org.jenkinsci.plugins.workflow.job.WorkflowRun", "number" : 218, "result" : "ABORTED" }, { "_class" : "org.jenkinsci.plugins.workflow.job.WorkflowRun", "number" : 217, "result" : "UNSTABLE" }, { "_class" : "org.jenkinsci.plugins.workflow.job.WorkflowRun", "number" : 216, "result" : "UNSTABLE" }, { "_class" : "org.jenkinsci.plugins.workflow.job.WorkflowRun", "number" : 215, "result" : "ABORTED" }, { "_class" : "org.jenkinsci.plugins.workflow.job.WorkflowRun", "number" : 214, "result" : "UNSTABLE" }, { "_class" : "org.jenkinsci.plugins.workflow.job.WorkflowRun", "number" : 213, "result" : "ABORTED" }, { "_class" : "org.jenkinsci.plugins.workflow.job.WorkflowRun", "number" : 212, "result" : "ABORTED" }, { "_class" : "org.jenkinsci.plugins.workflow.job.WorkflowRun", "number" : 211, "result" : "UNSTABLE" }, { "_class" : "org.jenkinsci.plugins.workflow.job.WorkflowRun", "number" : 210, "result" : "ABORTED" }, { "_class" : "org.jenkinsci.plugins.workflow.job.WorkflowRun", "number" : 209, "result" : "SUCCESS" }, { "_class" : "org.jenkinsci.plugins.workflow.job.WorkflowRun", "number" : 208, "result" : "UNSTABLE" }, { "_class" : "org.jenkinsci.plugins.workflow.job.WorkflowRun", "number" : 207, "result" : "ABORTED" }, { "_class" : "org.jenkinsci.plugins.workflow.job.WorkflowRun", "number" : 206, "result" : "ABORTED" }, { "_class" : "org.jenkinsci.plugins.workflow.job.WorkflowRun", "number" : 205, "result" : "SUCCESS" }, { "_class" : "org.jenkinsci.plugins.workflow.job.WorkflowRun", "number" : 204, "result" : "SUCCESS" }, { "_class" : "org.jenkinsci.plugins.workflow.job.WorkflowRun", "number" : 203, "result" : "SUCCESS" }, { "_class" : "org.jenkinsci.plugins.workflow.job.WorkflowRun", "number" : 202, "result" : "ABORTED" } ] }

Trying to use these queries, but I get an error. I'm sure it's something stupid!
image

bad gateway error when running this plugin in a local instance of grafana and where to change base url?

Hi,

I'm playing with this with the end goal of being able to query a couple sprinklr api's directly from grafana. I have the plugin loaded, but when I use it as a datasource for a dashboard, I get this:
Bad Gateway Object status:502 statusText:"Bad Gateway" data:Object error:"Bad Gateway" response:"" message:"Bad Gateway" config:Object url:"api/datasources/proxy/1" method:"GET" retry:0 headers:Object hideFromInspector:false message:"Bad Gateway"

Any tips on what to try to solve that?

Also, I've searched fairly extensively through the package files to determine where to change the base url, but am not finding it. Can you help with that?

Thanks!

Grafana Explore gets stuck when adding a second query

I will add a video to show what I mean. The 1st query works just fine. But after that, I cannot add another query at all. Whatever I click on the grafana explore pane does nothing.

Configuration_.Data.Sources.-.Grafana.-.Personal.-.Microsoft.Edge.2020-12-28.13-19-58.mp4

New params are missing in final query

Hello, first of all, thank you very much for the new features / improvements. This is a great plugin that helps us a lot!

From Release Notes of v.0.9.0:

It introduces a new key value editor for query parameters and headers, as well as a Monaco-based editor for editing the request body with syntax highlighting.

This release deprecates the queryString property in the query model, in favor of the new params. The query string config should be backwards-compatible (and forward-compatible) with previous versions, but make sure to back up your dashboard before upgrading.

Query string was greatly parsed to params:
image

But all of them are missing in the final query:
image

So I had to use the path configuration to pass query as workaround:
image

Thank you for any support!

Dashboard Variables

Is it possible to use variables in the query? I'm trying to use variable in the query field, but I couldn't find a way.

Time selection macros in query parameters

Many data sources have the $__timeFrom() and $__timeTo() macros, is it possible to add those?

I need the format in epoch for my integration but i imagine there would be many APIs that use different formats so maybe $__timeFrom("format") would be appropriate?

Multiple values in same graph

Hello,
First of all, many thanks for this plugin. It has been working flawlessly for several JSON API's that I have already tested with.

However, there is this time-series API which I do not know how to plot multiple time-series in the same plot. This data comes from FireflyIII.

[
    {
        "label": "account 1",
        "currency_id": 3,
        "currency_code": "GBP",
        "currency_symbol": "£",
        "currency_decimal_places": 2,
        "start_date": "2020-12-01",
        "end_date": "2020-12-31",
        "type": "line",
        "yAxisID": 0,
        "entries": {
            "2020-12-01": 1,
            "2020-12-02": 2,
            "2020-12-03": 3,
            "2020-12-04": 4,
            "2020-12-05": 5,
            "2020-12-06": 6,
            "2020-12-07": 7,
            "2020-12-08": 8,
            "2020-12-09": 9,
            "2020-12-10": 10,
            "2020-12-11": 11,
            "2020-12-12": 12,
            "2020-12-13": 13,
            "2020-12-14": 14,
            "2020-12-15": 15,
            "2020-12-16": 16,
            "2020-12-17": 17,
            "2020-12-18": 18,
            "2020-12-19": 19,
            "2020-12-20": 20,
            "2020-12-21": 21,
            "2020-12-22": 22,
            "2020-12-23": 23,
            "2020-12-24": 24,
            "2020-12-25": 25,
            "2020-12-26": 26,
            "2020-12-27": 27,
            "2020-12-28": 28,
            "2020-12-29": 29,
            "2020-12-30": 30,
            "2020-12-31": 31
        }
    },
    {
        "label": "account 2",
        "currency_id": 3,
        "currency_code": "GBP",
        "currency_symbol": "£",
        "currency_decimal_places": 2,
        "start_date": "2020-12-01",
        "end_date": "2020-12-31",
        "type": "line",
        "yAxisID": 0,
        "entries": {
            "2020-12-01": 31,
            "2020-12-02": 30,
            "2020-12-03": 29,
            "2020-12-04": 28,
            "2020-12-05": 27,
            "2020-12-06": 26,
            "2020-12-07": 25,
            "2020-12-08": 24,
            "2020-12-09": 23,
            "2020-12-10": 20,
            "2020-12-11": 21,
            "2020-12-12": 20,
            "2020-12-13": 19,
            "2020-12-14": 18,
            "2020-12-15": 17,
            "2020-12-16": 16,
            "2020-12-17": 15,
            "2020-12-18": 14,
            "2020-12-19": 13,
            "2020-12-20": 12,
            "2020-12-21": 11,
            "2020-12-22": 10,
            "2020-12-23": 9,
            "2020-12-24": 8,
            "2020-12-25": 7,
            "2020-12-26": 6,
            "2020-12-27": 5,
            "2020-12-28": 4,
            "2020-12-29": 3,
            "2020-12-30": 2,
            "2020-12-31": 1
        }
    }
]

I have a Grafana Variable which is called asset_accounts which maps to the json label, such as account 1 and account 2

On the query field I have experimented with: $.[?(@.label =~"${asset_accounts}")].entries[*] but it just concatenates the points and does not put them into "another column".
Also, to have the time-stamps I have to use the queries: $.[?(@.label =~"${asset_accounts}")].entries[*~] (keys) and $.[?(@.label =~"${asset_accounts}")].entries[*], since $.[?(@.label =~"${asset_accounts}")].entries[*~, *] generates two grafana data-frames.

Any thoughts? Is this possible to achieve at all?

Thank you!

Add query alias so that series overrides can be applied easily

I would like to apply series overrides so that I can change how the results are displayed in the graph panel and tailor the legend value.

A number of datasource plugins support a query alias or aliasBy.

I like the idea of introducing a simple query alias. Would that work, or are there better ways of achieving this?

Datasource Issue

I have created the data source in Grafana and it connects and tests successfully. From within grafana I get a "Data source plugin does not export any Query Editor component". I am new at this so I could be doing something wrong. I am attempting to connect to the Pagerduty API.

Show decimal value

The result decimal auto transformed, I am not sure this transformed by this data source or grafana internal ?
image

Basic Authentication

I would be nice If we could configure it with Basic Authentication since not all the JSON Apis are token based.

Path variable support

I saw this was mentioned in #8 and I'd also like to have the ability to set path variables.

I'm implementing a dashaboard for Pingdom and they use the format /api/2.1/summary.performance/{checkid} for requests, which requires a new data source for each checkid currently.

Unexpected token '<' Evaluating ...

Hi, as i would like to add some stats from a json into grafana i tried to load this plugin

grafana version is Open Source v7.3.7 (1e261642f4) running in a docker

when i try to add datasource it drops directly this error

Unexpected token '<' Evaluating http://192.168.1.97:3006/public/app/plugins/datasource/dist/module Loading app/plugins/datasource/dist/module
Data Source Error

image

from the dev console in browser
actions.ts:70 Failed to import plugin module SyntaxError: Unexpected token '<'
at eval ()
at le (system.js:4)
at system.js:4
at system.js:4
at S (system.js:4)
at x (system.js:4)
at system.js:4

also not possible to remove the failed entries anymore
image

way i installed, downloaded the zip, moved to the proper directory where the plugins are located, restarted server, datasource was available, but as soon i hit "add" ...

i also tried then to compile in the docker
installed yarn
but compiling is ... not very well documented howto use yarn, yarn build drops also a error

root@e654c4951362:/usr/share/grafana/public/app/plugins/datasource/grafana-json-datasource-main# yarn build
00h00m00s 0/0: : ERROR: [Errno 2] No such file or directory: 'build'
root@e654c4951362:/usr/share/grafana/public/app/plugins/datasource/grafana-json-datasource-main# yarn package.json
00h00m00s 0/0: : ERROR: There are no scenarios; must have at least one.
root@e654c4951362:/usr/share/grafana/public/app/plugins/datasource/grafana-json-datasource-main# yarn build package.json
00h00m00s 0/0: : ERROR: [Errno 2] No such file or directory: 'build'
root@e654c4951362:/usr/share/grafana/public/app/plugins/datasource/grafana-json-datasource-main#

for any Tipps, thanks ahead

Custom query parameters and URL via query

Hey!
Thanks for the plugin, its great 👍

is it possible to add an option to pass URL or Custom query parameters from the dashboard query?

because now i have to create a new data source for each request i make (even if in the same api scope)

Thanks!

504 Gateway Time-out The server didn't respond in time.

I am getting this error when I try to execute a query which takes more than 30s to complete. My json api takes about a minute to execute. Is there a way to set timeout?

Query Inspector ->
request:Object
url:"api/datasources/proxy/1/v1/prog-perf/category-update-dates?program-year=2021"
method:"GET"
hideFromInspector:false
response:Object
error:"Gateway Timeout"
response:"

504 Gateway Time-out


The server didn't respond in time.

" message:"

504 Gateway Time-out

The server didn't respond in time. "

Support for time series data

Does this have support for generating graphs from the JSON data which is updated in real time? Or do I need prometheus for it and then use it in grafana?

How to use variable in JSON API?

Hi,

I declared $namespace variable as query in Grafana. But I can't use it to filter.

Could you please help me how to use variable in JSON PATH?

Thanks.

JSON API: Bad Gateway

While trying to connect to a WebService exposed from RapidMiner I get the JSON API: Bad Gateway error while configuring the data source.
I have tried with and without user credentials. Copying the headers sent by Postman and the error is the same.
But the error is not helpful to understand what might be wrong.

Issue with registration

image

I got an issue like above when I tried registering this datasource to grafana.
I installed this well with same way to install other plugins. 😢

Template variable chaining is not working

I'm trying to chain template variables and it seems that the variable expansion is not working in the "Custom query parameters" field in template variables. When I set:

search=$filter

The query becomes:

/?search=%24filter

The same happens with the double-bracket notation.

In the query editor this is working and only seems to affect the template variable editor.

Column alias is gone?

In the newest release (0.8.0) it seems like the alias field is not present anymore.
image

The aliases i had in place are working correctly but i cannot create new ones.

Is it an intended change?

Thank you in advance

Suggestion - Identify time-column by field-name rather than value

Hello, first off, I'd like to thank you for this plugin 👍 . I think graphing arbitrary rows of json from an HTTP endpoint should be part of the core grafana product.

Problem

While trying to add a single-value to a stat panel, I was surprised by the automatic attribution of the type:time to my value since it met the conditions (length of 10 or 13 etc.. ). I tried working around it through the various override options in the grafana GUI but found none and resorted to modifying my data from the backend (to not be of length 10 or 13).

Suggested solution

My suggestion would be to just use the field-name "time" instead. This is how grafana natively identifies the time column, so it would make queries more portable and reduce UX surprises.

Thanks again for the plugin.

fields have different length

when i tried use chinese character in json fields, it always showed "fields have different length"
so my question is , is there any limitations when i use this plugin ? especially the length of fields
thanks

metrics with 0 value ( also false ) are mapped to NaN

hello Marc ,

can you please help resolving the floowing issue :
metrics with 0 value ( also false ) are mapped to NaN
ENV :

  • Grafana version 7.3.4
  • grafana-json-datasource version 0.7

FYI : mapping is working well with previous version ( 0.6.4 )

Regards

IT Glue JSON Forbidden

Hello!

I figured I'd give this plugin a try and interface with IT Glue to produce some useable dashboards. However, I'm having a devil of a time with the server-end coming back with a 500 forbidden.

According to their docs, all I need is to enter two header values:

Content-Type application/vnd.api+json
x-api-key {{my ITG API KEY}}

...and the main url https://api.itglue.com. There's not much to it. There is no basic/cert auth. I've successfully been using Postman for some time, and those two header values are all that's needed to connect and start building out queries, etc.

Unfortunately the plugin doesn't generate a log in Grafana, and I cannot elaborate more on the transaction between the plugin and IT Glue's server URL.

What I know is a cookie is sent from the api back to the client - AWSALB={{some random value}}. It's not possible to predict what the cookie value will be, therefore if this is a requirement of the plugin, I'm unsure how to whitelist that cookie.

From the Grafana server itself, I have the IT Glue PowerShell API wrapper installed and am able to get data I'm looking for, so it isn't a connectivity or key issue. I'm using the same API Key in powershell as I am in the Grafana Plugin.

Plugin
image

Postman
image

PowerShell on Grafana Host
image

Post enhancement

hello Marcus ,

are you thinking of integrating Post request to the plugin via a button

Thanks

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.