Comments (22)
Thank you @marcusolsson for your answer.
I will keep an eye in the repo to check if this was implemented.
If you can, please tag me in the commit if this is implemented.
from grafana-json-datasource.
We just started to play with your plugin. Very nicely done, thank you. Yes, multiple time-series is practically "a must" in modern charting applications. BTW, Infinity JSON, CSV plugin is supporting and processes series very nicely. We used it in CSV but assumption it will render JSON in a similar way.
One issue we noticed, when using plotly chart, selecting part of the chart to create time period to zoom in, it can't forward the from and to time stamps.
from grafana-json-datasource.
I've just published v1.1.0 to the marketplace, which includes experimental support for this. Would you mind checking it out and letting me know whether it addresses your use case?
from grafana-json-datasource.
I found the bug causing the issue both of you are seeing. I'll be releasing a fix for this later today.
from grafana-json-datasource.
Confirming the plugin works as expected. Thank you very much.
from grafana-json-datasource.
Hi @afonsoc12, and thanks for sharing an interesting use case!
The plugin currently only supports one time series per Grafana query, so to have plot multiple time series, they'd have to be broken out into separate Grafana queries with filters:
To support your use case, I think we'd have to add some form of "Group by" feature, where you could tell the plugin to split the JSON response into multiple time series, and evaluate the JSON paths for each one.
from grafana-json-datasource.
Experimented a bit with this today. Other data sources have a way to configure a Metrics field, which AFAIK essentially does two things:
- grouping the data into multiple data frames
- using the name of the data frame as the display name for the Metrics field
I'm leaning towards configuring these to things separately. Here's how we could enable grouping into mulitple time series.
I've received several requests to bring back Aliases for fields, in which case we could support meta aliases like $__dataFrameName
, to replicate the Metrics field feature.
Unfortunately, this wouldn't solve the issue in the original post, where the JSON is nested. Since each field query executes separately from the others, there's currently no way of knowing what entry
belongs to which label
in the original example.
from grafana-json-datasource.
Sure thing. Loading up now ;) Thank you.
from grafana-json-datasource.
Well, the grouping works rather strange. We will have more time later today and post some examples. Thank you for working on this.
from grafana-json-datasource.
Hi @marcusolsson,
Just tested this, and as you said it yourself, it doesn't support my original case.
I was thinking if I could have these 3 queries
$.[?(@.label =~ /^(account 1|account 2)$/)].entries[*~]
$.[?(@.label =~ /^(account 1|account 2)$/)].entries[*]
$.[?(@.label =~ /^(account 1|account 2)$/)].label
Where the last one would repeat for the number of times within (...).entries[*], and group by this label?
Also, I am not being able to use Grafana variables in the query itself. I have a variable $accounts, where I select one or more accounts. The idea is to have something like this $.[?(@.label =~ /^$accounts$/)].entries[*]
to replace $.[?(@.label =~ /^(account 1|account 2)$/)].entries[*]
But it could be me who didn't get the JS expression right!
Note that these variables do not seem to be working on Alias field of the plugin either.
Thanks,
Afonso
from grafana-json-datasource.
Marcus,
We are comparing your implementation with something that works very well in data representation, however we do not have some of the features your plugin provides. This is grouping we are currently getting from another plugin
It aligns data per language of the audience with time stamp and value.
When we use your current version, the grouping is not performed
Notice how selecting the item does not transform the data. That's the issue that prevents it to load correctly, resulting in garbage chart.
from grafana-json-datasource.
Where the last one would repeat for the number of times within (...).entries[*], and group by this label?
This is the tricky part about getting this to work. Since the JSON paths are evaluated separately, I don't believe there's any way of knowing what entries should have what label.
One possible solution would be to support nested JSON paths, where you'd define a JSON path to return all the objects first, and then define "relative" JSON paths on that object. You could then potentially add a configuration to repeat a value on the object, for all the rows generated by the relative paths. For example:
$.[*] // returns an array of objects
.entries[*~]
.entries[*]
.label // "Repeat" is set to true
There would be performance implications of running evaluating several JSON paths, but I think it could be a natural next step for the plugin.
from grafana-json-datasource.
Your first screenshot is indeed how the Group by feature should work. For you second screenshot, can you confirm that you've set the Group by to name
?
If you have, and it's not working, is there any way you could provide a sample JSON that demonstrates the issue?
from grafana-json-datasource.
Yes indeed the settings are set to be grouped by name. I believe you are on the (better/right) path. JSON should come packaged as series. To keep your current code untouched, you can have a checkbox that will force array vs series data path traversal.
Array [{data},{data},{data}]
Series [{ser_a:[{data},{data},{data}]},{[ser_b:[{data},{data},{data}]}]
Naturally, data structure must be identical for any branch to traverse along the path..
That way there is a huge saving on traffic and data arrives in a larger chunk. We are using custom charts that allow zooming without reload. If data is loaded for 30 days you can zoom onto 1 day without sending a single bit of data. Your caching works perfectly and keeps data available to user.
While we are talking about options, it would be incredible to have color as an optional field built into the plugin. Our server has color schemes and users can preset the options they prefer. Right now we have to add block of code to recolor the charts, We recently started to adjust colors for color blind users. If the series can have color sent as data it opens up incredible flexibility and helps users see dashboards in their customized environment.
[{ser_a:[{data},{data},{data}],color_fg:'#fff'},{ser_b:[{data},{data},{data}],color_fg:'#333'}]
from grafana-json-datasource.
@marcusolsson ,
I am trying to plot multiple time-series, but it seems to plot the same values for both names. For instance,
at time epoch 1607565300, the value for "319556" is 3282189 and the value for "319557" is 56964. But the graph plots value 3282189 for both "319556" & "319557".
The json data has an array of data:
{
"records": [
{
"time": 1607565300,
"value": 3282189,
"name": 319556
},
{
"time": 1607565300,
"value": 56964,
"name": 319557
},
{
"time": 1607565600,
"value": 35199090,
"name": 319556
},
{
"time": 1607565600,
"value": 57147,
"name": 319557
},
{
"time": 1607565900,
"value": 22253010,
"name": 319556
},
{
"time": 1607565900,
"value": 30975,
"name": 319557
},
{
"time": 1607566200,
"value": 10304925,
"name": 319556
},
{
"time": 1607566200,
"value": 35028,
"name": 319557
},
{
"time": 1607566500,
"value": 6447159,
"name": 319556
},
{
"time": 1607566500,
"value": 30117,
"name": 319557
},
{
"time": 1607566800,
"value": 3543957,
"name": 319556
},
{
"time": 1607566800,
"value": 20286,
"name": 319557
},
{
"time": 1607567100,
"value": 1007703,
"name": 319556
},
{
"time": 1607567100,
"value": 132,
"name": 319557
},
{
"time": 1607567400,
"value": 179370,
"name": 319556
},
{
"time": 1607567400,
"value": 18,
"name": 319557
},
{
"time": 1607567700,
"value": 12963,
"name": 319556
},
{
"time": 1607567700,
"value": 3,
"name": 319557
}
]
}
Any solution for this?
Thanks,
Satya
from grafana-json-datasource.
Thank you for the test data! It makes things a lot easier for me. I can reproduce this as well so I can start troubleshooting this today.
from grafana-json-datasource.
I've just published 1.1.1 which should fix the grouping issue.
@afonsoc12 Added the missing variables support for Aliases as well
from grafana-json-datasource.
Had a look at the experimental Group By and Metric options and they are working for my use case too. When you do move them out of experimental, it might be useful to point the user towards configuring both. At first I was confused and only configured the Group By option so it didn't label the series correctly (each series was called "value", the data in the graph was fine). Once I set the Metric field, it worked once I saved the panel and re-opened it.
Great work on this plugin by the way! It has been super useful for me!
from grafana-json-datasource.
Sounds like it's working well for most so far, so I'll make sure to move them out of experimental for the next version.
from grafana-json-datasource.
hi, is there a way to use a calculated column (im calculating latency from two time stamps) as metric?
from grafana-json-datasource.
Is this feature still in experimental?. My Grafana still showing the experimental warning.
![Screenshot 2024-04-09 at 13 37 59](https://private-user-images.githubusercontent.com/21138952/320770919-382edf2d-26da-4dd5-b81a-dc0b60f0aaf4.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjIyNzg5MTUsIm5iZiI6MTcyMjI3ODYxNSwicGF0aCI6Ii8yMTEzODk1Mi8zMjA3NzA5MTktMzgyZWRmMmQtMjZkYS00ZGQ1LWI4MWEtZGMwYjYwZjBhYWY0LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA3MjklMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNzI5VDE4NDMzNVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWUyZTA3NmY1OWFhMDM3NDlmZWZkZWIwMTA5ODQ1ZWEwNTJhYmU4NTY4ZGU1ZTNiZDBiYTJlZmM0NjJhOTgwZjcmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.mAwVqYbYQNavWiT1sJfL35eWqewJDVfpJa8grWkVJc8)
Grafana v10.2.3
Plugin v1.3.12
from grafana-json-datasource.
@Uzama It is not but we likely won't change anything around it. We are not adding new features to the plugin and encouraging everyone to migrate to infinity data source instead.
from grafana-json-datasource.
Related Issues (20)
- Grafana API does not export panel annotations HOT 1
- Cannot see JSONAPI datasource in the plugin list HOT 1
- Chore: migrate to create plugin
- Suporte a paginação HOT 1
- Support multi-value variables HOT 1
- Dynamically adding fields for all JSON properties HOT 1
- Issue with multiple API calls from same chart HOT 1
- Grafana v9 - Button HOT 2
- README Shows Example that doesn't work at all [?(@.data > 'otherdata']
- Filtering in Jsonpath using Grafana multi-value variable? 'IN' operator supported? Or workarounds? HOT 1
- Audit and fix A11Y issues HOT 1
- Can't perform basic math with JSONata HOT 1
- Query error e.ArrayVector is not a constructor Getting this error after the new update. HOT 2
- Query error e.ArrayVector is not a constructor Getting this error after the new update HOT 3
- Support Sigv4 Auth
- A variable can't take another variable's value as a http request parameter if it starts with "1"
- Hope to support returning key value pairs as variables
- Show more details in console or query inspector
- TimeShift not working HOT 1
- JSON API: Bad Gateway HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from grafana-json-datasource.