Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions docs/contributing/platforms/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,19 @@ A list of categories for future support. Known values are `browser`, `mobile`, `

The key to use for defaults. Can use full key syntax of `platformName` or `platformName.guideName`.

`fallbackGuide`

Guide-only. The fully qualified parent guide key, such as `javascript.node`.
The guide inherits shared-content support rules from this guide. Support is
resolved from the current guide through its fallback chain. An explicit
`supported` or `notSupported` entry for the current guide takes precedence over
inherited and category-based rules; otherwise, category exclusions take
precedence over inherited fallback support.

Use `fallbackGuide` when the guide implements the parent guide's documented
features and APIs. Use explicit support rules or guide-owned pages for exceptions.
Setting `inheritCommonContent: false` still disables all common-page inheritance.

`sdk`

The name of the SDK, if available. Used to embed SDK information on pages.
Expand Down
3 changes: 3 additions & 0 deletions docs/platforms/javascript/common/agent-tracing/flue.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ supported:
- javascript.node
- javascript.eve
- javascript.cloudflare
notSupported:
- javascript.firebase
- javascript.gcp-functions
---

[Flue](https://flueframework.com/) is an open TypeScript framework for building AI agents, made by the Astro team. Flue ships an official Sentry blueprint that installs the Sentry SDK, wires Flue's OpenTelemetry instrumentation into it, and bridges Flue's runtime events to Sentry. You don't need to add Sentry calls to each agent or tool.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
---
title: ContextLines
description: "Adds source code from inline JavaScript of the current page's HTML."
supported:
- javascript
- javascript.firebase
- javascript.elysia
notSupportedCategories:
- server-only
notSupported:
Expand Down
3 changes: 3 additions & 0 deletions docs/platforms/javascript/common/install/commonjs.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ supported:
- javascript.hapi
- javascript.hono
- javascript.koa
notSupported:
- javascript.firebase
- javascript.gcp-functions
---

<Alert>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,20 @@ supported:
- javascript.hapi
- javascript.hono
- javascript.koa
notSupported:
- javascript.firebase
- javascript.gcp-functions
---

<Alert>
Are you unsure if you should use this installation method? Review our
[installation methods](../).
</Alert>


When running your application in ESM mode, you will most likely want to <PlatformLink to="/install/esm">follow the ESM instructions</PlatformLink>. However, if you can't use the `--import` command line option, you can either use [direct imports](#direct-imports) or [SEA bootstrap setup](#nodejs-single-executable-applications) if you are using a Node.js Single Executable Application (SEA).

## Direct Imports


<Alert level='warning' title='Restrictions of this installation method'>

This installation method has the fundamental restriction that only native Node.js APIs can be instrumented (such as `fetch` and the `http` module).
Expand Down
3 changes: 3 additions & 0 deletions docs/platforms/javascript/common/install/esm.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ supported:
- javascript.hapi
- javascript.hono
- javascript.koa
notSupported:
- javascript.firebase
- javascript.gcp-functions
---

<Alert>
Expand Down
3 changes: 3 additions & 0 deletions docs/platforms/javascript/common/install/esm__v8.x.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ supported:
- javascript.hapi
- javascript.hono
- javascript.koa
notSupported:
- javascript.firebase
- javascript.gcp-functions
noindex: true
---

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ supported:
- javascript.hapi
- javascript.hono
- javascript.koa
notSupported:
- javascript.firebase
- javascript.gcp-functions
---

<Alert>
Expand Down
25 changes: 14 additions & 11 deletions docs/platforms/javascript/common/install/lightweight.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ supported:
- javascript.hapi
- javascript.hono
- javascript.koa
notSupported:
- javascript.firebase
- javascript.gcp-functions
---

<Alert level="warning">
Expand Down Expand Up @@ -141,13 +144,13 @@ setConversationId("conv_abc123");
## When to Use Lightweight Mode vs `@sentry/node`

| | `@sentry/node` | `@sentry/node-core/light` |
| ------------------------------- | ------------------- | ---------------------------------------------- |
| **Error tracking** | Yes | Yes |
| **Logs and metrics** | Yes | Yes |
| **Automatic spans** | Yes | No |
| **OpenTelemetry auto-included** | Yes | No |
| **Dependency footprint** | Larger | Minimal |
| **Best for** | Full observability | No auto-instrumentation, manual tracing setup |
| ------------------------------- | ------------------ | --------------------------------------------- |
| **Error tracking** | Yes | Yes |
| **Logs and metrics** | Yes | Yes |
| **Automatic spans** | Yes | No |
| **OpenTelemetry auto-included** | Yes | No |
| **Dependency footprint** | Larger | Minimal |
| **Best for** | Full observability | No auto-instrumentation, manual tracing setup |

If you need automatic spans for HTTP requests, database queries, and other operations, use `@sentry/node` (the default). If you don't need automatically created spans and want minimal dependencies, use lightweight mode.

Expand Down Expand Up @@ -205,7 +208,7 @@ otlpIntegration({

### Options

| Option | Type | Default | Description |
|---|---|---|---|
| `setupOtlpTracesExporter` | `boolean` | `true` | Automatically configure an exporter to send OTLP traces to the right project from the DSN or `collectorUrl`. Set to `false` to set up the `TracerProvider` manually. |
| `collectorUrl` | `string` | `undefined` | URL of your own OpenTelemetry collector. When set, traces are sent here instead of the Sentry OTLP endpoint derived from the DSN. |
| Option | Type | Default | Description |
| ------------------------- | --------- | ----------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `setupOtlpTracesExporter` | `boolean` | `true` | Automatically configure an exporter to send OTLP traces to the right project from the DSN or `collectorUrl`. Set to `false` to set up the `TracerProvider` manually. |
| `collectorUrl` | `string` | `undefined` | URL of your own OpenTelemetry collector. When set, traces are sent here instead of the Sentry OTLP endpoint derived from the DSN. |
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ If you are looking to simply add individual OpenTelemetry instrumentation to you

</Alert>

<PlatformSection supported={["javascript.node", "javascript.eve", "javascript.mastra", "javascript.connect", "javascript.express", "javascript.fastify", "javascript.hapi", "javascript.hono", "javascript.koa"]}>
<PlatformSection supported={["javascript.node"]} notSupported={["javascript.aws-lambda", "javascript.firebase", "javascript.gcp-functions", "javascript.nestjs", "javascript.nitro"]}>
<Alert>

If you don't need the full `@sentry/node` SDK and want a simpler way to bridge your existing OpenTelemetry setup with Sentry, consider using <PlatformLink to="/install/lightweight/#using-with-opentelemetry-otlp">lightweight mode with the OTLP integration</PlatformLink> instead. It requires significantly less manual wiring.
Expand Down
3 changes: 3 additions & 0 deletions docs/platforms/javascript/common/profiling/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ sidebar_title: Profiling
sidebar_order: 8
sidebar_section: features
description: "Collect & view performance insights for JavaScript programs with Sentry's Profiling integrations. Get started with profiling to understand your application's performance."
supported:
- javascript
- javascript.elysia
notSupported:
- javascript.bun
- javascript.cordova
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,11 @@ module.exports = {
sourcemaps: {
// As you're enabling client source maps, you probably want to delete them after they're uploaded to Sentry.
// Set the appropriate glob pattern for your output folder - some glob examples below:
filesToDeleteAfterUpload: ["./**/*.map", ".*/**/public/**/*.map", "./dist/**/client/**/*.map"]
filesToDeleteAfterUpload: [
"./**/*.map",
".*/**/public/**/*.map",
"./dist/**/client/**/*.map",
],
},

// Auth tokens can be obtained from
Expand Down Expand Up @@ -163,7 +167,11 @@ module.exports = {
sourcemaps: {
// As you're enabling client source maps, you probably want to delete them after they're uploaded to Sentry.
// Set the appropriate glob pattern for your output folder - some glob examples below:
filesToDeleteAfterUpload: ["./**/*.map", ".*/**/public/**/*.map", "./dist/**/client/**/*.map"]
filesToDeleteAfterUpload: [
"./**/*.map",
".*/**/public/**/*.map",
"./dist/**/client/**/*.map",
],
},

release: {
Expand Down Expand Up @@ -232,7 +240,11 @@ require("esbuild").build({
sourcemaps: {
// As you're enabling client source maps, you probably want to delete them after they're uploaded to Sentry.
// Set the appropriate glob pattern for your output folder - some glob examples below:
filesToDeleteAfterUpload: ["./**/*.map", ".*/**/public/**/*.map", "./dist/**/client/**/*.map"]
filesToDeleteAfterUpload: [
"./**/*.map",
".*/**/public/**/*.map",
"./dist/**/client/**/*.map",
],
},

release: {
Expand Down Expand Up @@ -328,7 +340,7 @@ To verify that the distribution has been set correctly in the SDK, open an issue

If you've uploaded source maps and they aren't applying to your code in an issue in Sentry, take a look at the JSON of the event and look for the `abs_path` to see exactly where we're attempting to resolve the file - for example, `http://localhost:8000/scripts/script.js` (`abs_path` will appear once for each frame in the stack trace - match this up with the file(s) that are not deminified.). A link to the JSON view can be found at the top of the issue page next to the date the event occurred. The uploaded artifact names must match these values.

