-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
replace trace_metrics with traceMetrics
#15972
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
base: master
Are you sure you want to change the base?
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
1 Skipped Deployment
|
| ```php | ||
| // Record five total button clicks | ||
| \Sentry\trace_metrics()->count('button-click', 5, ['browser' => 'Firefox', 'app_version' => '1.0.0']); | ||
| \Sentry\traceMetrics()->count('button-click', 5, ['browser' => 'Firefox', 'app_version' => '1.0.0']); |
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.
Bug: The documentation incorrectly uses \Sentry\traceMetrics() instead of the correct PHP SDK function \Sentry\trace_metrics(), which will cause a fatal error for users.
Severity: CRITICAL
🔍 Detailed Analysis
The documentation was updated to reference the function \Sentry\traceMetrics(). However, the correct function name in the Sentry PHP SDK is \Sentry\trace_metrics(). Users who copy the provided code examples will encounter a fatal "Call to undefined function \Sentry\traceMetrics()" error at runtime. This change affects all PHP documentation (vanilla, Laravel, and Symfony), effectively breaking the metrics feature for any developer following the official guides.
💡 Suggested Fix
Revert all instances of \Sentry\traceMetrics() back to the correct function name, \Sentry\trace_metrics(), across all updated PHP documentation files (php.mdx, php.laravel.mdx, php.symfony.mdx).
🤖 Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent.
Verify if this is a real issue. If it is, propose a fix; if not, explain why it's not
valid.
Location: platform-includes/metrics/usage/php.laravel.mdx#L13
Potential issue: The documentation was updated to reference the function
`\Sentry\traceMetrics()`. However, the correct function name in the Sentry PHP SDK is
`\Sentry\trace_metrics()`. Users who copy the provided code examples will encounter a
fatal "Call to undefined function \Sentry\traceMetrics()" error at runtime. This change
affects all PHP documentation (vanilla, Laravel, and Symfony), effectively breaking the
metrics feature for any developer following the official guides.
Did we get this right? 👍 / 👎 to inform future reviews.
Reference ID: 8491052
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.
Correct, but once we merged the referenced PR in the comment it will resolve just fine
DESCRIBE YOUR PR
Merge this once getsentry/sentry-php#1995 was merged and released
IS YOUR CHANGE URGENT?
Help us prioritize incoming PRs by letting us know when the change needs to go live.
SLA
Thanks in advance for your help!
PRE-MERGE CHECKLIST
Make sure you've checked the following before merging your changes:
LEGAL BOILERPLATE
Look, I get it. The entity doing business as "Sentry" was incorporated in the State of Delaware in 2015 as Functional Software, Inc. and is gonna need some rights from me in order to utilize my contributions in this here PR. So here's the deal: I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Sentry can use, modify, copy, and redistribute my contributions, under Sentry's choice of terms.
EXTRA RESOURCES