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

GraphQL scaler #6383

Open
edwin-Marrima opened this issue Dec 1, 2024 · 2 comments
Open

GraphQL scaler #6383

edwin-Marrima opened this issue Dec 1, 2024 · 2 comments

Comments

@edwin-Marrima
Copy link

Proposal

GraphQL scaler trigger scales based on a metric value provided by an GraphQL API.
It uses GraphQL API as a metric provider.

The interface that users interact with:

triggers:
- type: graphql
  metadata:
    targetValue: "8.8"
    query: |
      query {
        usage{
          target_number
        }
      }
    activationTargetValue: "3.8"
    url: "http://graphql:6666"
    valueLocation: "data.usage.1.target_number" # GJSON path notation to extract the metric value

Scaler Source

GraphQL API

Scaling Mechanics

Metric value provided by an GraphQL API

Authentication Source

basic, TLS, OAuth 2.0 and token

Anything else?

I am aware of the existence of metrics API scaler. The scaler in question, for obvious reasons, uses the GET method and therefore does not allow passing request bodies. On the other hand, GraphQL by definition uses the POST method (although some libraries support GET), and in many cases, the query is sent in the body of the request. I believe that modifying the scaler to enable the execution of GraphQL queries is not ideal, as it changes the concept of the scaler.

@zroubalik
Copy link
Member

zroubalik commented Dec 7, 2024

What if we add support for HTTP method into the metrics api scaler (default to GET, but also an ability to specify POST + body etc).

Are there any problems in that?

@edwin-Marrima
Copy link
Author

No problem, but we will need to add support for request body too.
Do you agree with that @zroubalik?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: To Triage
Development

No branches or pull requests

2 participants