If you have **dynamic values in your path** (for example, `https://www.site.com/{some_value}/scripts/script.js`), you may want to use the <PlatformSection notSupported={['javascript.node', 'javascript.connect', 'javascript.express', 'javascript.fastify', 'javascript.hapi', 'javascript.hono', 'javascript.koa', 'javascript.nestjs']}><PlatformLink to="/configuration/integrations/rewriteframes">`rewriteFrames` integration</PlatformLink></PlatformSection><PlatformSection supported={['javascript.node', 'javascript.connect', 'javascript.express', 'javascript.fastify', 'javascript.hapi', 'javascript.koa', 'javascript.nestjs']}><PlatformLink to="/configuration/integrations/pluggable-integrations/#rewriteframes">`rewriteFrames` integration</PlatformLink></PlatformSection> to change your `abs_path` values.
If you have **dynamic values in your path** (for example, `https://www.site.com/{some_value}/scripts/script.js`), you may want to use the <PlatformSection notSupported={['javascript.node']} supported={['javascript', 'javascript.aws-lambda', 'javascript.firebase', 'javascript.gcp-functions', 'javascript.nitro']}><PlatformLink to="/configuration/integrations/rewriteframes">`rewriteFrames` integration</PlatformLink></PlatformSection><PlatformSection supported={['javascript.node']} notSupported={['javascript.aws-lambda', 'javascript.firebase', 'javascript.gcp-functions', 'javascript.hono', 'javascript.nitro']}><PlatformLink to="/configuration/integrations/pluggable-integrations/#rewriteframes">`rewriteFrames` integration</PlatformLink></PlatformSection> to change your `abs_path` values.

