Skip to content

Conversation

GiedriusS
Copy link
Contributor

@GiedriusS GiedriusS commented Apr 17, 2020

The feature of query-frontend to log slower queries is already amazing
but we can make it even better by logging the POST body as well. It is
not uncommon nowadays to use POST with the Prometheus API. All of the
data that is passed via POST is not visible via the URL. Thus, let's
also print the POST data if it is available.

Small testing shows that the message now looks like the following:

level=info ts=2020-04-17T16:34:51.200200445Z caller=frontend.go:174 msg="slow query" org_id=fake url=http://localhost:9009/api/prom/api/v1/query_range time_taken=1.638201ms body="end=1587141285&query=prometheus_http_requests_total&start=1587140385&step=15"

Signed-off-by: Giedrius Statkevičius [email protected]

The feature of query-frontend to log slower queries is already amazing
but we can make it even better by logging the POST body as well. It is
not uncommon nowadays to use POST with the Prometheus API. All of the
data that is passed via POST is not visible via the URL. Thus, let's
also print the POST data if it is available.

Small testing shows that the message now looks like the following:

```
level=info ts=2020-04-17T16:34:51.200200445Z caller=frontend.go:174 msg="slow query" org_id=fake url=http://localhost:9009/api/prom/api/v1/query_range time_taken=1.638201ms body="end=1587141285&query=prometheus_http_requests_total&start=1587140385&step=15"
```

Signed-off-by: Giedrius Statkevičius <[email protected]>
Signed-off-by: Giedrius Statkevičius <[email protected]>
Copy link
Contributor

@pracucci pracucci left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Added PR number.

Signed-off-by: Giedrius Statkevičius <[email protected]>
@GiedriusS
Copy link
Contributor Author

LGTM

Thanks, I have added the PR number to the changelog as well which I have missed before.

@tomwilkie tomwilkie merged commit 3c1a324 into cortexproject:master Apr 19, 2020
@GiedriusS GiedriusS deleted the frontend_log_more branch April 27, 2020 20:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants