mirror of
https://github.com/getsentry/sentry-agent-skills.git
synced 2026-09-20 14:23:25 +08:00
Merge pull request #6 from getsentry/fix/docs-accuracy-audit
fix: correct factual inaccuracies across 9 skills based on Sentry docs audit
This commit is contained in:
@@ -43,14 +43,14 @@ description: Brief description including trigger keywords. Use when asked to [ac
|
||||
**Required fields:**
|
||||
| Field | Requirements |
|
||||
|-------|--------------|
|
||||
| `name` | kebab-case, 1-64 chars, must match directory name |
|
||||
| `name` | kebab-case, 1-64 chars, must match directory name, no consecutive hyphens, must not start or end with hyphen |
|
||||
| `description` | 1-1024 chars, include trigger phrases and supported platforms |
|
||||
|
||||
**Optional fields:**
|
||||
| Field | Purpose |
|
||||
|-------|---------|
|
||||
| `model` | Override model (`sonnet`, `opus`, `haiku`) |
|
||||
| `allowed-tools` | Space-delimited tool allowlist |
|
||||
| `metadata` | Arbitrary key-value mapping (e.g., `author`, `version`) |
|
||||
| `allowed-tools` | Space-delimited tool allowlist (experimental) |
|
||||
| `license` | License name or path |
|
||||
| `compatibility` | Environment requirements (max 500 chars) |
|
||||
|
||||
|
||||
@@ -12,10 +12,11 @@ Official agent skills for integrating Sentry into your projects. These skills pr
|
||||
| `sentry-react-native-setup` | Setup Sentry in React Native using the wizard CLI | React Native, Expo | [React Native Guide](https://docs.sentry.io/platforms/react-native/) |
|
||||
| `sentry-python-setup` | Setup Sentry in Python apps | Python (Django, Flask, FastAPI) | [Python Guide](https://docs.sentry.io/platforms/python/) |
|
||||
| `sentry-ruby-setup` | Setup Sentry in Ruby apps | Ruby (Rails) | [Ruby Guide](https://docs.sentry.io/platforms/ruby/) |
|
||||
| `sentry-ios-swift-setup` | Setup Sentry in iOS/Swift apps | iOS (Swift, UIKit, SwiftUI) | [Apple Guide](https://docs.sentry.io/platforms/apple/guides/ios/) |
|
||||
| `sentry-setup-tracing` | Setup Sentry Tracing (Performance Monitoring) | JS, Python, Ruby | [Tracing](https://docs.sentry.io/platforms/javascript/tracing/) |
|
||||
| `sentry-setup-logging` | Setup Sentry Logging | JS, Python, Ruby | [Logs](https://docs.sentry.io/platforms/javascript/logs/) |
|
||||
| `sentry-setup-metrics` | Setup Sentry Metrics | JS, Python | [Metrics](https://docs.sentry.io/platforms/javascript/metrics/) |
|
||||
| `sentry-setup-ai-monitoring` | Setup Sentry AI Agent Monitoring | JS, Python | [AI Agents](https://docs.sentry.io/platforms/javascript/guides/nextjs/tracing/instrumentation/ai-agents-module/) |
|
||||
| `sentry-setup-ai-monitoring` | Setup Sentry AI Agent Monitoring | JS, Python | [AI Monitoring](https://docs.sentry.io/product/ai-monitoring/) |
|
||||
|
||||
### Workflow Skills
|
||||
|
||||
@@ -281,6 +282,7 @@ Once installed, your AI assistant will automatically discover the skills. Simply
|
||||
| What to Say | Skill Used |
|
||||
|-------------|------------|
|
||||
| "Add Sentry to my React app" | `sentry-react-setup` |
|
||||
| "Add Sentry to my iOS/Swift app" | `sentry-ios-swift-setup` |
|
||||
| "Set up Sentry in React Native" | `sentry-react-native-setup` |
|
||||
| "Add Sentry to my Python/Django/Flask app" | `sentry-python-setup` |
|
||||
| "Set up Sentry in my Ruby/Rails app" | `sentry-ruby-setup` |
|
||||
@@ -334,7 +336,7 @@ Instructions for the AI assistant...
|
||||
Contributions are welcome! Please ensure any new skills:
|
||||
|
||||
1. Follow the [Agent Skills specification](https://agentskills.io/specification)
|
||||
2. Have a valid `name` (lowercase, hyphens, 1-64 chars)
|
||||
2. Have a valid `name` (lowercase letters, numbers, hyphens, 1-64 chars, no consecutive hyphens, must not start or end with hyphen)
|
||||
3. Include a clear `description` (1-1024 chars)
|
||||
4. **Keep skills concise** - use tables over prose, avoid obvious information
|
||||
5. Include an "Invoke This Skill When" section with trigger phrases
|
||||
|
||||
@@ -73,6 +73,7 @@ Pick which issue events fire the workflow. Use `logicType: "any-short"` (trigger
|
||||
| `first_seen_event` | New issue created |
|
||||
| `regression_event` | Resolved issue recurs |
|
||||
| `reappeared_event` | Archived issue reappears |
|
||||
| `issue_resolved_trigger` | Issue is resolved |
|
||||
|
||||
### Filter Conditions
|
||||
|
||||
@@ -80,14 +81,14 @@ Conditions that must pass before actions execute. Use `logicType: "all"`, `"any-
|
||||
|
||||
| Type | comparison | Description |
|
||||
|------|-----------|-------------|
|
||||
| `issue_priority_greater_or_equal` | `25` / `50` / `75` / `100` | Priority >= Low/Medium/High/Critical |
|
||||
| `issue_priority_greater_or_equal` | `25` / `50` / `75` | Priority >= Low/Medium/High |
|
||||
| `issue_priority_deescalating` | `true` | Priority dropped below peak |
|
||||
| `event_frequency_count` | `<number>` | Event count exceeds threshold |
|
||||
| `event_unique_user_frequency_count` | `<number>` | Affected users exceed threshold |
|
||||
| `tagged_event` | `"key:value"` | Event has specific tag |
|
||||
| `assigned_to` | `"<user_or_team_id>"` | Issue assigned to target |
|
||||
|
||||
Priority scale: Low=25, Medium=50, High=75, Critical=100.
|
||||
Priority scale: Low=25, Medium=50, High=75.
|
||||
|
||||
Set `conditionResult` to `false` to invert (fire when condition is NOT met).
|
||||
|
||||
@@ -95,9 +96,9 @@ Set `conditionResult` to `false` to invert (fire when condition is NOT met).
|
||||
|
||||
| Type | Key Config |
|
||||
|------|-----------|
|
||||
| `email` | `targetType`: `"user"` / `"team"` / `"issue_owners"`, `targetIdentifier`: `<id>` |
|
||||
| `slack` | `integrationId`: `<id>`, `channel`: `"#name"`, `channel_id`: `<id>` |
|
||||
| `pagerduty` | `integrationId`: `<id>`, `service`: `<id>`, `severity`: `"critical"` |
|
||||
| `email` | `config.targetType`: `"user"` / `"team"` / `"issue_owners"`, `config.targetIdentifier`: `<id>` |
|
||||
| `slack` | `integrationId`: `<id>`, `config.targetDisplay`: `"#channel-name"`, `config.targetIdentifier`: `<channel_id>` |
|
||||
| `pagerduty` | `integrationId`: `<id>`, `config.targetDisplay`: `<service_name>`, `config.targetIdentifier`: `<service_id>`, `data.priority`: `"critical"` |
|
||||
|
||||
### Full Payload Structure
|
||||
|
||||
@@ -169,6 +170,9 @@ curl -s "$API/workflows/" -H "$AUTH"
|
||||
# Get one workflow
|
||||
curl -s "$API/workflows/{id}/" -H "$AUTH"
|
||||
|
||||
# Update a workflow
|
||||
curl -s -X PUT "$API/workflows/{id}/" -H "$AUTH" -H "Content-Type: application/json" -d '{payload}'
|
||||
|
||||
# Delete a workflow
|
||||
curl -s -X DELETE "$API/workflows/{id}/" -H "$AUTH"
|
||||
# Expect 204
|
||||
|
||||
@@ -13,25 +13,25 @@ Install and configure Sentry in iOS projects using Swift and SwiftUI.
|
||||
- User wants error monitoring, tracing, or session replay in iOS
|
||||
- User mentions "sentry-cocoa" or iOS crash reporting
|
||||
|
||||
**Important:** The configuration options and code samples below are examples. Always verify against [docs.sentry.io](https://docs.sentry.io) before implementing, as APIs and defaults may have changed.
|
||||
|
||||
## Requirements
|
||||
|
||||
- iOS 13.0+
|
||||
- Xcode 15.0+
|
||||
- Swift 5.0+
|
||||
- iOS 15.0+
|
||||
|
||||
## Install
|
||||
|
||||
### Swift Package Manager (Recommended)
|
||||
|
||||
1. File > Add Package Dependencies
|
||||
2. Enter: `https://github.com/getsentry/sentry-cocoa`
|
||||
3. Select version rule: "Up to Next Major" from `9.0.0`
|
||||
2. Enter: `https://github.com/getsentry/sentry-cocoa.git`
|
||||
3. Select version rule: "Up to Next Major" from `9.5.0`
|
||||
|
||||
### CocoaPods
|
||||
|
||||
```ruby
|
||||
# Podfile
|
||||
pod 'Sentry', '~> 9.0'
|
||||
pod 'Sentry', :git => 'https://github.com/getsentry/sentry-cocoa.git', :tag => '9.5.0'
|
||||
```
|
||||
|
||||
Then run `pod install`.
|
||||
@@ -118,10 +118,10 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
|
||||
|---------|-----------------|
|
||||
| App Launches | Cold/warm start times |
|
||||
| Network | URLSession requests |
|
||||
| UI | Screen loads, transitions |
|
||||
| UI | UIViewController loads, user interactions |
|
||||
| File I/O | Read/write operations |
|
||||
| Core Data | Fetch/save operations |
|
||||
| App Hangs | Main thread blocking |
|
||||
| Frames | Slow and frozen frame detection |
|
||||
|
||||
## Logging
|
||||
|
||||
@@ -167,8 +167,12 @@ SentrySDK.setUser(nil)
|
||||
// Test error capture
|
||||
SentrySDK.capture(message: "Test from iOS")
|
||||
|
||||
// Test crash (dev only)
|
||||
SentrySDK.crash()
|
||||
// Or trigger a test error
|
||||
do {
|
||||
try someFailingFunction()
|
||||
} catch {
|
||||
SentrySDK.capture(error: error)
|
||||
}
|
||||
```
|
||||
|
||||
## Production Settings
|
||||
@@ -190,13 +194,10 @@ Track app bundle size with Sentry using the Fastlane plugin.
|
||||
|
||||
### Install Plugin
|
||||
|
||||
```ruby
|
||||
# fastlane/Pluginfile
|
||||
gem 'fastlane-plugin-sentry'
|
||||
```bash
|
||||
bundle exec fastlane add_plugin fastlane-plugin-sentry
|
||||
```
|
||||
|
||||
Then run `bundle install`.
|
||||
|
||||
### Configure Authentication
|
||||
|
||||
```bash
|
||||
@@ -235,7 +236,7 @@ end
|
||||
bundle exec fastlane sentry_size
|
||||
```
|
||||
|
||||
View results in Sentry: **Settings > Size Analysis**
|
||||
View results in the Sentry UI after the upload completes.
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
@@ -243,7 +244,7 @@ View results in Sentry: **Settings > Size Analysis**
|
||||
|-------|----------|
|
||||
| Events not appearing | Check DSN, enable `debug = true` |
|
||||
| No traces | Set `tracesSampleRate` > 0 |
|
||||
| No replays | Set `sessionSampleRate` > 0, check SDK 8.0+ |
|
||||
| No logs | Set `enableLogs = true`, check SDK 8.55+ |
|
||||
| CocoaPods fails | Run `pod repo update`, check iOS 13+ target |
|
||||
| No replays | Set `sessionSampleRate` > 0, check SDK 8.31.1+ |
|
||||
| No logs | Set `enableLogs = true`, check SDK 8.55.0+ |
|
||||
| CocoaPods fails | Run `pod repo update`, check iOS 15+ target |
|
||||
| Size upload fails | Check `SENTRY_AUTH_TOKEN`, verify org/project slugs |
|
||||
|
||||
@@ -13,6 +13,8 @@ Install and configure Sentry in Python projects.
|
||||
- User wants error monitoring, logging, or tracing in Python
|
||||
- User mentions "sentry-sdk" or Python frameworks (Django, Flask, FastAPI)
|
||||
|
||||
**Important:** The configuration options and code samples below are examples. Always verify against [docs.sentry.io](https://docs.sentry.io) before implementing, as APIs and defaults may have changed.
|
||||
|
||||
## Install
|
||||
|
||||
```bash
|
||||
@@ -114,24 +116,33 @@ app = FastAPI()
|
||||
|
||||
| Option | Description | Default |
|
||||
|--------|-------------|---------|
|
||||
| `dsn` | Sentry DSN | Required |
|
||||
| `send_default_pii` | Include user data | `False` |
|
||||
| `traces_sample_rate` | % of transactions traced | `0` |
|
||||
| `profile_session_sample_rate` | % of sessions profiled | `0` |
|
||||
| `dsn` | Sentry DSN | `None` (SDK no-ops without it) |
|
||||
| `send_default_pii` | Include user data | `None` |
|
||||
| `traces_sample_rate` | % of transactions traced | `None` (tracing disabled) |
|
||||
| `profile_session_sample_rate` | % of sessions profiled | `None` (profiling disabled) |
|
||||
| `enable_logs` | Send logs to Sentry | `False` |
|
||||
| `environment` | Environment name | Auto-detected |
|
||||
| `environment` | Environment name | `production` (or `SENTRY_ENVIRONMENT` env var) |
|
||||
| `release` | Release version | Auto-detected |
|
||||
|
||||
## Environment Variables
|
||||
|
||||
The SDK auto-reads these:
|
||||
|
||||
```bash
|
||||
SENTRY_DSN=https://xxx@o123.ingest.sentry.io/456
|
||||
SENTRY_ENVIRONMENT=production
|
||||
SENTRY_RELEASE=1.0.0
|
||||
```
|
||||
|
||||
For `sentry-cli` (source maps, releases), also set:
|
||||
|
||||
```bash
|
||||
SENTRY_AUTH_TOKEN=sntrys_xxx
|
||||
SENTRY_ORG=my-org
|
||||
SENTRY_PROJECT=my-project
|
||||
```
|
||||
|
||||
Or use in code:
|
||||
Or pass DSN in code:
|
||||
|
||||
```python
|
||||
import os
|
||||
|
||||
@@ -13,6 +13,8 @@ Install and configure Sentry in React Native projects using the official wizard
|
||||
- User wants error monitoring, logging, or tracing in React Native or Expo
|
||||
- User mentions "@sentry/react-native" or mobile error tracking
|
||||
|
||||
**Important:** The configuration options and code samples below are examples. Always verify against [docs.sentry.io](https://docs.sentry.io) before implementing, as APIs and defaults may have changed.
|
||||
|
||||
## Wizard Setup (Recommended)
|
||||
|
||||
```bash
|
||||
@@ -29,7 +31,7 @@ npx @sentry/wizard@latest -i reactNative
|
||||
| Android setup | Enables Gradle build step for source maps |
|
||||
| iOS setup | Wraps Xcode build phase, adds debug symbol upload |
|
||||
| Pod install | Runs `pod install` for iOS |
|
||||
| Credentials | Stores in `ios/sentry.properties`, `android/sentry.properties`, `.env.local` |
|
||||
| Credentials | Stores in `ios/sentry.properties`, `android/sentry.properties`, `env.local` |
|
||||
| Init code | Configures Sentry in `App.tsx` or `_layout.tsx` |
|
||||
|
||||
## Manual Configuration
|
||||
@@ -96,7 +98,7 @@ Works for both managed and bare Expo projects.
|
||||
| `app.json` | Expo config (if Expo) |
|
||||
| `ios/sentry.properties` | iOS build credentials |
|
||||
| `android/sentry.properties` | Android build credentials |
|
||||
| `.env.local` | Environment variables |
|
||||
| `env.local` | Environment variables |
|
||||
|
||||
## Environment Variables
|
||||
|
||||
|
||||
@@ -13,6 +13,8 @@ Install and configure Sentry in React projects.
|
||||
- User wants error monitoring, logging, or tracing in React
|
||||
- User mentions "@sentry/react" or React error boundaries
|
||||
|
||||
**Important:** The configuration options and code samples below are examples. Always verify against [docs.sentry.io](https://docs.sentry.io) before implementing, as APIs and defaults may have changed.
|
||||
|
||||
## Install
|
||||
|
||||
```bash
|
||||
@@ -21,7 +23,7 @@ npm install @sentry/react --save
|
||||
|
||||
## Configure
|
||||
|
||||
Create `src/instrument.js` (must be imported first in your app):
|
||||
Create `instrument.js` in your project root (must be imported first in your app):
|
||||
|
||||
```javascript
|
||||
import * as Sentry from "@sentry/react";
|
||||
@@ -30,13 +32,13 @@ Sentry.init({
|
||||
dsn: "YOUR_SENTRY_DSN",
|
||||
sendDefaultPii: true,
|
||||
|
||||
// Tracing
|
||||
integrations: [Sentry.browserTracingIntegration()],
|
||||
// Tracing + Session Replay
|
||||
integrations: [
|
||||
Sentry.browserTracingIntegration(),
|
||||
Sentry.replayIntegration(),
|
||||
],
|
||||
tracesSampleRate: 1.0,
|
||||
tracePropagationTargets: [/^\//, /^https:\/\/yourserver\.io\/api/],
|
||||
|
||||
// Session Replay
|
||||
integrations: [Sentry.replayIntegration()],
|
||||
replaysSessionSampleRate: 0.1,
|
||||
replaysOnErrorSampleRate: 1.0,
|
||||
|
||||
@@ -92,7 +94,8 @@ import * as Sentry from "@sentry/react";
|
||||
|---------------|-------------|
|
||||
| v7 (non-framework) | `Sentry.reactRouterV7BrowserTracingIntegration` |
|
||||
| v6 | `Sentry.reactRouterV6BrowserTracingIntegration` |
|
||||
| v4/v5 | `Sentry.reactRouterV5BrowserTracingIntegration` |
|
||||
| v5 | `Sentry.reactRouterV5BrowserTracingIntegration` |
|
||||
| v4 | `Sentry.reactRouterV4BrowserTracingIntegration` |
|
||||
|
||||
## Redux Integration (Optional)
|
||||
|
||||
@@ -118,12 +121,14 @@ npx @sentry/wizard@latest -i sourcemaps
|
||||
## Environment Variables
|
||||
|
||||
```bash
|
||||
REACT_APP_SENTRY_DSN=https://xxx@o123.ingest.sentry.io/456
|
||||
SENTRY_AUTH_TOKEN=sntrys_xxx
|
||||
SENTRY_ORG=my-org
|
||||
SENTRY_PROJECT=my-project
|
||||
SENTRY_DSN=https://xxx@o123.ingest.sentry.io/456
|
||||
SENTRY_AUTH_TOKEN=sntrys_xxx # Used by sentry-cli / source maps, not the SDK
|
||||
SENTRY_ORG=my-org # Used by sentry-cli, not the SDK
|
||||
SENTRY_PROJECT=my-project # Used by sentry-cli, not the SDK
|
||||
```
|
||||
|
||||
**Note:** The SDK reads `SENTRY_DSN` automatically. If using Create React App, prefix with `REACT_APP_`; for Vite, use `VITE_`. `SENTRY_AUTH_TOKEN`/`ORG`/`PROJECT` are used by `sentry-cli` for source map uploads, not by the browser SDK.
|
||||
|
||||
## Verification
|
||||
|
||||
Add test button to trigger error:
|
||||
|
||||
@@ -13,6 +13,8 @@ Install and configure Sentry in Ruby projects.
|
||||
- User wants error monitoring, logging, or tracing in Ruby
|
||||
- User mentions "sentry-ruby" gem or Ruby on Rails
|
||||
|
||||
**Important:** The configuration options and code samples below are examples. Always verify against [docs.sentry.io](https://docs.sentry.io) before implementing, as APIs and defaults may have changed.
|
||||
|
||||
## Requirements
|
||||
|
||||
- Ruby 2.4+ or recent JRuby versions
|
||||
@@ -24,8 +26,9 @@ Add to `Gemfile`:
|
||||
```ruby
|
||||
gem "sentry-ruby"
|
||||
|
||||
# For profiling, also add:
|
||||
gem "stackprof"
|
||||
# For profiling, add one of:
|
||||
gem "stackprof" # SDK 5.9.0+ — works on all Ruby versions
|
||||
# gem "vernier" # SDK 5.21.0+ — better profiles for multi-threaded servers (requires Ruby 3.2.1+)
|
||||
```
|
||||
|
||||
Then run:
|
||||
@@ -89,10 +92,10 @@ gem "sentry-resque" # If using Resque
|
||||
|
||||
| Option | Description | Default |
|
||||
|--------|-------------|---------|
|
||||
| `dsn` | Sentry DSN | Required |
|
||||
| `dsn` | Sentry DSN | `nil` (SDK no-ops without it) |
|
||||
| `send_default_pii` | Include user data | `false` |
|
||||
| `traces_sample_rate` | % of transactions traced | `0` |
|
||||
| `profiles_sample_rate` | % of traces profiled | `0` |
|
||||
| `traces_sample_rate` | % of transactions traced | `nil` (tracing disabled) |
|
||||
| `profiles_sample_rate` | % of traces profiled | `nil` (profiling disabled) |
|
||||
| `enable_logs` | Send logs to Sentry | `false` |
|
||||
| `environment` | Environment name | Auto-detected |
|
||||
| `release` | Release version | Auto-detected |
|
||||
@@ -103,6 +106,7 @@ gem "sentry-resque" # If using Resque
|
||||
|--------|-------------|
|
||||
| `:sentry_logger` | Sentry's own logger |
|
||||
| `:http_logger` | HTTP request breadcrumbs |
|
||||
| `:redis_logger` | Redis command breadcrumbs |
|
||||
| `:active_support_logger` | Rails ActiveSupport (Rails only) |
|
||||
|
||||
## Environment Variables
|
||||
|
||||
@@ -13,6 +13,8 @@ Configure Sentry to track LLM calls, agent executions, tool usage, and token con
|
||||
- User wants "AI observability" or "agent monitoring"
|
||||
- User asks about token usage, model latency, or AI costs
|
||||
|
||||
**Important:** The SDK versions, API names, and code samples below are examples. Always verify against [docs.sentry.io](https://docs.sentry.io) before implementing, as APIs and minimum versions may have changed.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
AI monitoring requires **tracing enabled** (`tracesSampleRate > 0`).
|
||||
@@ -45,23 +47,25 @@ grep -E '(openai|anthropic|langchain|huggingface)' requirements.txt pyproject.to
|
||||
|
||||
| Package | Integration | Min Sentry SDK | Auto? |
|
||||
|---------|-------------|----------------|-------|
|
||||
| `openai` | `openAIIntegration()` | 10.2.0 | Yes |
|
||||
| `@anthropic-ai/sdk` | `anthropicAIIntegration()` | 10.12.0 | Yes |
|
||||
| `ai` (Vercel) | `vercelAIIntegration()` | 10.6.0 | Node only* |
|
||||
| `@langchain/*` | `langChainIntegration()` | 10.22.0 | Yes |
|
||||
| `@langchain/langgraph` | `langGraphIntegration()` | 10.25.0 | Yes |
|
||||
| `@google/genai` | `googleGenAIIntegration()` | 10.14.0 | Yes |
|
||||
| `openai` | `openAIIntegration()` | 10.28.0 | Yes |
|
||||
| `@anthropic-ai/sdk` | `anthropicAIIntegration()` | 10.28.0 | Yes |
|
||||
| `ai` (Vercel) | `vercelAIIntegration()` | 10.6.0 | Yes* |
|
||||
| `@langchain/*` | `langChainIntegration()` | 10.28.0 | Yes |
|
||||
| `@langchain/langgraph` | `langGraphIntegration()` | 10.28.0 | Yes |
|
||||
| `@google/genai` | `googleGenAIIntegration()` | 10.28.0 | Yes |
|
||||
|
||||
*Vercel AI requires explicit setup for Edge runtime and `experimental_telemetry` per-call.
|
||||
*Vercel AI: 10.6.0+ for Node.js, Cloudflare Workers, Vercel Edge Functions, Bun. 10.12.0+ for Deno. Requires `experimental_telemetry` per-call.
|
||||
|
||||
### Python
|
||||
|
||||
| Package | Install | Min SDK |
|
||||
|---------|---------|---------|
|
||||
| `openai` | `pip install "sentry-sdk[openai]"` | 2.41.0 |
|
||||
| `anthropic` | `pip install "sentry-sdk[anthropic]"` | 2.x |
|
||||
| `langchain` | `pip install "sentry-sdk[langchain]"` | 2.x |
|
||||
| `huggingface_hub` | `pip install "sentry-sdk[huggingface_hub]"` | 2.x |
|
||||
Integrations auto-enable when the AI package is installed — no extras needed:
|
||||
|
||||
| Package | Install | Auto? |
|
||||
|---------|---------|-------|
|
||||
| `openai` | `pip install sentry-sdk` | Yes |
|
||||
| `anthropic` | `pip install sentry-sdk` | Yes |
|
||||
| `langchain` | `pip install sentry-sdk` | Yes |
|
||||
| `huggingface_hub` | `pip install sentry-sdk` | Yes |
|
||||
|
||||
## JavaScript Configuration
|
||||
|
||||
@@ -95,7 +99,7 @@ const openai = Sentry.instrumentOpenAiClient(new OpenAI());
|
||||
// Use 'openai' client as normal
|
||||
```
|
||||
|
||||
### LangChain / LangGraph (explicit)
|
||||
### LangChain / LangGraph (auto-enabled)
|
||||
|
||||
```javascript
|
||||
integrations: [
|
||||
|
||||
@@ -13,6 +13,8 @@ Configure Sentry's structured logging feature.
|
||||
- User wants to integrate logging libraries (Pino, Winston, Loguru) with Sentry
|
||||
- User asks about `Sentry.logger` or `sentry_sdk.logger`
|
||||
|
||||
**Important:** The SDK versions, API names, and code samples below are examples. Always verify against [docs.sentry.io](https://docs.sentry.io) before implementing, as APIs and minimum versions may have changed.
|
||||
|
||||
## Quick Reference
|
||||
|
||||
| Platform | Min SDK | Enable Flag | Logger API |
|
||||
@@ -57,7 +59,7 @@ Sentry.logger.info(Sentry.logger.fmt`User ${userId} purchased ${productName}`);
|
||||
| Library | Integration | Min SDK |
|
||||
|---------|-------------|---------|
|
||||
| Pino | `Sentry.pinoIntegration()` | 10.18.0+ |
|
||||
| Winston | `Sentry.createSentryWinstonTransport()` | 9.13.0+ |
|
||||
| Winston | `Sentry.createSentryWinstonTransport()` | 9.13.0+ (undocumented) |
|
||||
| Consola | `Sentry.createConsolaReporter()` | 10.12.0+ |
|
||||
|
||||
## Python Setup
|
||||
@@ -78,7 +80,7 @@ sentry_sdk.init(
|
||||
### 3. Stdlib logging capture (optional)
|
||||
```python
|
||||
from sentry_sdk.integrations.logging import LoggingIntegration
|
||||
integrations=[LoggingIntegration(sentry_logs_level=logging.WARNING)]
|
||||
integrations=[LoggingIntegration(sentry_logs_level=logging.INFO)]
|
||||
```
|
||||
|
||||
### 4. Use structured logging
|
||||
@@ -92,7 +94,7 @@ sentry_logger.error("Payment failed", order_id="456", amount=99.99)
|
||||
### Loguru integration
|
||||
```python
|
||||
from sentry_sdk.integrations.loguru import LoguruIntegration
|
||||
integrations=[LoguruIntegration(sentry_logs_level=LoggingLevels.WARNING.value)]
|
||||
integrations=[LoguruIntegration(sentry_logs_level=LoggingLevels.INFO.value)]
|
||||
```
|
||||
|
||||
## Ruby Setup
|
||||
@@ -107,7 +109,7 @@ bundle show sentry-ruby
|
||||
Sentry.init do |config|
|
||||
config.dsn = "YOUR_DSN"
|
||||
config.enable_logs = true
|
||||
config.enabled_patches = [:logger] # Optional: capture stdlib Logger
|
||||
config.enabled_patches << :logger # Optional: capture stdlib Logger
|
||||
end
|
||||
```
|
||||
|
||||
|
||||
@@ -13,6 +13,8 @@ Configure Sentry's custom metrics for tracking counters, gauges, and distributio
|
||||
- User wants counters, gauges, or distributions
|
||||
- User asks about `Sentry.metrics` or `sentry_sdk.metrics`
|
||||
|
||||
**Important:** The SDK versions, API names, and code samples below are examples. Always verify against [docs.sentry.io](https://docs.sentry.io) before implementing, as APIs and minimum versions may have changed.
|
||||
|
||||
## Quick Reference
|
||||
|
||||
Check [Sentry Metrics Getting Started](https://docs.sentry.io/product/explore/metrics/getting-started/) for the full list of supported SDKs and minimum versions. Examples below use JavaScript and Python:
|
||||
|
||||
@@ -13,15 +13,17 @@ Configure Sentry's performance monitoring to track transactions and spans.
|
||||
- User wants to track API response times, page loads, or latency
|
||||
- User asks about `tracesSampleRate` or custom spans
|
||||
|
||||
**Important:** The SDK versions, API names, and code samples below are examples. Always verify against [docs.sentry.io](https://docs.sentry.io) before implementing, as APIs and minimum versions may have changed.
|
||||
|
||||
## Quick Reference
|
||||
|
||||
| Platform | Enable | Custom Span |
|
||||
|----------|--------|-------------|
|
||||
| JS/Browser | `tracesSampleRate` + `browserTracingIntegration()` | `Sentry.startSpan()` |
|
||||
| Next.js | `tracesSampleRate` (auto-integrated) | `Sentry.startSpan()` |
|
||||
| Next.js | `tracesSampleRate` in each runtime config file | `Sentry.startSpan()` |
|
||||
| Node.js | `tracesSampleRate` | `Sentry.startSpan()` |
|
||||
| Python | `traces_sample_rate` | `@sentry_sdk.trace` or `start_span()` |
|
||||
| Ruby | `traces_sample_rate` | `start_span()` |
|
||||
| Ruby | `traces_sample_rate` | `Sentry.with_child_span()` |
|
||||
|
||||
## JavaScript Setup
|
||||
|
||||
@@ -54,11 +56,10 @@ await Sentry.startSpan({ name: "checkout", op: "transaction" }, async () => {
|
||||
|
||||
### Dynamic sampling
|
||||
```javascript
|
||||
tracesSampler: ({ name, parentSampled }) => {
|
||||
tracesSampler: ({ name, inheritOrSampleWith }) => {
|
||||
if (name.includes("healthcheck")) return 0;
|
||||
if (name.includes("checkout")) return 1.0;
|
||||
if (parentSampled !== undefined) return parentSampled;
|
||||
return 0.1;
|
||||
return inheritOrSampleWith(0.1); // Respects parent sampling decision, falls back to 0.1
|
||||
},
|
||||
```
|
||||
|
||||
@@ -87,10 +88,12 @@ with sentry_sdk.start_span(name="process-order", op="task") as span:
|
||||
|
||||
### Dynamic sampling
|
||||
```python
|
||||
def traces_sampler(ctx):
|
||||
name = ctx.get("transaction_context", {}).get("name", "")
|
||||
def traces_sampler(sampling_context):
|
||||
name = sampling_context.get("transaction_context", {}).get("name", "")
|
||||
parent_sampled = sampling_context.get("parent_sampled")
|
||||
if "healthcheck" in name: return 0
|
||||
if "checkout" in name: return 1.0
|
||||
if parent_sampled is not None: return parent_sampled # Respect parent decision
|
||||
return 0.1
|
||||
|
||||
sentry_sdk.init(dsn="YOUR_DSN", traces_sampler=traces_sampler)
|
||||
@@ -113,7 +116,7 @@ end
|
||||
| `http.server` | Incoming HTTP |
|
||||
| `db` / `db.query` | Database |
|
||||
| `cache` | Cache operations |
|
||||
| `task` | Background jobs |
|
||||
| `queue.task` | Background jobs |
|
||||
| `function` | Function calls |
|
||||
|
||||
## Sampling Recommendations
|
||||
@@ -132,9 +135,9 @@ Configure `tracePropagationTargets` to send trace headers to your APIs:
|
||||
tracePropagationTargets: ["localhost", "https://api.yourapp.com"],
|
||||
```
|
||||
|
||||
For Next.js 14+ App Router, add to root layout:
|
||||
For Next.js 14 App Router, add to root layout (not needed in Next.js 15+):
|
||||
```typescript
|
||||
export async function generateMetadata() {
|
||||
export function generateMetadata(): Metadata {
|
||||
return { other: { ...Sentry.getTraceData() } };
|
||||
}
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user