feat(hub): populate runtime/host/release/request_id columns, honor environment, expose metadata in recent-errors (BIT-33316)
Paperclip-Issue: BIT-33316
This commit is contained in:
1 parent
baac48a632
commit
b757ec671a
4 files changed
+115
-2
No files matched your search
@@ -65,6 +65,15 @@ function extractFileLine(ctx: Record<string, unknown> | null): { file_path: stri
|
||||
return { file_path, line_number };
|
||||
}
|
||||
|
||||
function ctxStr(ctx: Record<string, unknown> | null, keys: string[]): string {
|
||||
if (!ctx) return '';
|
||||
for (const k of keys) {
|
||||
const v = ctx[k];
|
||||
if (typeof v === 'string' && v.trim() !== '') return v.trim();
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
/** Paperclip error loop reads top-level `gitea_repo` on each recent-error row. */
|
||||
function extractGiteaRepo(ctx: Record<string, unknown> | null): string {
|
||||
if (!ctx) {
|
||||
@@ -300,6 +309,15 @@ async function handleRecentErrors(request: FastifyRequest, reply: FastifyReply):
|
||||
if (gitea_repo !== '') {
|
||||
rowOut.gitea_repo = gitea_repo;
|
||||
}
|
||||
const extra: Record<string, string> = {
|
||||
component: ctxStr(ctx, ['component']),
|
||||
release_version: ctxStr(ctx, ['release_version', 'release', 'app_version']),
|
||||
runtime_name: ctxStr(ctx, ['runtime_name', 'runtime']),
|
||||
host_name: ctxStr(ctx, ['host_name', 'hostname', 'host']),
|
||||
};
|
||||
for (const [k, v] of Object.entries(extra)) {
|
||||
if (v !== '') rowOut[k] = v;
|
||||
}
|
||||
if (paperclip_project_id !== '') {
|
||||
rowOut.paperclip_project_id = paperclip_project_id;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user