Skip to content

[log] log requestId #18688

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

Merged
merged 1 commit into from
Sep 11, 2023
Merged

[log] log requestId #18688

merged 1 commit into from
Sep 11, 2023

Conversation

svenefftinge
Copy link
Contributor

@svenefftinge svenefftinge commented Sep 8, 2023

Description

This change will automatically add a requstId as well as the userID to any requets done through the websocket.

Summary generated by Copilot

🤖 Generated by Copilot at 604eea2

This pull request improves the logging of JSON-RPC requests from the websocket clients by adding request IDs and user IDs to the log context. It also introduces a new file log-context.ts that implements a global context augmenter and a helper function for running functions with the context.

Related Issue(s)

Fixes EXP-590

How to test

Check the logs of server when doing requests and verify that the same unique requestId is used in all log messages per request.

Documentation

Preview status

Gitpod was successfully deployed to your preview environment.

  • 🏷️ Name - se-log-context
  • 🔗 URL - se-log-context.preview.gitpod-dev.com/workspaces.
  • 📚 Documentation - See our internal documentation for information on how to interact with your preview environment.
  • 📦 Version -
  • 🗒️ Logs - GCP Logs Explorer
  • Build Options

    Build
    • /werft with-werft
      Run the build with werft instead of GHA
    • leeway-no-cache
    • /werft no-test
      Run Leeway with --dont-test
    Publish
    • /werft publish-to-npm
    • /werft publish-to-jb-marketplace
    Installer
    • analytics=segment
    • with-dedicated-emulation
    • workspace-feature-flags
      Add desired feature flags to the end of the line above, space separated
    Preview Environment / Integration Tests
    • /werft with-local-preview
      If enabled this will build install/preview
    • /werft with-preview
    • /werft with-large-vm
    • /werft with-gce-vm
      If enabled this will create the environment on GCE infra
    • with-integration-tests=all
      Valid options are all, workspace, webapp, ide, jetbrains, vscode, ssh. If enabled, with-preview and with-large-vm will be enabled.
    • with-monitoring

    /hold

@mustard-mh
Copy link
Contributor

mustard-mh commented Sep 8, 2023

Will be good if requestId could be a part of trace by default (and respond header field?)

@akosyakov
Copy link
Member

akosyakov commented Sep 11, 2023

/gh run recreate-vm=true

Comment triggered a workflow run

Started workflow run: 6142495838

  • recreate_vm: true

Copy link
Member

@akosyakov akosyakov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

code looks good, i have not tried since preview is down

Copy link
Member

@akosyakov akosyakov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but confirmed from GCP logs from last Friday https://cloudlogging.app.goo.gl/yuLzNR3yspCiJZcG7

const userId = this.clientMetadata.userId;
return runWithContext(
{
requestId: v4(),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(out of scope here) Would be great to discuss the structure of this shape a bit, and evolbe the old "OWI" approch.

Copy link
Contributor Author

@svenefftinge svenefftinge Sep 11, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, we should discuss our approach to tracing generally

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

btw what does OWI stand for?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OWI - owner workspace instance. The flat structure we use to tag logs and traces.

@geropl
Copy link
Member

geropl commented Sep 11, 2023

Will be good if requestId could be a part of trace by default

Was thinking in the same direction: That could be achieved here.

Copy link
Member

@geropl geropl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code LGTM ✔️

@svenefftinge
Copy link
Contributor Author

/unhold

@roboquat roboquat merged commit 225040d into main Sep 11, 2023
@roboquat roboquat deleted the se/log-context branch September 11, 2023 08:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants