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

Update t128_graphql to support compound fields #71

Conversation

gregschrock
Copy link
Collaborator

@gregschrock gregschrock commented Jul 2, 2024

Description

The t128_gaphql telegraf input maps paths from GQL requests to output fields/tags and that mapping is one-to-one. Generally, that is a fair assumption for GQL and we’ve seen other libraries do the same. However, our model has some cases where the data under a request leaf is a tree. We are unable to retrieve such data via the t128_graphql input. We should support a way to get these fields at least as a string JSON blob.

As an example:

    {
      allRouters(name: $routerName) {
        nodes {
          name
          nodes(name: $nodeName) {
            nodes {
              name
              deviceInterfaces(name: $deviceInterface) {
                nodes {
                  extendedStatistics
                }
              }
            }
          }
        }
      }
    }

Produces

{
  "data": {
    "allRouters": {
      "nodes": [
        {
          "name": "burl-corp",
          "nodes": {
            "nodes": [
              {
                "name": "burl-corp-primary",
                "deviceInterfaces": {
                  "nodes": [
                    {
                      "extendedStatistics": {
                        "rx_xoff_packets": 0,
                        "rx_jabber_errors": 0,
                        ...
                      }
                    }
                  ]
                }
              }
            ]
          }
        }
      ]
    }
  }
}

See the readme and unit test for an example of the output format.

@gregschrock gregschrock merged commit 01d4fc6 into release-128tech-1.22 Jul 17, 2024
2 checks passed
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

Successfully merging this pull request may close these issues.

3 participants