Migration from simple json data source plugin #740
yesoreyeram
announced in
Docs
Replies: 1 comment 2 replies
-
Thanks a lot for this guide for migration. Unfortunately, images cannot be opened or saved to file, so it is really difficult to have a look at them. If you could give access to the images, it would be great. Thanks! |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Grafana's simple JSON datasource plugin is a legacy way of connecting JSON endpoints from Grafana. This requires you to run your own http server that implements certain HTTP endpoints such as
/
,/search
,/query
and/annotations
endpoint and require to return data in certain format. This plugin was build for older versions of Grafana and no longer maintained. Also this plugin was built using legacy AngularJS technology which is now deprecated in recent versions of Grafana. This makes this plugin unusable anymore.Migrating to infinity plugin
Important
Infinity is not a drop-in replacement for simple JSON datasource plugin. This require manual migration efforts. But migrating to infinity is strongly recommended approach if you are using simple JSON API datasource plugin.
Approach 1 : Direct API connection / Simple approach / Recommended approach
This is much easier and recommended approach to connect JSON api endpoints directly. Infinity allows you to connect directly to your JSON endpoints instead of requiring you to write your server implementation comparing to grafana simple json server approach. Refer Infinity plugin website for more details about connecting your APIs directly.
With this approach, you can get rid of your custom json server and directly connect your API endpoints via Infinity plugin. If this approach is not possible for any reason, use the below alternate migration approach.
Approach 2 : Migrating using Grafana simple json server approach
With this approach, Instead of connecting your API endpoints directly, you will be connecting via grafana simple JSON server (legacy server). Also in grafana, instead of using simple json datasource plugin, you will be using Infinity plugin.
Migrating the configuration
In terms of configuration editor, there is no much change. The URL used in simple json datasource goes into infinity config misc/url section. Other options such as proxy, tls/ca certificates, headers goes into network and headers section.
Provisioning
Provisioning of simple json and infinity is almost similar only the plugin id differs. Refer the infinity plugin provisioning documentation for more examples.
Migrating the queries ( quick migration / frontend parser )
If you are using one or more queries using Simple JSON as shown below, you can migrate to infinity using the steps provided below. This approach is simple but less powerful. Doesn't support grafana backend features such as alerting.
upper_25
JSON
as query type.Select
Default
/Frontend
as your parser.Source:
URL
.Format:
As IS
/Legacy
.HTTP Method:
POST
.URL :
/query
HTTP Body: In your http body you need to specify the targets:
{ "targets": [{ "target":"upper_25" }] }
Migrating the queries ( recommended migration / backend parser )
Use this approach to migrate to get support for features such as alerting, public dashboards, query caching etc.
upper_25
URL
Parser:
Backend
Source:
URL
Format:
Time series
HTTP method:
POST
URL:
/query
BODY:
{ "targets": [{ "target":"upper_25" }]}
Parsing options/Root:
datapoints
Column 1:
0
as selector.upper_25
as alias.Number
as format.Column 2:
1
as selector.Time
as alias.Unix (ms)
as format.Migrating the annotations
Migrating the annotations is similar to query. For example, below screenoshots show different annotation creations
Using Simple JSON
Using Infinity
Troubleshooting
Note
Infinity doesn't support direct browser connection to your API endpoints. All the requests will be proxied from grafana server.
Sample migration dashboard
Beta Was this translation helpful? Give feedback.
All reactions