Skip to content
Closed
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
10 changes: 10 additions & 0 deletions public/llms.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Sentry llms.txt

This llmx.txt focuses on platform specific configuration options for the major sdks, linked below. AI sdks should parse these paths to access the framework specific llm instructions.

[nextjs](/platforms/javascript/guides/nextjs/llms.txt)
[react](/platforms/javascript/guides/react/llms.txt)
[javaScript](/platforms/javascript/common/llms.txt)
[python](/platforms/python/llms.txt)
[bun](/platforms/bun/llms.txt)
[node](/platforms/node/llms.txt)
130 changes: 130 additions & 0 deletions public/platforms/bun/llms.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
# Sentry and Bun LLM Rules

You are an expert in application architecture and the configuration of observability tools like Sentry. Ensure you are following these instructions, while taking into account the user's request.

Always ensure you are installing Sentry using `bun add @sentry/bun@latest`. The latest package should always be used unless explicitly told otherwise.

## Configuration examples

These examples should be used to configure the different Sentry functionality in Bun applications. Use these as the default configuration, factoring in the user's requests.

### Sentry Setup (applies to all configurations)

Sentry should be initialized as early as possible in your application's lifecycle. Create a file named `instrument.js` that imports and initializes Sentry:

```javascript
import * as Sentry from "@sentry/bun";

// Initialize Sentry before importing any other modules
Sentry.init({
dsn: "<sentry dsn>",

// Enable tracing to capture 100% of transactions
// Recommend adjusting this value in production
tracesSampleRate: 1.0,

// Set tracePropagationTargets for which URLs trace propagation should be enabled
tracePropagationTargets: ["localhost", /^https:\/\/yourserver\.io\/api/],
});
```

Then import this file at the very beginning of your main application file:

```javascript
// Import this first!
import "./instrument";

// Now import other modules
import http from "http";

// Your application code goes here
```

### Error Tracking and Exception Catching

Instrument errors throughout the application using the following approaches:

```javascript
// Explicitly capture an exception
try {
throw new Error("Example error");
} catch (e) {
Sentry.captureException(e);
}

// Capture a custom message
Sentry.captureMessage("Something went wrong", "error");

// Add extra context to the error
Sentry.configureScope((scope) => {
scope.setTag("page_locale", "de-at");
scope.setUser({ id: '123', email: '[email protected]' });
scope.setExtra("character_name", "Mighty Fighter");
});
```

### Tracing and Performance Monitoring

Utilize the following examples for tracing scenarios:

```javascript
// Create a transaction
const transaction = Sentry.startTransaction({
op: "test",
name: "My First Test Transaction"
});

// Set transaction as the current scope
Sentry.getCurrentHub().configureScope(scope => {
scope.setSpan(transaction);
});

// Create a child span
const span = transaction.startChild({ op: "functionX", description: "Function doing work" });

try {
// Do something...
span.setStatus("ok");
} catch (error) {
span.setStatus("internal_error");
throw error;
} finally {
// Finish the span
span.finish();
// Finish the transaction
transaction.finish();
}
```

### Bun.serve Integration

For Bun server applications:

```javascript
import * as Sentry from "@sentry/bun";

// Initialize Sentry before anything else
Sentry.init({
dsn: "<sentry dsn>",
integrations: [
// Add Bun server integration
Sentry.bunServerIntegration(),
],
tracesSampleRate: 1.0,
});

// Example Bun server
Bun.serve({
port: 3000,
fetch(req) {
const url = new URL(req.url);

if (url.pathname === "/error") {
// This will be automatically captured by Sentry
throw new Error("Example server error");
}

return new Response("Hello World!");
},
});
```
79 changes: 79 additions & 0 deletions public/platforms/javascript/common/llms.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
# Sentry and JavaScript LLM Rules

You are an expert in application architecture and the configuration of observability tools like Sentry. Ensure you are following these instrucitons, while taking into account the users request.

Always ensure you are installing Sentry using `npm i @sentry/browser@latest`. The latest package should always be used.

By default you should instrument the latest version of packages unless explicitly told otherwise.

## Configuration examples

These examples should be used to configure the different Sentry functionality in JavaScript based applications. Use these as the default configuration, factoring in the users requests.

### Sentry Setup (applies to all configuraitons)

Configure Sentry using the following parameters unless explicitly told otherwise.

```javascript
import * as Sentry from "@sentry/browser";

Sentry.init({
dsn: "<sentry dsn>",

release: "dev",
integrations: [
Sentry.browserTracingIntegration(),
Sentry.replayIntegration(),
],

tracesSampleRate: 1.0,
tracePropagationTargets: ["localhost", /^https:\/\/yourserver\.io\/api/],

replaysSessionSampleRate: 0.1,
replaysOnErrorSampleRate: 1.0,
});
```

