-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
[public-api] add request context #18853
Conversation
/gh run recreate-vm=true Comment triggered a workflow runStarted workflow run: 6382224387
|
/gh run recreate-vm=true Comment triggered a workflow runStarted workflow run: 6404429130
|
@@ -13,7 +12,7 @@ const commit = require("./config.json").commit; | |||
const originalConsoleError = console.error; | |||
|
|||
const metricsReporter = new MetricsReporter({ | |||
gitpodUrl: new GitpodHostUrl(window.location.href).withoutWorkspacePrefix().toString(), | |||
gitpodUrl: window.location.href, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it was a bug introduced with recent changes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it does not break in gitpod.io but on preview envs trimming prefix breaks host
grpc_service: string; | ||
grpc_method: string; | ||
} = { | ||
contextTimeMs: performance.now(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm capturing it here because otherwise i cannot handle async generators propely
async function call<T>(): Promise<T> { | ||
|
||
const apply = async <T>(): Promise<T> => { | ||
const verifyStartedAt = performance.now(); | ||
const user = await self.verify(context); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was wondering rather add a warning and more fine grain logging inside verify generally. But i worry about negative impact form logging itself. It is probably the hottest path.
callMs = performance.now() - callStartedAt; | ||
} | ||
log.debug("public api: done", { grpc_code, verifyMs, callMs }); | ||
// right now p99 for getLoggetInUser is around 100ms, using it as a threshold for now |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is going to be removed as soon as we figure out the issue
@@ -24,7 +24,7 @@ export class APIHelloService implements ServiceImpl<typeof HelloService> { | |||
} | |||
async *lotsOfReplies(req: LotsOfRepliesRequest, context: HandlerContext): AsyncGenerator<LotsOfRepliesResponse> { | |||
let count = req.previousCount || 0; | |||
while (true) { | |||
while (!context.signal.aborted) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it was a bug and we were leaking server streams here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code LGTM, tested and works ✔️
/unhold |
Description
Summary generated by Copilot
🤖 Generated by Copilot at 7f9d889
This pull request refactors the server API and util modules to improve logging and error handling of gRPC calls. It adds request IDs and logging context to the server API, and removes unnecessary async and await keywords from the util module.
Related Issue(s)
Fixes #
How to test
public-api: done
.Documentation
Preview status
Gitpod was successfully deployed to your preview environment.
Build Options
Build
Run the build with werft instead of GHA
Run Leeway with
--dont-test
Publish
Installer
Add desired feature flags to the end of the line above, space separated
Preview Environment / Integration Tests
If enabled this will build
install/preview
If enabled this will create the environment on GCE infra
Valid options are
all
,workspace
,webapp
,ide
,jetbrains
,vscode
,ssh
. If enabled,with-preview
andwith-large-vm
will be enabled./hold