Giter Site home page Giter Site logo

Comments (14)

marcusolsson avatar marcusolsson commented on July 29, 2024 1

Oh! That's indeed something I can fix! 😅

from grafana-json-datasource.

kalpik avatar kalpik commented on July 29, 2024 1

Here you go:

URL: https://my-jenkins-instance.com/job/Cloud/job/attempt_iqa_promotion/job/develop/api/json

Query Parameters actual (which broke): pretty=true&tree=builds[number,result,url]{0,10}
URL Encoded (which work): pretty=true&tree=builds%5Bnumber%2Cresult%2Curl%5D%7B0%2C10%7D

Note that if I also encode '=' and '&', it doesn't work again. So only some parts need to be URL encoded.

from grafana-json-datasource.

kalpik avatar kalpik commented on July 29, 2024 1

Thank you :)

from grafana-json-datasource.

kalpik avatar kalpik commented on July 29, 2024

If I only have $.builds[*].number, it shows the build numbers, but somehow I cannot display result.

$.builds[*].result shows an empty table.

from grafana-json-datasource.

marcusolsson avatar marcusolsson commented on July 29, 2024

The JSON you posted seems to work for me:

Screen Shot 2020-11-19 at 21 33 21

The error you get tells me that the result of each query don't contain the same number of rows. I'm guessing that one of the number and result properties is sometimes missing from the builds.

from grafana-json-datasource.

kalpik avatar kalpik commented on July 29, 2024

Thanks for your reply. That's what I thought as well, but I just cannot get any result to show! Even if I do $.builds[0].result, I get nothing. I can get $.builds.[0].number. So really not sure what's happening here. I checked the response from the Jenkins API, and it has both number and result for all elements, the JSON I posted above is directly from the Jenkins API. So kind of strange it works for you, but not for me!

from grafana-json-datasource.

marcusolsson avatar marcusolsson commented on July 29, 2024

I'm not sure either why it's failing for you. Could you perhaps send me the result from the Query inspector. That way I can be sure we're looking at the same data.

  1. Click the Query inspector button in the upper right corner of the query editor
  2. Click Refresh to make a new request
  3. Click Copy to clipboard
  4. Paste it in this issue

Make sure that the request doesn't contain any sensitive information before pasting it

from grafana-json-datasource.

kalpik avatar kalpik commented on July 29, 2024

Thanks. But that's the other thing. In query inspector, when I click refresh, it keeps loading, which I again found to be strange.

Keeps being stuck on this:

image

from grafana-json-datasource.

kalpik avatar kalpik commented on July 29, 2024

Okay, figured it out. I need to pass the URL query parameters URL encoded, else it doesn't work. Maybe something you can fix? :)

from grafana-json-datasource.

marcusolsson avatar marcusolsson commented on July 29, 2024

Can I ask you to provide the query parameters that broke things for you, what you had to put in there instead?

from grafana-json-datasource.

jimbrzk avatar jimbrzk commented on July 29, 2024

Hey i have the same situation and my URL dose not need to be encoded (http://api.gios.gov.pl/pjp-api/rest/station/findAll)
Sample JSON (Not form Jenkins but same situation):

[
    {
        "id": 114,
        "stationName": "Wrocław - Bartnicza",
        "gegrLat": "51.115933",
        "gegrLon": "17.141125",
        "city": {
            "id": 1064,
            "name": "Wrocław",
            "commune": {
                "communeName": "Wrocław",
                "districtName": "Wrocław",
                "provinceName": "DOLNOŚLĄSKIE"
            }
        },
        "addressStreet": "ul. Bartnicza"
    },
    {
        "id": 117,
        "stationName": "Wrocław - Korzeniowskiego",
        "gegrLat": "51.129378",
        "gegrLon": "17.029250",
        "city": {
            "id": 1064,
            "name": "Wrocław",
            "commune": {
                "communeName": "Wrocław",
                "districtName": "Wrocław",
                "provinceName": "DOLNOŚLĄSKIE"
            }
        },
        "addressStreet": "ul. Wyb. J.Conrada-Korzeniowskiego 18"
    }
]

When I query for single value it's working fine, but when I add more there's "Fields have different lengths" error showing.
It is only appeared when I trying to querying multiple fields.

Working
image

Working
image

Not working
image

from grafana-json-datasource.

marcusolsson avatar marcusolsson commented on July 29, 2024

@kubala156 I can reproduce it the JSON you've sent me. This is the result from the data source.

$.[*].id matches recursively (just learned this myself), which also adds the city ID to the id values. I fixed it by changing it to $.[:].id. We should document this in the README, but I need to read up on it a little more.

[
  {
    "name": "id",
    "type": "number",
    "values": [
      114,
      117,
      1064,
      1064
    ]
  },
  {
    "name": "stationName",
    "type": "string",
    "values": [
      "Wrocław - Bartnicza",
      "Wrocław - Korzeniowskiego"
    ]
  },
  {
    "name": "gegrLat",
    "type": "string",
    "values": [
      "51.115933",
      "51.129378"
    ]
  },
  {
    "name": "gegrLon",
    "type": "string",
    "values": [
      "17.141125",
      "17.029250"
    ]
  }
]

from grafana-json-datasource.

marcusolsson avatar marcusolsson commented on July 29, 2024

Closing this with a fix for @kalpik's issue where query parameters aren't encoded properly.

from grafana-json-datasource.

marcusolsson avatar marcusolsson commented on July 29, 2024

Fixed in v0.6.2.

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.