Giter Site home page Giter Site logo

Comments (22)

afonsoc12 avatar afonsoc12 commented on September 3, 2024 1

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.

supportdesk-si avatar supportdesk-si commented on September 3, 2024 1

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.

marcusolsson avatar marcusolsson commented on September 3, 2024 1

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.

marcusolsson avatar marcusolsson commented on September 3, 2024 1

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.

supportdesk-si avatar supportdesk-si commented on September 3, 2024 1

Confirming the plugin works as expected. Thank you very much.

from grafana-json-datasource.

marcusolsson avatar marcusolsson commented on September 3, 2024

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:

Screen Shot 2021-01-06 at 12 06 32

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.

marcusolsson avatar marcusolsson commented on September 3, 2024

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.

groupby

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.

supportdesk-si avatar supportdesk-si commented on September 3, 2024

Sure thing. Loading up now ;) Thank you.

from grafana-json-datasource.

supportdesk-si avatar supportdesk-si commented on September 3, 2024

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.

afonsoc12 avatar afonsoc12 commented on September 3, 2024

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.

supportdesk-si avatar supportdesk-si commented on September 3, 2024

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

image

It aligns data per language of the audience with time stamp and value.

When we use your current version, the grouping is not performed

image

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.

marcusolsson avatar marcusolsson commented on September 3, 2024

@afonsoc12

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.

marcusolsson avatar marcusolsson commented on September 3, 2024

@supportdesk-si

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?

Screenshot 2021-04-16 at 01 42 34@2x

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.

supportdesk-si avatar supportdesk-si commented on September 3, 2024

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.

Satyabhama-Reddy avatar Satyabhama-Reddy commented on September 3, 2024

@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
      }
    ]
}

Screenshots of the output:
Screen Shot 2021-04-16 at 10 34 41 AM
Screen Shot 2021-04-16 at 1 20 20 PM
Screen Shot 2021-04-16 at 1 21 55 PM

Any solution for this?

Thanks,
Satya

from grafana-json-datasource.

marcusolsson avatar marcusolsson commented on September 3, 2024

@Satyabhama-Reddy

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.

marcusolsson avatar marcusolsson commented on September 3, 2024

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.

Turnerj avatar Turnerj commented on September 3, 2024

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.

marcusolsson avatar marcusolsson commented on September 3, 2024

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.

renofa avatar renofa commented on September 3, 2024

hi, is there a way to use a calculated column (im calculating latency from two time stamps) as metric?

from grafana-json-datasource.

Uzama avatar Uzama commented on September 3, 2024

Is this feature still in experimental?. My Grafana still showing the experimental warning.

Screenshot 2024-04-09 at 13 37 59

Grafana v10.2.3
Plugin v1.3.12

from grafana-json-datasource.

zoltanbedi avatar zoltanbedi commented on September 3, 2024

@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)

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.