-
-
Notifications
You must be signed in to change notification settings - Fork 320
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
Multiple X-Clockwork-Id header #248
Comments
Hey, Can you describe your use case in a bit more detail? Is your api calling another APIs and appending the returned Clockwork headers to its own response or is the API calling itself? Any reason why don't you simply call the other controllers directly or extract the shared code, so you won't need to make additional HTTP requests? I'll definitively consider adding support if it makes sense, it's not hard to do. |
Hi, We'd like to track this 3 calls as independent requestsl. |
In this case, we are doing asynchronous multiple requests in PHP. I think it could be useful and will not break existant implementation. It's just a new feature allowing multiple Clockwork headers to be tracked. |
I like the idea, will take a look today. |
Great, two other ideas, I don't know if it's hard to do or not:
|
I wanted to add an ability to reveal selected request in the network panel, so we don't have to reimplement the functionality, but there is no Chrome api that would allow us to do so. I've put in a feature request, but there was not much interest in it - https://bugs.chromium.org/p/chromium/issues/detail?id=614686. We might need to reimplement the response/preview functionality from network tab at some point. For the request replaying I will need to do some research, might be too complex for the minor convenience compared to full page reload. For the sub-requests I would suggest logging the responses in your "main" request which would make them available in the "main" response log tab (should work pretty well when working with JSON). |
You mean for multiple requests? |
Looking into this, it's not as simple as sending multiple ids. Since the other apis live (or might live) on different urls, we need to know these so we can request the metadata. Eg. if the sub-request is made to This is what I'm thinking atm - we'll add a new api
This way we can make the metadata request to the appropriate url from the extension. |
Actually, we use only one endpoint to request metadata because we do not wish to track api1.example.com but only api2.example.com. Our api1 works like a Proxy so it's not necessary to track performance or anything. But you right that if you need to track multiple project in one query |
Let me know if this works for you - itsgoingd/clockwork-chrome#46 |
I'm not sure it could works because:
Am I missing something? |
This is designed for a case where the API 1 would also use Clockwork, but can still be used in your setup by manually appending the headers:
Eg. in your case where you have
or
|
Oh ok, the url is actually the path. Thank you |
I think there is an issue with the url. X-Clockwork-Id: 0 X-Clockwork-Path: /myfolder/__clockwork/ X-Clockwork-Subrequest: 1521534919-4878-1919494053;http://apiv1.domain.com/myfolder/, 1521534919-5203-1481206257;http://apiv1.domain.com/myfolder/, 1521534919-6458-405847040;http://apiv1.domain.com/myfolder/ X-Clockwork-Version: 2.2.3 The extension tries to query http://apiv1.domain.com/__clockwork/1521534920-6453-1849188266 |
Path is currently not supported for subrequests, we can change the subrequest header format to |
An other problem is that your are trying to map X-Clockwork-Subrequest headers but there is only one with multiple value separated with , character. |
So with this modification, it works great. |
Hey, I've updated the PRs with path and comma-separated header values support, I had to use different code since both comma-separated and multiple headers are valid. |
Ok great. I do not see how we could have multiple headers, in every try I did, it's always comma-separated but it's cool if both are handle. |
It works great but you need to add a trim on the header value line 141 in the extension.js file:
I have to urlencode the url param in subrequest header because one of our url used comma. I don't know if you are doing something about that in the subrequest method because we are building headers ourself but I prefere to notice you. Great job by the way ;) |
I confirm you that in our case we need to use |
Thanks for testing & feedback, I'll update the PRs later today. |
Do you have a planned date for the merge into master? |
Hey, this will most likely be å part of the 3.0 release still a few weeks away (#232). |
Subrequests now available in Clockwork 3.0 - blog post and full changelog. Still need to document this, but api is the same as in the PR. |
Our backend makes multiple call in one request to our API.
For example for a /user backend call, our backend will call 2 API route, one for the user languages and an other one for the user preferences.
So we have a list of X-Clockwork-id unique header, but it's not handled by the Chrome extension.
Is it planned to add this feature?
The text was updated successfully, but these errors were encountered: