Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Having trouble with jsonpath syntax scraping and array of objects #328

Open
mbaddah opened this issue Sep 16, 2024 · 0 comments
Open

Having trouble with jsonpath syntax scraping and array of objects #328

mbaddah opened this issue Sep 16, 2024 · 0 comments

Comments

@mbaddah
Copy link

mbaddah commented Sep 16, 2024

I can scrape a single object from the following data kyoto-dst.json using configuration like this:

modules:
  kyoto_dst:
    metrics:
      - name: kyoto_dst_value
        path: '{ [1][1] }'
        help: "Kyoto Dst Index value"
        labels:
          time_tag: '{ [1][0] }'
        metrics:
      - name: kyoto_dst_value_01
        path: '{ [2][1] }'
        help: "Kyoto Dst Index value"
        labels:
          time_tag: '{ [2][0] }'
      - name: kyoto_dst_value_02
        path: '{ [3][1] }'
        help: "Kyoto Dst Index value"

However if i try to use a range to iterate over the entire set I run into all sorts of issues :( I've tried a whole range of configuration settings such as the following:

  kyoto_dst:
    metrics:
      - name: kyoto_dst_value
        path: '{range .[*]}{.[1]}{end}'
        help: "Kyoto Dst Index value"
        labels:
          time_tag: '{.[0]}'
modules:
  kyoto_dst:
    metrics:
      - name: kyoto_dst_value
        path: '[*][1]'
        help: "Kyoto Dst Index value"
        labels:
          time_tag: '[*][0]'

etc...

Would appreciate if anyone can guy me as to what i'm doing wrong, or whether this is even supported in json exporter? The original link can be found here https://services.swpc.noaa.gov/products/kyoto-dst.json , thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant