-
Notifications
You must be signed in to change notification settings - Fork 25
Add Sentry monitoring with browser tracing and session replay #38
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
Conversation
Co-authored-by: Sunwuyuan <88357633+Sunwuyuan@users.noreply.github.com>
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
Co-authored-by: Sunwuyuan <88357633+Sunwuyuan@users.noreply.github.com>
代码审查反馈总体评价这个 PR 成功集成了 Sentry 监控系统,用于错误追踪、性能监控和会话回放。总体实现正确,但有几个需要注意的问题。 ✅ 优点
|
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.
Pull request overview
Integrates Sentry into the Vue app to capture errors, performance traces, and session replays.
Changes:
- Added
@sentry/vuedependency. - Initialized Sentry in
src/main.jswith browser tracing (router-based) and session replay. - Enabled tracing/logging options and configured sampling + trace propagation targets.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 6 comments.
| File | Description |
|---|---|
| src/main.js | Adds Sentry initialization with tracing, replay, and logging configuration before plugin registration. |
| package.json | Adds @sentry/vue dependency required for Sentry SDK integration. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
| Sentry.init({ | ||
| app, | ||
| dsn: "https://2f8e5e4ec986c6077d3798ba9f683fdd@o4510762489151488.ingest.us.sentry.io/4510762503438336", |
Copilot
AI
Jan 24, 2026
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.
The Sentry DSN is hard-coded in source. Please load it from an environment variable (e.g., import.meta.env.VITE_SENTRY_DSN) and consider skipping Sentry.init (or setting enabled: false) when the DSN isn’t provided, so different environments/forks don’t report into the same Sentry project.
| Sentry.init({ | ||
| app, | ||
| dsn: "https://2f8e5e4ec986c6077d3798ba9f683fdd@o4510762489151488.ingest.us.sentry.io/4510762503438336", | ||
| // Setting this option to true will send default PII data to Sentry. | ||
| // For example, automatic IP address collection on events | ||
| sendDefaultPii: true, |
Copilot
AI
Jan 24, 2026
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.
sendDefaultPii: true enables sending default PII to Sentry. This should be gated via environment/config (and ideally user consent) so production builds can disable it when required.
| Sentry.init({ | |
| app, | |
| dsn: "https://2f8e5e4ec986c6077d3798ba9f683fdd@o4510762489151488.ingest.us.sentry.io/4510762503438336", | |
| // Setting this option to true will send default PII data to Sentry. | |
| // For example, automatic IP address collection on events | |
| sendDefaultPii: true, | |
| const enableDefaultPii = | |
| typeof process !== 'undefined' && | |
| process.env && | |
| process.env.VUE_APP_SENTRY_SEND_DEFAULT_PII === 'true'; | |
| Sentry.init({ | |
| app, | |
| dsn: "https://2f8e5e4ec986c6077d3798ba9f683fdd@o4510762489151488.ingest.us.sentry.io/4510762503438336", | |
| // Setting this option to true will send default PII data to Sentry. | |
| // For example, automatic IP address collection on events | |
| // Controlled via the VUE_APP_SENTRY_SEND_DEFAULT_PII environment variable. | |
| sendDefaultPii: enableDefaultPii, |
| // Set 'tracePropagationTargets' to control for which URLs distributed tracing should be enabled | ||
| tracePropagationTargets: ["localhost", /^https:\/\/kv-service\.(houlang\.cloud|wuyuan\.dev)/], | ||
| // Session Replay | ||
| replaysSessionSampleRate: 0.01, // This sets the sample rate at 10%. You may want to change it to 100% while in development and then sample at a lower rate in production. |
Copilot
AI
Jan 24, 2026
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.
The replaysSessionSampleRate value (0.01 = 1%) doesn’t match the comment saying 10%. Please either update the value to 0.1 or fix the comment to reflect the intended sampling rate.
| replaysSessionSampleRate: 0.01, // This sets the sample rate at 10%. You may want to change it to 100% while in development and then sample at a lower rate in production. | |
| replaysSessionSampleRate: 0.01, // This sets the sample rate at 1%. You may want to change it to 100% while in development and then sample at a lower rate in production. |
| tracesSampleRate: 1.0, // Capture 100% of the transactions | ||
| // Set 'tracePropagationTargets' to control for which URLs distributed tracing should be enabled |
Copilot
AI
Jan 24, 2026
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.
tracesSampleRate: 1.0 captures 100% of transactions and can create significant overhead/cost in production. Consider making this environment-based (or using tracesSampler) so production can sample at a lower rate.
| // Logs | ||
| enableLogs: true |
Copilot
AI
Jan 24, 2026
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.
enableLogs: true will increase data volume and may capture sensitive information depending on what gets logged. Please make this configurable per environment (and/or add scrubbing) so production can disable it if needed.
| "@fingerprintjs/fingerprintjs": "^5.0.1", | ||
| "@mdi/font": "7.4.47", | ||
| "@microsoft/clarity": "^1.0.2", | ||
| "@sentry/vue": "^10.36.0", |
Copilot
AI
Jan 24, 2026
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 PR adds a new dependency but doesn’t update the lockfile (the repo contains pnpm-lock.yaml). Please regenerate and commit the lockfile so installs/CI are reproducible.
| "@sentry/vue": "^10.36.0", |
Integrates Sentry SDK for error tracking, performance monitoring, and session replay capabilities.
Changes
@sentry/vue@^10.36.0main.jsbefore plugin registration with:Configuration Notes
tracePropagationTargetsincludes placeholderyourserver.io- update to match actual API endpointsOriginal prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.