Skip to content

Add distributor endpoint for validating PromQL expressions #184

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

Merged
merged 2 commits into from
Jan 9, 2017

Conversation

juliusv
Copy link
Contributor

@juliusv juliusv commented Jan 6, 2017

Update: Now the response looks like this:

In case of a good expression:

HTTP status code: 200 OK.

{
  "status": "success"
}

In case of an error:

HTTP status code: 400 Bad Request.

{
  "error": "parse error at line 1, char 4: could not parse remaining input \",expr\"...",
  "errorType": "bad_data",
  "location": {
    "line": 1,
    "pos": 4
  },
  "status": "error"
}

Fixes #176

Returns a JSON object of the form:

    {
      "valid": true|false
    }

Fixes #176
@juliusv
Copy link
Contributor Author

juliusv commented Jan 6, 2017

@davkal Is this sufficient, or would you like the parser error message in case of an invalid expression as well?

@davkal
Copy link
Contributor

davkal commented Jan 9, 2017

@juliusv The error would be great. But I'd like to merge this first.

@juliusv
Copy link
Contributor Author

juliusv commented Jan 9, 2017

Now the response looks like this:

In case of a good expression:

HTTP status code: 200 OK.

{
  "status": "success"
}

In case of an error:

HTTP status code: 400 Bad Request.

{
  "error": "parse error at line 1, char 4: could not parse remaining input \",expr\"...",
  "errorType": "bad_data",
  "location": {
    "line": 1,
    "pos": 4
  },
  "status": "error"
}

@tomwilkie
Copy link
Contributor

LGTM!

@juliusv juliusv merged commit 2fe7641 into master Jan 9, 2017
@tomwilkie tomwilkie deleted the validate-expr branch January 17, 2017 20:56
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