Skip to content

Commit

Permalink
[server] also log the actual request name (#18812)
Browse files Browse the repository at this point in the history
  • Loading branch information
svenefftinge authored Sep 27, 2023
1 parent ec8ca77 commit e393546
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion components/server/src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ export class Server {
app.use(async (req: express.Request, res: express.Response, next: express.NextFunction) => {
try {
const userId = req.user ? req.user.id : undefined;
await runWithContext("http", { userId }, () => next());
await runWithContext("http", { userId, requestPath: req.path }, () => next());
} catch (err) {
next(err);
}
Expand Down
2 changes: 1 addition & 1 deletion components/server/src/util/log-context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ LogContext.setAugmenter(augmenter);

export async function runWithContext<T>(
contextKind: string,
context: LogContext & { contextId?: string },
context: LogContext & { contextId?: string } & any,
fun: () => T,
): Promise<T> {
return asyncLocalStorage.run(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -382,6 +382,7 @@ class GitpodJsonRpcProxyFactory<T extends object> extends JsonRpcProxyFactory<T>
{
userId,
contextId: requestId,
method,
},
() => {
try {
Expand Down

0 comments on commit e393546

Please sign in to comment.