GoogleCloudPlatform / GoogleCloudPlatform/prometheus-engine

Feature request: GMP query API works with "pint" tool (support the ?stats=1 query parameter)

Open
#1,054 1 comment 1 reaction 1 assignee Claimed by @bwplotka View on GitHub
Dominant language
Go
Stars
232
Forks
109
Avg merge
1d 3h
Merged PRs (30d)
27

Description

Prometheus supports `stats=1` as part of the `/api/v1/query` and `api/v1/query_range` endpoints. It returns an additional json field called "stats" with some execution timings. For `/query`:

```json
{
"status": "success",
"data": {
"resultType": "vector",
"result": ["..."],
"stats": {
"timings": {
"evalTotalTime": 0.0000875,
"resultSortTime": 0,
"queryPreparationTime": 0.000051542,
"innerEvalTime": 0.000029166,
"execQueueTime": 0.00004725,
"execTotalTime": 0.000141459
},
"samples": {
"totalQueryableSamples": 1,
"peakSamples": 1
}
}
}
}
```

Right now this parameter causes gmp-frontend to return an error:

```json
{
"error": {
"code": 400,
"message": "Invalid JSON payload received. Unknown name \"stats\": Cannot bind query parameter. Field 'stats' could not be found in request message.",
"status": "INVALID_ARGUMENT",
"details": [
{
"@type": "type.googleapis.com/google.rpc.BadRequest",
"fieldViolations": [
{
"description": "Invalid JSON payload received. Unknown name \"stats\": Cannot bind query parameter. Field 'stats' could not be found in request message."
}
]
}
]
}
}
```

This means we can't make use of some excellent Prometheus tooling out there like [pint](https://cloudflare.github.io/pint/checks/query/cost.html) to lint for expensive queries, because it relies on the `stats=1` parameter (and not just for that one check, but all that call Prometheus APIs). Is it possible to increase compatibility with Prometheus and start supporting this param?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.