movio / bramble

A federated GraphQL API gateway
https://movio.github.io/bramble/
MIT License
497 stars 53 forks source link

Cannot access timings #190

Open anar-khalilov opened 1 year ago

anar-khalilov commented 1 year ago

We want to access timings as shown below but we couldn't find a way. Can you provide a way to be able to measure performance by making these timings accessible somehow?

image
LeonHuston commented 1 year ago

Hey there, if you supply a header in your request with the key ,values being X-Bramble-Debug: timing it will return you the timing values in the extensions field of the response.

You can see what other values you can request with that header here

anar-khalilov commented 1 year ago

Yes, we set this header to "all".

Can you provide a concrete example on how to access these values not from the package but from outside as a consumer of this package? We tried many different methods to no avail.

If there is no such way, could you provide one?

pkqk commented 1 year ago

Hi @anar-khalilov, I'm not sure what you mean by outside the package?

The timings are in the JSON body of the HTTP response.

{
    "data": "…",
    "extensions": {
        "plan": "…",
        "timings": {
            "execution": "194ms",
            "format": "0s",
            "merge": "0s"
        }
    }
}

So if your HTTP client lets you inspect the response at a higher level than the data key then they are there. It doesn't currently break the timings down by service or field though.