#### Using sentry-cli

Expand Down
42 changes: 42 additions & 0 deletions src/commonContentInheritance.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ beforeAll(async () => {
'override',
'browser-guide',
'server-guide',
'node',
'express',
];

await Promise.all([
Expand All @@ -55,6 +57,28 @@ beforeAll(async () => {
path.join(commonPath, 'only-browser.mdx'),
frontmatter('Only browser', 'supportedCategories:\n - browser\n')
),
writeFile(
path.join(commonPath, 'node-only.mdx'),
frontmatter('Node only', 'supported:\n - test.node\n')
),
writeFile(
path.join(commonPath, 'not-on-node.mdx'),
frontmatter('Not on node', 'notSupported:\n - test.node\n')
),
writeFile(
path.join(commonPath, 'express-override.mdx'),
frontmatter(
'Express override',
'supported:\n - test.express\nnotSupported:\n - test.node\n'
)
),
writeFile(
path.join(commonPath, 'node-page-excluded-from-server.mdx'),
frontmatter(
'Node page excluded from server',
'supported:\n - test.node\nnotSupportedCategories:\n - server\n'
)
),
writeFile(
path.join(guidesPath, 'index-opt-out', 'index.mdx'),
frontmatter('Index opt-out', 'inheritCommonContent: false\n')
Expand Down Expand Up @@ -84,6 +108,11 @@ beforeAll(async () => {
path.join(guidesPath, 'server-guide', 'index.mdx'),
frontmatter('Server guide', 'categories:\n - server\n')
),
writeFile(path.join(guidesPath, 'node', 'index.mdx'), frontmatter('Node')),
writeFile(
path.join(guidesPath, 'express', 'index.mdx'),
frontmatter('Express', 'fallbackGuide: test.node\ncategories:\n - server\n')
),
writeFile(
path.join(guidesPath, 'override', 'index.mdx'),
frontmatter('Override', 'inheritCommonContent: false\n')
Expand Down Expand Up @@ -139,6 +168,19 @@ describe.each([
expect(slugs.has('platforms/test/guides/browser-guide/only-browser')).toBe(true);
expect(slugs.has('platforms/test/guides/server-guide/only-browser')).toBe(false);
});

test('inherits support rules through fallbackGuide with exact overrides', async () => {
const slugs = new Set(
(await collectFrontmatter(docsPath)).map(({slug}) => slug.replace(/\/index$/, ''))
);

expect(slugs.has('platforms/test/guides/express/node-only')).toBe(true);
expect(slugs.has('platforms/test/guides/express/not-on-node')).toBe(false);
expect(slugs.has('platforms/test/guides/express/express-override')).toBe(true);
expect(
slugs.has('platforms/test/guides/express/node-page-excluded-from-server')
).toBe(false);
});
});

describe('getSourcePathsBySlug', () => {
Expand Down
78 changes: 42 additions & 36 deletions src/components/platformSection/index.tsx
Original file line number Diff line number Diff line change
@@ -1,19 +1,49 @@
import {DocNode, getCurrentPlatformOrGuide, getPlatform} from 'sentry-docs/docTree';
import {
DocNode,
getCurrentPlatformOrGuide,
getGuide,
getPlatform,
} from 'sentry-docs/docTree';
import {isPlatformSupported as resolvePlatformSupport} from 'sentry-docs/platformSupport';
import {serverContext} from 'sentry-docs/serverContext';
import {Platform, PlatformGuide} from 'sentry-docs/types';

import styles from './style.module.css';

function getPlatformsWithFallback(
function getPlatformSupportKeys(
rootNode: DocNode,
platformOrGuide: Platform | PlatformGuide
) {
const result = [platformOrGuide.key];
let curPlatform: Platform | PlatformGuide | undefined = platformOrGuide;
while (curPlatform?.fallbackPlatform) {
result.push(curPlatform.fallbackPlatform);
curPlatform = getPlatform(rootNode, curPlatform.fallbackPlatform);
): string[] {
const result: string[] = [];
const visited = new Set<string>();
let current: Platform | PlatformGuide | undefined = platformOrGuide;

while (current && !visited.has(current.key)) {
result.push(current.key);
visited.add(current.key);

if (current.type === 'guide') {
const parentPlatform = current.platform;
if (current.fallbackGuide && !visited.has(current.fallbackGuide)) {
const fallbackGuide = current.fallbackGuide;
const [platform, ...guideParts] = fallbackGuide.split('.');
const fallback = getGuide(rootNode, platform, guideParts.join('.'));
if (fallback) {
current = fallback;
continue;
}
result.push(fallbackGuide);
visited.add(fallbackGuide);
}
current = getPlatform(rootNode, parentPlatform);
continue;
}

current = current.fallbackPlatform
? getPlatform(rootNode, current.fallbackPlatform)
: undefined;
}

return result;
}

Expand All @@ -25,20 +55,6 @@ type Props = {
supported?: string[];
};

const isSupported = (
platformKey: string,
supported: string[],
notSupported: string[]
): boolean | null => {
if (supported.length && supported.find(p => p === platformKey)) {
return true;
}
if (notSupported.length && notSupported.find(p => p === platformKey)) {
return false;
}
return null;
};

/**
* Resolves the same `supported` / `notSupported` rules as `PlatformSection`
* for a platform or guide, walking its fallback chain.
Expand All @@ -49,20 +65,10 @@ export function isPlatformSupported(
supported: string[] = [],
notSupported: string[] = []
): boolean {
const platformsToSearch = getPlatformsWithFallback(rootNode, platformOrGuide);

let result: boolean | null = null;

for (const platformKey of platformsToSearch) {
result = isSupported(platformKey, supported, notSupported);
if (result !== null) {
break;
}
}
if (result === false) {
return false;
}
return result === true || supported.length === 0;
return resolvePlatformSupport(getPlatformSupportKeys(rootNode, platformOrGuide), {
supported,
notSupported,
});
}

/**
Expand Down
Loading
Loading