-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
docs(nextjs): Add Next.js-specific metrics documentation #15997
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.
|
5348649 to
8d64886
Compare
8d64886 to
c64b50e
Compare
c64b50e to
deec4c2
Compare
032051d to
c17a4f9
Compare
chargome
left a comment
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 love the change! I would just rather not have different versions of the metrics documentation for js out there as we would have to maintain them all, wdyt of rolling this out for all js docs and just adding the "Nextjs Patterns" part specifically here?
| |------|---------| | ||
| | `count` | Events (orders, clicks, API calls) | | ||
| | `gauge` | Current values (queue depth, connections) | | ||
| | `distribution` | Value ranges (response times, payload sizes) | |
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.
| beta: true | ||
| --- | ||
|
|
||
| Sentry Metrics let you track custom application data beyond errors and traces. Track business metrics like orders processed, API response times, or cache hit rates across all Next.js runtimes. |
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.
| Sentry Metrics let you track custom application data beyond errors and traces. Track business metrics like orders processed, API response times, or cache hit rates across all Next.js runtimes. | |
| [Sentry Metrics](/product/explore/metrics/) let you track custom application data beyond errors and traces. Track business metrics like orders processed, API response times, or cache hit rates across all Next.js runtimes. |
We say almost nothing about the value prop of this feature here. We need to at least link out to the product docs.
|
|
||
| ## Options | ||
|
|
||
| Configure these options in **all three runtime files** (`instrumentation-client.ts`, `sentry.server.config.ts`, `sentry.edge.config.ts`). |
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.
Are we assuming that of someone has gotten this far, they know about the config of these files already? Is there something we could link to that references the sentry-specific config files?
|
|
||
| ### Flush Metrics | ||
|
|
||
| Metrics are buffered and sent periodically. To flush immediately: |
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.
| Metrics are buffered and sent periodically. To flush immediately: | |
| Metrics are buffered and sent periodically. Use this snippet ot flush immediately - |
| **If user is set:** | ||
| - `user.id`, `user.name`, `user.email` | ||
|
|
||
| **Client-side:** | ||
| - `browser.name`, `browser.version`, `sentry.replay_id` | ||
|
|
||
| **Server-side:** | ||
| - `server.address` | ||
|
|
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 can't tell why these are formatted differently. I'd add them to the table above and just have a note for "if user is set", "client-side", "server-side".
sfanahata
left a comment
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.
@chargome has a good point. This shouldn't be a blocker, per say, but could this be the common file with nextjs-specific references inserted in through includes?
Creates a dedicated metrics guide showing: - Metric types (count, gauge, distribution) - Next.js patterns (API routes, Server Actions, middleware) - Attribute best practices (avoid high-cardinality) - Quick reference tables Follows technical-docs skill principles: concise, pattern-focused, no redundant API documentation. Co-Authored-By: Claude Opus 4.5 <[email protected]>
- Move metrics content to common JS doc with SplitLayout format - Add Next.js-specific patterns as platform include - Delete dedicated Next.js metrics page (content now in common + includes) - Fix CSS width constraint to only apply on 1800px+ screens - Add link to product docs in intro - Consolidate Default Attributes into single table - Rename Requirements to Prerequisites with getting started link Addresses PR feedback from @chargome and @sfanahata Co-Authored-By: Claude Opus 4.5 <[email protected]>
Move inline SplitLayout content from common metrics doc to platform-include files where it belongs. This follows the docs architecture pattern and restores the original SEO description and alert text. Changes: - Restore common doc to use <PlatformContent> for usage/options/default-attributes - Move SplitLayout components to platform-includes/metrics/usage/javascript.mdx - Move options SplitLayout to platform-includes/metrics/options/javascript.mdx - Consolidate default-attributes into a cleaner table format Co-Authored-By: Claude <[email protected]>
Co-Authored-By: Claude <[email protected]>
- First/middle columns now use white-space: nowrap to keep config names, options, and short values compact - Only last column allows word-break for long descriptions - Revert SplitLayout styles to original 80% max-width with mobile override Co-Authored-By: Claude <[email protected]>
d9586fd to
4fd3901
Compare
Restore documentation for using getGlobalScope() and withScope() to set attributes that apply to all metrics (10.33.0+). Co-Authored-By: Claude <[email protected]>
- Add display: block and overflow-x: auto for horizontal scroll - Add min-width: 200px to last column to prevent squishing Co-Authored-By: Claude <[email protected]>
8f48c0c to
05a4343
Compare
| display: block; | ||
| overflow-x: auto; |
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: Setting display: block on <table> elements makes the border-collapse: collapse rule ineffective, causing incorrect border rendering and accessibility issues.
Severity: HIGH
Suggested Fix
To enable horizontal scrolling, wrap the <table> element in a container <div> and apply overflow-x: auto to the wrapper. Remove the display: block style from the table element itself to ensure border-collapse and other table-specific properties function correctly.
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: src/components/docPage/type.scss#L192-L193
Potential issue: In `src/components/docPage/type.scss`, setting `display: block` on
`<table>` elements is incompatible with the `border-collapse: collapse` property that is
also being applied. The `border-collapse` property only works on elements with `display:
table` or `display: inline-table`. Consequently, browsers will ignore the
`border-collapse` rule, causing table borders to render incorrectly (separated instead
of merged). This change will also negatively impact accessibility by altering the
semantic structure of tables for screen readers, and may lead to inconsistent column
width rendering.
Did we get this right? 👍 / 👎 to inform future reviews.

Closes https://linear.app/getsentry/issue/DEVEX-227/metrics
Summary
Why Override?
The common metrics doc shows generic JavaScript examples. This override adds:
Test plan
/platforms/javascript/guides/nextjs/metrics/🤖 Generated with Claude Code