-
Notifications
You must be signed in to change notification settings - Fork 931
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
Generate and send b3 tracing headers per CLI command #3309
Comments
Would it be worth it to have a global parameter (e.g. |
@johha Yeah thats a good idea and feedback we hear too. I wish CF_TRACE allowed for varying levels of verbosity. For trace headers we have the following ids that could be output:
If we output trace ids for every api call we'd likely still have a lot of spam since we'd need to show the request URL + trace ids for every request. Did you have something in midn? One option would be to just output the per command request id. Something like:
Or if we think theres value in both we could have trace-ids take a verbosity (e.g. trace_ids=1 outputs the first option, trace_ids=2 outputs the second). Another thing we could do is to display the TRACE_ID if the command fails, e.g.
But I still think we'd want to a way to output the trace id explicitly on success. Regardless, I think we can have that feature separate from this issue/PR which is to actually set the trace id header. |
Since Currently, the usage is as follows:
As proposed by @Samze, we could introduce an integer level ranging from 0 to 7, where 7 indicates the most detailed output. Lower levels, such as 6 or 5, would display the request path and headers without including the request body. One approach to achieve this would be introducing a new variable called |
What's the user value of this feature request?
A single CLI command may result in multiple CAPI API requests. A unique id (vcap-request-id) is generated by go-router per api request that allows tracing issues through the system. Additionally, when enabled go-router will generate b3-trace-headers per request.
However, if you want to trace ALL requests for a particular CF CLI command you cannot, since there is no trace id that is per command and not per API call. This makes it hard to debug issues with the CLI, or to understand all the requests made for a single command (e.g. cf push).
The CLI should generate a unique ID per command and utilise the distributed b3 trace headers, see here.
This means if there is an issue, a developer can run
CF_TRACE=true
and see the generated b3 trace headers which can then be correlated to logs in the CF system by opeators.Headers to set per command:
Headers to set per api call
These then will be logged in different CF components, including CAPI, e.g. capi log
It should also be possible to explicitly set the trace header.
We should introduce the following new environment variable.
In addition to this, if someone explicitly sets the header via
-H
using acf curl
that should take priority.So the order of priority of this header is:
Who is the functionality for?
Operators debugging CF issues.
Who else is affected by the change?
Currently b3 headers are generated by go-router, this would mean that CLI requests no longer contain unique b3 headers per request but rather per command.
The text was updated successfully, but these errors were encountered: