Support request tracing for REST calls by setting a header in the request At the moment request tracing for REST calls is enabled by setting the 'trace' or 'trace=<trace-id>' request parameter. This is good for manual use since adding the request parameter to the URL is very easy and can be done quickly. For providing copy-pastable examples for how to do tracing this is not ideal, since it depends on the concrete URL how the request parameter would need to be set, e.g. it can be that '?trace' or '&trace' needs to be appended depending on whether the URL already contains request parameters or not. With this change we now support enabling request tracing for REST calls also by setting a 'X-Gerrit-Trace' header in the request. For manual use this is less easy but it makes providing copy-pastable examples for how to do tracing easier as one can now do: curl -D /tmp/gerrit -H X-Gerrit-Trace URL grep X-Gerrit-Trace /tmp/gerrit Change-Id: I793ca9fff83ef23f5720390931599a9a85e868c7 Signed-off-by: Edwin Kempin <ekempin@google.com>
diff --git a/Documentation/rest-api.txt b/Documentation/rest-api.txt index 97cca38..8f6a47b 100644 --- a/Documentation/rest-api.txt +++ b/Documentation/rest-api.txt
@@ -210,6 +210,15 @@ GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/suggest_reviewers?trace&q=J ---- +Alternatively request tracing can also be enabled by setting the +`X-Gerrit-Trace` header: + +.Example Request +---- + GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/suggest_reviewers?q=J + X-Gerrit-Trace: issue/123 +---- + Enabling tracing results in additional logs with debug information that are written to the `error_log`. All logs that correspond to the traced request are associated with the trace ID. The trace ID is returned with