Skip to content

Commit bc83790

Browse files
authored
Merge branch 'master' into feat/java-profiling
2 parents 9810ea1 + 6d9bc4f commit bc83790

File tree

22 files changed

+633
-156
lines changed

22 files changed

+633
-156
lines changed

app/api/ip-ranges/ip-ranges.json

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,18 @@
1818
],
1919
"organization_subdomains": {
2020
"us": [
21-
"34.120.195.249/32"
21+
"34.120.195.249/32",
22+
"34.160.81.0/32",
23+
"34.102.210.18/32",
24+
"2600:1901:0:5e8a::/64",
25+
"2600:1901:0:7edb::/64"
2226
],
2327
"eu": [
2428
"34.120.62.213/32",
25-
"130.211.36.74/32"
29+
"34.160.81.0/32",
30+
"34.102.210.18/32",
31+
"2600:1901:0:5e8a::/64",
32+
"2600:1901:0:7edb::/64"
2633
]
2734
},
2835
"legacy": [
@@ -59,4 +66,4 @@
5966
"35.204.169.245"
6067
]
6168
}
62-
}
69+
}

develop-docs/sdk/telemetry/metrics.mdx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -425,6 +425,18 @@ By default, Relay should parse the user agent attached to an incoming metric env
425425
}
426426
```
427427

428+
#### Backend SDKs
429+
430+
For backend SDKs (Node.js, Python, PHP, etc.), the SDKs should attach the following:
431+
432+
1. `server.address`: The address of the server that sent the log. Equivalent to [`server_name`](sdk/data-model/event-payloads/#optional-attributes) we attach to errors and transactions.
433+
434+
```json
435+
{
436+
"server.address": "foo.example.com"
437+
}
438+
```
439+
428440
#### Future Default Attributes
429441

430442
The SDKs should aim to minimize the number of default attributes attached to a metric. Metrics cardinality can explode quickly with too many attributes, and we want to keep metrics lightweight and cost-effective.

develop-docs/sdk/telemetry/spans/span-protocol.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ Attributes are stored as key-value pairs where each value is an object with type
165165
#### Common Attribute Keys
166166

167167
All attributes mentioned below must be attached to every span being emitted from the SDK, depending on the platform.
168-
Empty attributes must be emitted.
168+
Empty attributes must be omitted.
169169

170170
| Attribute Key | Type | Description |
171171
|---------------|------|-------------|

docs/platforms/apple/guides/ios/size-analysis/index.mdx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@ description: Upload iOS builds to Sentry for size analysis.
3838

3939
<Include name="size-analysis/app-thinning" />
4040

41+
### Binary Code Signature
42+
43+
<Include name="size-analysis/binary-code-signature" />
44+
4145
### App Store Connect File Sizes
4246

4347
<Include name="size-analysis/app-store-connect-file-sizes" />

docs/platforms/javascript/common/index.mdx

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,25 +4,31 @@
44

55
<PlatformContent includePath="llm-rules-platform" />
66

7-
<Alert title="Using a framework?">
7+
<Alert title="Using a framework?" level="warning">
88

9-
Check out the other SDKs we support in the left-hand dropdown.
9+
This guide focuses on plain JavaScript. If you're working with React, Next.js, or any other framework, choose the fitting SDK from the left-hand dropdown.
1010

1111
</Alert>
1212

1313
<PlatformContent includePath="getting-started-primer" />
1414

1515
</PlatformSection>
1616

17-
<PlatformSection supported={["javascript", "javascript.angular", "javascript.nextjs", "javascript.remix", "javascript.sveltekit", "javascript.bun", "javascript.ember", "javascript.angular", "javascript.deno","javascript.nuxt", "javascript.react", "javascript.solid", "javascript.svelte", "javascript.vue"]}>
17+
<PlatformSection supported={["javascript"]}>
18+
<PlatformContent includePath="getting-started-complete" />
19+
</PlatformSection>
20+
21+
<PlatformSection notSupported={["javascript"]}>
22+
23+
<PlatformSection supported={["javascript.angular", "javascript.nextjs", "javascript.remix", "javascript.sveltekit", "javascript.bun", "javascript.ember", "javascript.deno","javascript.nuxt", "javascript.react", "javascript.solid", "javascript.svelte", "javascript.vue"]}>
1824

1925
<PlatformContent includePath="getting-started-prerequisites" />
2026

2127
</PlatformSection>
2228

2329
<PlatformSection notSupported={["javascript.deno"]}>
2430

25-
<PlatformSection notSupported={["javascript", "javascript.astro", "javascript.cordova", "javascript.nextjs", "javascript.nuxt", "javascript.remix", "javascript.solidstart", "javascript.sveltekit", "javascript.bun", "javascript.cloudflare", "javascript.react-router"]}>
31+
<PlatformSection notSupported={["javascript.astro", "javascript.cordova", "javascript.nextjs", "javascript.nuxt", "javascript.remix", "javascript.solidstart", "javascript.sveltekit", "javascript.bun", "javascript.cloudflare", "javascript.react-router"]}>
2632

2733
## Features
2834

@@ -39,20 +45,24 @@ Select which Sentry features you'd like to install in addition to Error Monitori
3945
</PlatformSection>
4046

4147
<PlatformSection notSupported={["javascript.nextjs"]}>
42-
43-
## Install
44-
48+
## Step 1: Install
4549
</PlatformSection>
4650

4751
<PlatformCategorySection notSupported={["server"]}>
4852
<PlatformSection notSupported={["javascript", "javascript.cordova"]}>
4953
<OnboardingOptionButtons
50-
options={["error-monitoring", "performance", "session-replay", "user-feedback", "logs"]}
54+
options={[
55+
"error-monitoring",
56+
"performance",
57+
"session-replay",
58+
"user-feedback",
59+
"logs",
60+
]}
5161
/>
5262
</PlatformSection>
5363
</PlatformCategorySection>
5464

55-
<PlatformSection notSupported={["javascript", "javascript.astro", "javascript.cordova", "javascript.nextjs", "javascript.nuxt", "javascript.remix", "javascript.sveltekit", "javascript.bun", "javascript.capacitor", "javascript.ember", "javascript.angular", "javascript.react", "javascript.solid", "javascript.solidstart", "javascript.svelte", "javascript.vue", "javascript.cloudflare", "javascript.react-router"]}>
65+
<PlatformSection notSupported={["javascript.astro", "javascript.cordova", "javascript.nextjs", "javascript.nuxt", "javascript.remix", "javascript.sveltekit", "javascript.bun", "javascript.capacitor", "javascript.ember", "javascript.angular", "javascript.react", "javascript.solid", "javascript.solidstart", "javascript.svelte", "javascript.vue", "javascript.cloudflare", "javascript.react-router"]}>
5666

5767
In addition to capturing errors, you can monitor interactions between multiple services or applications by [enabling tracing](/concepts/key-terms/tracing/). You can also collect and analyze performance profiles from real users with [profiling](/product/explore/profiling/).
5868

@@ -140,3 +150,4 @@ To view and resolve the recorded error, log into [sentry.io](https://sentry.io)
140150
</PlatformSection>
141151

142152
<PlatformContent includePath="getting-started-next-steps" />
153+
</PlatformSection>
Lines changed: 211 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,211 @@
1+
---
2+
title: Instrument MCP Servers
3+
sidebar_order: 600
4+
description: "Learn how to manually instrument your code to use Sentry's MCP monitoring."
5+
supported:
6+
- javascript.node
7+
- javascript.aws-lambda
8+
- javascript.azure-functions
9+
- javascript.connect
10+
- javascript.express
11+
- javascript.fastify
12+
- javascript.gcp-functions
13+
- javascript.hapi
14+
- javascript.hono
15+
- javascript.koa
16+
- javascript.nestjs
17+
- javascript.bun
18+
- javascript.deno
19+
- javascript.nextjs
20+
- javascript.nuxt
21+
- javascript.astro
22+
- javascript.solidstart
23+
- javascript.sveltekit
24+
- javascript.remix
25+
- javascript.cloudflare
26+
- javascript.tanstackstart-react
27+
---
28+
29+
With Sentry's [MCP monitoring](/product/insights/ai/mcp/), you can track and debug MCP servers with full-stack context. You'll be able to monitor tool executions, prompt retrievals, resource access, and error rates. MCP monitoring data will be fully connected to your other Sentry data like logs, errors, and traces.
30+
31+
As a prerequisite to setting up MCP monitoring with JavaScript, you'll need to first <PlatformLink to="/tracing/">set up tracing</PlatformLink>. Once this is done, the JavaScript SDK will automatically instrument MCP servers created with supported libraries. If that doesn't fit your use case, you can use custom instrumentation described below.
32+
33+
## Automatic Instrumentation
34+
35+
The JavaScript SDK supports automatic instrumentation for MCP servers. We recommend adding the MCP integration to your Sentry configuration to automatically capture spans for MCP operations.
36+
37+
- <PlatformLink to="/integrations/mcp/">
38+
MCP (Model Context Protocol)
39+
</PlatformLink>
40+
41+
## Manual Instrumentation
42+
43+
For your MCP data to show up in Sentry, spans must be created with well-defined names and data attributes. See below for the different types of MCP operations you can instrument.
44+
45+
The [Sentry.startSpan()](/platforms/javascript/tracing/instrumentation/custom-instrumentation/#starting-a-span) method can be used to create these spans.
46+
47+
## Spans
48+
49+
### Tool Execution Span
50+
51+
<Include name="tracing/mcp-module/tool-execution-span" />
52+
53+
#### Example Tool Execution Span:
54+
55+
```javascript
56+
import * as Sentry from "@sentry/node";
57+
58+
Sentry.init({
59+
// ... your Sentry configuration
60+
});
61+
62+
// Example tool execution
63+
const toolName = "get_weather";
64+
const toolArguments = { city: "San Francisco" };
65+
66+
await Sentry.startSpan(
67+
{
68+
op: "mcp.server",
69+
name: `tools/call ${toolName}`,
70+
},
71+
async (span) => {
72+
// Set MCP-specific attributes
73+
span.setAttribute("mcp.tool.name", toolName);
74+
span.setAttribute("mcp.method.name", "tools/call");
75+
76+
// Set request metadata
77+
span.setAttribute("mcp.request.id", "req_123abc");
78+
span.setAttribute("mcp.session.id", "session_xyz789");
79+
span.setAttribute("mcp.transport", "stdio"); // or "http", "sse" for HTTP/WebSocket/SSE
80+
span.setAttribute("network.transport", "pipe"); // or "tcp" for HTTP/SSE
81+
82+
// Set tool arguments (optional, if send_default_pii=true)
83+
for (const [key, value] of Object.entries(toolArguments)) {
84+
span.setAttribute(`mcp.request.argument.${key}`, value);
85+
}
86+
87+
// Execute the tool
88+
try {
89+
const result = executeTool(toolName, toolArguments);
90+
91+
// Set result data
92+
span.setAttribute("mcp.tool.result.content", JSON.stringify(result));
93+
span.setAttribute("mcp.tool.result.is_error", false);
94+
95+
// Set result content count if applicable
96+
if (
97+
Array.isArray(result) ||
98+
(typeof result === "object" && result !== null)
99+
) {
100+
span.setAttribute(
101+
"mcp.tool.result.content_count",
102+
Array.isArray(result) ? result.length : Object.keys(result).length
103+
);
104+
}
105+
} catch (error) {
106+
span.setAttribute("mcp.tool.result.is_error", true);
107+
throw error;
108+
}
109+
}
110+
);
111+
```
112+
113+
### Prompt Retrieval Span
114+
115+
<Include name="tracing/mcp-module/prompt-retrieval-span" />
116+
117+
#### Example Prompt Retrieval Span:
118+
119+
```javascript
120+
import * as Sentry from "@sentry/node";
121+
122+
Sentry.init({
123+
// ... your Sentry configuration
124+
});
125+
126+
// Example prompt retrieval
127+
const promptName = "code_review";
128+
const promptArguments = { language: "python" };
129+
130+
await Sentry.startSpan(
131+
{
132+
op: "mcp.server",
133+
name: `prompts/get ${promptName}`,
134+
},
135+
async (span) => {
136+
// Set MCP-specific attributes
137+
span.setAttribute("mcp.prompt.name", promptName);
138+
span.setAttribute("mcp.method.name", "prompts/get");
139+
140+
// Set request metadata
141+
span.setAttribute("mcp.request.id", "req_456def");
142+
span.setAttribute("mcp.session.id", "session_xyz789");
143+
span.setAttribute("mcp.transport", "http");
144+
span.setAttribute("network.transport", "tcp");
145+
146+
// Set prompt arguments (optional, if send_default_pii=true)
147+
for (const [key, value] of Object.entries(promptArguments)) {
148+
span.setAttribute(`mcp.request.argument.${key}`, value);
149+
}
150+
151+
// Retrieve the prompt
152+
const promptResult = getPrompt(promptName, promptArguments);
153+
154+
// Set result data
155+
const messages = promptResult.messages || [];
156+
span.setAttribute("mcp.prompt.result.message_count", messages.length);
157+
158+
// For single-message prompts, set role and content
159+
if (messages.length === 1) {
160+
span.setAttribute("mcp.prompt.result.message_role", messages[0].role);
161+
// Content is PII, only set if send_default_pii=true
162+
span.setAttribute(
163+
"mcp.prompt.result.message_content",
164+
JSON.stringify(messages[0].content)
165+
);
166+
}
167+
}
168+
);
169+
```
170+
171+
### Resource Read Span
172+
173+
<Include name="tracing/mcp-module/resource-read-span" />
174+
175+
#### Example Resource Read Span:
176+
177+
```javascript
178+
import * as Sentry from "@sentry/node";
179+
180+
Sentry.init({
181+
// ... your Sentry configuration
182+
});
183+
184+
// Example resource access
185+
const resourceUri = "file:///path/to/resource.txt";
186+
187+
await Sentry.startSpan(
188+
{
189+
op: "mcp.server",
190+
name: `resources/read ${resourceUri}`,
191+
},
192+
async (span) => {
193+
// Set MCP-specific attributes
194+
span.setAttribute("mcp.resource.uri", resourceUri);
195+
span.setAttribute("mcp.method.name", "resources/read");
196+
197+
// Set request metadata
198+
span.setAttribute("mcp.request.id", "req_789ghi");
199+
span.setAttribute("mcp.session.id", "session_xyz789");
200+
span.setAttribute("mcp.transport", "http");
201+
span.setAttribute("network.transport", "tcp");
202+
203+
// Access the resource
204+
const resourceData = readResource(resourceUri);
205+
}
206+
);
207+
```
208+
209+
## Common Span Attributes
210+
211+
<Include name="tracing/mcp-module/common-span-attributes" />

docs/platforms/javascript/config.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
title: Browser JavaScript
2+
description: Learn how to manually set up Sentry in your JavaScript app and capture your first errors.
23
platformTitle: JavaScript
34
sidebar_title: JavaScript
45
caseStyle: camelCase

0 commit comments

Comments
 (0)