[공통] GTM Dynatrace 태그 ReferenceError 수정#1279
Conversation
- _document.tsx: GTM보다 먼저 dtrum stub을 주입해 ReferenceError 방지 - instrumentation-client.ts: ignoreErrors에 dtrum 패턴 추가 (안전망) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
WalkthroughGTM에서 Dynatrace RUM 스크립트가 로드되지 않을 때 발생하는 ChangesDynatrace RUM 오류 억제
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/instrumentation-client.ts`:
- Around line 12-14: The ignoreErrors regex pattern for dtrum errors is too
narrow and doesn't account for browser-specific variations in error messages
(such as Safari variants), causing Sentry to still capture these errors. Broaden
the regex pattern in the ignoreErrors array to match multiple variations of the
dtrum error message that might occur across different browsers, ensuring that
all common variants of the same underlying error are caught and filtered
appropriately.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 8e5da3af-bbb4-45ff-9e67-c854440d1a8a
📒 Files selected for processing (2)
src/instrumentation-client.tssrc/pages/_document.tsx
| // GTM이 Dynatrace RUM 태그를 실행할 때 dtrum 스크립트가 없으면 발생하는 서드파티 에러 | ||
| ignoreErrors: [/dtrum is not defined/], | ||
|
|
There was a problem hiding this comment.
ignoreErrors 패턴이 너무 좁아 동일 원인 에러가 일부 남을 수 있습니다.
현재 정규식 하나만으로는 브라우저별 메시지 변형(예: Safari 계열)을 놓쳐 Sentry 노이즈가 계속 발생할 수 있습니다.
확장 예시
- ignoreErrors: [/dtrum is not defined/],
+ ignoreErrors: [
+ /dtrum is not defined/i,
+ /can't find variable:\s*dtrum/i,
+ /\bdtrum\b.*\bundefined\b/i,
+ ],📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| // GTM이 Dynatrace RUM 태그를 실행할 때 dtrum 스크립트가 없으면 발생하는 서드파티 에러 | |
| ignoreErrors: [/dtrum is not defined/], | |
| // GTM이 Dynatrace RUM 태그를 실행할 때 dtrum 스크립트가 없으면 발생하는 서드파티 에러 | |
| ignoreErrors: [ | |
| /dtrum is not defined/i, | |
| /can't find variable:\s*dtrum/i, | |
| /\bdtrum\b.*\bundefined\b/i, | |
| ], |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@src/instrumentation-client.ts` around lines 12 - 14, The ignoreErrors regex
pattern for dtrum errors is too narrow and doesn't account for browser-specific
variations in error messages (such as Safari variants), causing Sentry to still
capture these errors. Broaden the regex pattern in the ignoreErrors array to
match multiple variations of the dtrum error message that might occur across
different browsers, ensuring that all common variants of the same underlying
error are caught and filtered appropriately.
What is this PR? 🔍
Changes 📝
dtrum호출 전 존재 여부 체크 추가 (typeof dtrum !== 'undefined')관련 파일 2개 수정
Sentry: https://sentry.io/issues/7566813565
Environment: stage
자동 분석 브랜치:
fix/sentry-7566813565Precaution
AI 테스트 중...
✔️ Please check if the PR fulfills these requirements
developbranch unconditionally?main?yarn lintSummary by CodeRabbit