feat: send unique request id as response header (#22218)
This commit is contained in:
parent
961585f1d9
commit
07ff74edc5
2 changed files with 7 additions and 1 deletions
|
|
@ -211,6 +211,9 @@ def process_response(response):
|
|||
if hasattr(frappe.local, "rate_limiter"):
|
||||
response.headers.extend(frappe.local.rate_limiter.headers())
|
||||
|
||||
if trace_id := frappe.monitor.get_trace_id():
|
||||
response.headers.extend({"X-Frappe-Request-Id": trace_id})
|
||||
|
||||
# CORS headers
|
||||
if hasattr(frappe.local, "conf"):
|
||||
set_cors_headers(response)
|
||||
|
|
|
|||
|
|
@ -523,6 +523,9 @@ frappe.request.report_error = function (xhr, request_opts) {
|
|||
|
||||
const copy_markdown_to_clipboard = () => {
|
||||
const code_block = (snippet) => "```\n" + snippet + "\n```";
|
||||
|
||||
let request_data = Object.assign({}, request_opts);
|
||||
request_data.request_id = xhr.getResponseHeader("X-Frappe-Request-Id");
|
||||
const traceback_info = [
|
||||
"### App Versions",
|
||||
code_block(JSON.stringify(frappe.boot.versions, null, "\t")),
|
||||
|
|
@ -531,7 +534,7 @@ frappe.request.report_error = function (xhr, request_opts) {
|
|||
"### Traceback",
|
||||
code_block(exc),
|
||||
"### Request Data",
|
||||
code_block(JSON.stringify(request_opts, null, "\t")),
|
||||
code_block(JSON.stringify(request_data, null, "\t")),
|
||||
"### Response Data",
|
||||
code_block(JSON.stringify(data, null, "\t")),
|
||||
].join("\n");
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue