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

Add support to parse nested JSON array #2066

Closed
kevinjos opened this issue Nov 22, 2016 · 1 comment
Closed

Add support to parse nested JSON array #2066

kevinjos opened this issue Nov 22, 2016 · 1 comment

Comments

@kevinjos
Copy link

kevinjos commented Nov 22, 2016

Feature Request

Opening a feature request kicks off a discussion.

Proposal:

Extended #1965 to support object specific tags in nested JSON arrays. Is there a small change to the JSON parser to accommodate this request without breaking existing functionality?

Current behavior:

The HTTP JSON input plugin line protocol output for the following...

JSON response

{"service":"myservice",
  "metrics":[{"tagA":"ABC", "tagB":"XYZ", "value":1.0}, {"tagA":"DEF", "tagB":"UVW", "value":2.0}]
}

telegraf.conf

[[inputs.httpjson]]
  name = "mycollector"

  servers = [
    "http://my.service.com/_stats"
  ]

  method = "GET"

  response_timeout = "5s"

  tag_keys = ["service", "tagA", "tagB"]

Line Protocol

httpjson_mycollector,service=myservice,host=http://my.service.com/_stats metrics_0_value=1.0,metrics_1_value=2.0

Desired behavior:

Line Protocol

httpjson_mycollector,service=myservice,host=http://my.service.com/_stats,tagA=ABC,tagB=XYZ metrics_value=1.0
httpjson_mycollector,service=myservice,host=http://my.service.com/_stats,tagA=DEF,tagB=UVW metrics_value=2.0

Use case:

Extends the functionality of the httpjson input plugin to support global and object specific tags

@sparrc
Copy link
Contributor

sparrc commented Nov 22, 2016

there is already an issue open to support more generic JSON parsing, see #1363

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

2 participants