### Error Tracking and Exception Catching

Instrument errors throughout the application as desired by using the following configuration

```javascript
import * as Sentry from "@sentry/browser";

Sentry.captureException(error)
```

### Tracing

Utilize the following example for tracing scenarios where the user wants to instrument tracing. Leverage attributes that align to the users application functionality.

```javascript
Sentry.startSpan(
{
name: "Span Name",
op: "example.operation",
attributes: {
// Static details available at the start
"userExample": "userValue
},
},
async () => {
// Get the current active span to update during upload
const span = Sentry.getActiveSpan();

try {
if (span) {
span.setAttribute("samplespan.attribute", "value");
}
return result;
} catch (error) {
// Record failure information
if (span) {
span.setAttribute("otherSample.attribute", true);
}
throw error;
}
},
);
```
59 changes: 59 additions & 0 deletions public/platforms/javascript/guides/nextjs/llms.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# Sentry and Nextjs LLM Rules

You are an expert in application architecture and the configuration of observability tools like Sentry. Ensure you are following these instrucitons, while taking into account the users request.

Always ensure you are installing Sentry using `npx @sentry/wizard@latest -i nextjs` wizard command. This command is interactive so the user will need to answer questions. The latest package should always be used.

By default you should instrument the latest version of packages unless explicitly told otherwise.

## Configuration examples

These examples should be used to configure the different Sentry functionality in Nextjs based applications. Use these as the default configuration, factoring in the users requests.

### Sentry Setup (applies to all configuraitons)

The Nextjs wizard will automatically create `instrumentation-client.config.ts`, `server.config.ts`, and `edge.config.ts` files during the setup.

### Error Tracking and Exception Catching

Instrument errors throughout the application as desired by using the following configuration

```javascript
import * as Sentry from "@sentry/nextjs";

Sentry.captureException(error)
```

### Tracing

Utilize the following example for tracing scenarios where the user wants to instrument tracing. Leverage attributes that align to the users application functionality.

```javascript
Sentry.startSpan(
{
name: "Span Name",
op: "example.operation",
attributes: {
// Static details available at the start
"userExample": "userValue
},
},
async () => {
// Get the current active span to update during upload
const span = Sentry.getActiveSpan();

try {
if (span) {
span.setAttribute("samplespan.attribute", "value");
}
return result;
} catch (error) {
// Record failure information
if (span) {
span.setAttribute("otherSample.attribute", true);
}
throw error;
}
},
);
```
79 changes: 79 additions & 0 deletions public/platforms/javascript/guides/react/llms.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
# Sentry and React LLM Rules

You are an expert in application architecture and the configuration of observability tools like Sentry. Ensure you are following these instrucitons, while taking into account the users request.

Always ensure you are installing Sentry using `npm i @sentry/react@latest`. The latest package should always be used.

By default you should instrument the latest version of packages unless explicitly told otherwise.

## Configuration examples

These examples should be used to configure the different Sentry functionality in JavaScript based applications. Use these as the default configuration, factoring in the users requests.

### Sentry Setup (applies to all configuraitons)

Configure Sentry using the following parameters unless explicitly told otherwise.

```javascript
import * as Sentry from "@sentry/react";

Sentry.init({
dsn: "<sentry dsn>",

release: "dev",
integrations: [
Sentry.browserTracingIntegration(),
Sentry.replayIntegration(),
],

tracesSampleRate: 1.0,
tracePropagationTargets: ["localhost", /^https:\/\/yourserver\.io\/api/],

replaysSessionSampleRate: 0.1,
replaysOnErrorSampleRate: 1.0,
});
```

### Error Tracking and Exception Catching

Instrument errors throughout the application as desired by using the following configuration

```javascript
import * as Sentry from "@sentry/react";

Sentry.captureException(error)
```

### Tracing

Utilize the following example for tracing scenarios where the user wants to instrument tracing. Leverage attributes that align to the users application functionality.

```javascript
Sentry.startSpan(
{
name: "Span Name",
op: "example.operation",
attributes: {
// Static details available at the start
"userExample": "userValue
},
},
async () => {
// Get the current active span to update during upload
const span = Sentry.getActiveSpan();

try {
if (span) {
span.setAttribute("samplespan.attribute", "value");
}
return result;
} catch (error) {
// Record failure information
if (span) {
span.setAttribute("otherSample.attribute", true);
}
throw error;
}
},
);
```
Loading