diff --git a/docs/platforms/dotnet/common/logs/index.mdx b/docs/platforms/dotnet/common/logs/index.mdx index 8c6dfa342bf3c..13fac1464347b 100644 --- a/docs/platforms/dotnet/common/logs/index.mdx +++ b/docs/platforms/dotnet/common/logs/index.mdx @@ -12,6 +12,24 @@ notSupported: - dotnet.xamarin --- + + +Install Sentry's [agent skills](/ai/agent-skills/) to teach your AI coding assistant how to set up logging in your .NET application. + +### Install Skills + +```bash {tabTitle: dotagents} +npx @sentry/dotagents add getsentry/sentry-agent-skills --name sentry-setup-logging +``` + +```bash {tabTitle: npx skills} +npx skills add getsentry/sentry-agent-skills --skill sentry-setup-logging +``` + +See the [full list of available skills](https://skills.sh/getsentry/sentry-agent-skills) and [installation docs](/ai/agent-skills/) for more details. + + + With Sentry Structured Logs, you can send text-based log information from your applications to Sentry. Once in Sentry, these logs can be viewed alongside relevant errors, searched by text-string, or searched using their individual attributes. ## Requirements diff --git a/docs/platforms/dotnet/common/metrics/index.mdx b/docs/platforms/dotnet/common/metrics/index.mdx index e4c794598b2d7..716378fcfb4e2 100644 --- a/docs/platforms/dotnet/common/metrics/index.mdx +++ b/docs/platforms/dotnet/common/metrics/index.mdx @@ -7,6 +7,24 @@ sidebar_section: features beta: true --- + + +Install Sentry's [agent skills](/ai/agent-skills/) to teach your AI coding assistant how to set up metrics in your .NET application. + +### Install Skills + +```bash {tabTitle: dotagents} +npx @sentry/dotagents add getsentry/sentry-agent-skills --name sentry-setup-metrics +``` + +```bash {tabTitle: npx skills} +npx skills add getsentry/sentry-agent-skills --skill sentry-setup-metrics +``` + +See the [full list of available skills](https://skills.sh/getsentry/sentry-agent-skills) and [installation docs](/ai/agent-skills/) for more details. + + + This feature is currently in open beta. Please reach out on [GitHub](https://github.com/getsentry/sentry/discussions/102275) if you have diff --git a/docs/platforms/dotnet/common/tracing/index.mdx b/docs/platforms/dotnet/common/tracing/index.mdx index 27abee1d7f342..43217120322cc 100644 --- a/docs/platforms/dotnet/common/tracing/index.mdx +++ b/docs/platforms/dotnet/common/tracing/index.mdx @@ -6,6 +6,24 @@ sidebar_order: 3 sidebar_section: features --- + + +Install Sentry’s [agent skills](/ai/agent-skills/) to teach your AI coding assistant how to set up tracing in your .NET application. + +### Install Skills + +```bash {tabTitle: dotagents} +npx @sentry/dotagents add getsentry/sentry-agent-skills --name sentry-setup-tracing +``` + +```bash {tabTitle: npx skills} +npx skills add getsentry/sentry-agent-skills --skill sentry-setup-tracing +``` + +See the [full list of available skills](https://skills.sh/getsentry/sentry-agent-skills) and [installation docs](/ai/agent-skills/) for more details. + + + With [tracing](/product/insights/overview/), Sentry tracks your software performance, measuring metrics like throughput and latency, and displaying the impact of errors across multiple systems. Sentry captures distributed traces consisting of transactions and spans, which measure individual services and individual operations within those services. Learn more about our model in [Distributed Tracing](/product/sentry-basics/tracing/distributed-tracing/). diff --git a/docs/platforms/javascript/common/ai-agent-monitoring/index.mdx b/docs/platforms/javascript/common/ai-agent-monitoring/index.mdx index f0fe008495215..cf5b7c3912142 100644 --- a/docs/platforms/javascript/common/ai-agent-monitoring/index.mdx +++ b/docs/platforms/javascript/common/ai-agent-monitoring/index.mdx @@ -31,6 +31,24 @@ supported: With Sentry AI Agent Monitoring, you can monitor and debug your AI systems with full-stack context. You'll be able to track key insights like token usage, latency, tool usage, and error rates. AI Agent Monitoring data will be fully connected to your other Sentry data like logs, errors, and traces. + + +Install Sentry's [agent skills](/ai/agent-skills/) to teach your AI coding assistant how to set up AI Agent Monitoring in your application. + +### Install Skills + +```bash {tabTitle: dotagents} +npx @sentry/dotagents add getsentry/sentry-agent-skills --name sentry-setup-ai-monitoring +``` + +```bash {tabTitle: npx skills} +npx skills add getsentry/sentry-agent-skills --skill sentry-setup-ai-monitoring +``` + +See the [full list of available skills](https://skills.sh/getsentry/sentry-agent-skills) and [installation docs](/ai/agent-skills/) for more details. + + + ## Prerequisites Before setting up AI Agent Monitoring, ensure you have tracing enabled in your Sentry configuration. diff --git a/docs/platforms/javascript/common/metrics/index.mdx b/docs/platforms/javascript/common/metrics/index.mdx index bc574dfa58b8d..a8e8e878055a7 100644 --- a/docs/platforms/javascript/common/metrics/index.mdx +++ b/docs/platforms/javascript/common/metrics/index.mdx @@ -10,6 +10,24 @@ notSupported: - javascript.capacitor --- + + +Install Sentry's [agent skills](/ai/agent-skills/) to teach your AI coding assistant how to set up metrics in your application. + +### Install Skills + +```bash {tabTitle: dotagents} +npx @sentry/dotagents add getsentry/sentry-agent-skills --name sentry-setup-metrics +``` + +```bash {tabTitle: npx skills} +npx skills add getsentry/sentry-agent-skills --skill sentry-setup-metrics +``` + +See the [full list of available skills](https://skills.sh/getsentry/sentry-agent-skills) and [installation docs](/ai/agent-skills/) for more details. + + + With [Sentry Metrics](/product/explore/metrics/), you can send counters, gauges, and distributions from your applications to Sentry. Once in Sentry, these metrics can be viewed alongside relevant errors, and searched using their individual attributes. diff --git a/docs/platforms/javascript/common/tracing/index.mdx b/docs/platforms/javascript/common/tracing/index.mdx index 93193790e6670..90ef301918f01 100644 --- a/docs/platforms/javascript/common/tracing/index.mdx +++ b/docs/platforms/javascript/common/tracing/index.mdx @@ -6,6 +6,24 @@ sidebar_order: 6 sidebar_section: features --- + + +Install Sentry's [agent skills](/ai/agent-skills/) to teach your AI coding assistant how to set up tracing in your application. + +### Install Skills + +```bash {tabTitle: dotagents} +npx @sentry/dotagents add getsentry/sentry-agent-skills --name sentry-setup-tracing +``` + +```bash {tabTitle: npx skills} +npx skills add getsentry/sentry-agent-skills --skill sentry-setup-tracing +``` + +See the [full list of available skills](https://skills.sh/getsentry/sentry-agent-skills) and [installation docs](/ai/agent-skills/) for more details. + + + With [tracing](/product/insights/overview/), Sentry automatically tracks your software performance across your application services, measuring metrics like throughput and latency, and displaying the impact of errors across multiple systems. diff --git a/docs/platforms/javascript/guides/nextjs/logs/index.mdx b/docs/platforms/javascript/guides/nextjs/logs/index.mdx index 862bd2b78f64a..bae6030edd6f7 100644 --- a/docs/platforms/javascript/guides/nextjs/logs/index.mdx +++ b/docs/platforms/javascript/guides/nextjs/logs/index.mdx @@ -7,6 +7,24 @@ sidebar_section: features new: true --- + + +Install Sentry's [agent skills](/ai/agent-skills/) to teach your AI coding assistant how to set up logging in your Next.js application. + +### Install Skills + +```bash {tabTitle: dotagents} +npx @sentry/dotagents add getsentry/sentry-agent-skills --name sentry-setup-logging +``` + +```bash {tabTitle: npx skills} +npx skills add getsentry/sentry-agent-skills --skill sentry-setup-logging +``` + +See the [full list of available skills](https://skills.sh/getsentry/sentry-agent-skills) and [installation docs](/ai/agent-skills/) for more details. + + + Sentry Logs let you send structured log data from your Next.js application. Unlike traditional string-based logging, structured logs include queryable attributes that help you debug issues faster by filtering on specific users, orders, or any business context you include. ## Setup diff --git a/docs/platforms/javascript/guides/nextjs/tracing/index.mdx b/docs/platforms/javascript/guides/nextjs/tracing/index.mdx index 4933eb3d44463..9adf273142d22 100644 --- a/docs/platforms/javascript/guides/nextjs/tracing/index.mdx +++ b/docs/platforms/javascript/guides/nextjs/tracing/index.mdx @@ -6,6 +6,24 @@ sidebar_order: 5 sidebar_section: features --- + + +Install Sentry's [agent skills](/ai/agent-skills/) to teach your AI coding assistant how to set up tracing in your Next.js application. + +### Install Skills + +```bash {tabTitle: dotagents} +npx @sentry/dotagents add getsentry/sentry-agent-skills --name sentry-setup-tracing +``` + +```bash {tabTitle: npx skills} +npx skills add getsentry/sentry-agent-skills --skill sentry-setup-tracing +``` + +See the [full list of available skills](https://skills.sh/getsentry/sentry-agent-skills) and [installation docs](/ai/agent-skills/) for more details. + + + Tracing captures the timing and flow of requests through your Next.js application. Learn more about [tracing](/concepts/key-terms/tracing/) and how Sentry uses traces to track performance across services. Sentry automatically instruments most operations, but Server Actions require manual setup. diff --git a/docs/platforms/python/integrations/openai-agents/index.mdx b/docs/platforms/python/integrations/openai-agents/index.mdx index 8280bb2c55e4c..c30e347bc4f95 100644 --- a/docs/platforms/python/integrations/openai-agents/index.mdx +++ b/docs/platforms/python/integrations/openai-agents/index.mdx @@ -12,6 +12,24 @@ The support for **OpenAI Agents SDK** is in its beta phase. Please test locally This integration connects Sentry with the [OpenAI Python SDK](https://openai.github.io/openai-agents-python/). The integration has been confirmed to work with OpenAI Agents version 0.0.19. + + +Install Sentry's [agent skills](/ai/agent-skills/) to teach your AI coding assistant how to set up AI Agent Monitoring in your Python application. + +### Install Skills + +```bash {tabTitle: dotagents} +npx @sentry/dotagents add getsentry/sentry-agent-skills --name sentry-setup-ai-monitoring +``` + +```bash {tabTitle: npx skills} +npx skills add getsentry/sentry-agent-skills --skill sentry-setup-ai-monitoring +``` + +See the [full list of available skills](https://skills.sh/getsentry/sentry-agent-skills) and [installation docs](/ai/agent-skills/) for more details. + + + Once you've installed this SDK, you can use [Sentry AI Agents Insights](https://sentry.io/orgredirect/organizations/:orgslug/insights/ai/agents/), a Sentry dashboard that helps you understand what's going on with your AI agents. Sentry AI Agents monitoring will automatically collect information about agents, tools, prompts, tokens, and models. diff --git a/docs/platforms/python/logs/index.mdx b/docs/platforms/python/logs/index.mdx index 78a03abe74313..0a93e2c07580f 100644 --- a/docs/platforms/python/logs/index.mdx +++ b/docs/platforms/python/logs/index.mdx @@ -7,6 +7,24 @@ sidebar_section: features new: true --- + + +Install Sentry's [agent skills](/ai/agent-skills/) to teach your AI coding assistant how to set up logging in your Python application. + +### Install Skills + +```bash {tabTitle: dotagents} +npx @sentry/dotagents add getsentry/sentry-agent-skills --name sentry-setup-logging +``` + +```bash {tabTitle: npx skills} +npx skills add getsentry/sentry-agent-skills --skill sentry-setup-logging +``` + +See the [full list of available skills](https://skills.sh/getsentry/sentry-agent-skills) and [installation docs](/ai/agent-skills/) for more details. + + + With Sentry Structured Logs, you can send text-based log information from your applications to Sentry. Once in Sentry, these logs can be viewed alongside relevant errors, searched by text-string, or searched using their individual attributes. ## Requirements diff --git a/docs/platforms/python/metrics/index.mdx b/docs/platforms/python/metrics/index.mdx index 6c65adceb391e..16913ab5c47b6 100644 --- a/docs/platforms/python/metrics/index.mdx +++ b/docs/platforms/python/metrics/index.mdx @@ -7,6 +7,24 @@ sidebar_section: features beta: true --- + + +Install Sentry's [agent skills](/ai/agent-skills/) to teach your AI coding assistant how to set up metrics in your Python application. + +### Install Skills + +```bash {tabTitle: dotagents} +npx @sentry/dotagents add getsentry/sentry-agent-skills --name sentry-setup-metrics +``` + +```bash {tabTitle: npx skills} +npx skills add getsentry/sentry-agent-skills --skill sentry-setup-metrics +``` + +See the [full list of available skills](https://skills.sh/getsentry/sentry-agent-skills) and [installation docs](/ai/agent-skills/) for more details. + + + This feature is currently in open beta. Please reach out on [GitHub](https://github.com/getsentry/sentry/discussions/102275) if you have feedback or questions. Features in beta are still in-progress and may have bugs. We recognize the irony. diff --git a/docs/platforms/python/tracing/index.mdx b/docs/platforms/python/tracing/index.mdx index acd9cf828c4f4..3a70eeba71395 100644 --- a/docs/platforms/python/tracing/index.mdx +++ b/docs/platforms/python/tracing/index.mdx @@ -6,6 +6,24 @@ sidebar_order: 6 sidebar_section: features --- + + +Install Sentry's [agent skills](/ai/agent-skills/) to teach your AI coding assistant how to set up tracing in your Python application. + +### Install Skills + +```bash {tabTitle: dotagents} +npx @sentry/dotagents add getsentry/sentry-agent-skills --name sentry-setup-tracing +``` + +```bash {tabTitle: npx skills} +npx skills add getsentry/sentry-agent-skills --skill sentry-setup-tracing +``` + +See the [full list of available skills](https://skills.sh/getsentry/sentry-agent-skills) and [installation docs](/ai/agent-skills/) for more details. + + + ## Prerequisites * You have the Python SDK installed (version 0.11.2 or higher) diff --git a/docs/platforms/python/tracing/instrumentation/custom-instrumentation/ai-agents-module.mdx b/docs/platforms/python/tracing/instrumentation/custom-instrumentation/ai-agents-module.mdx index bb0f4b0b78675..75290a13c82b8 100644 --- a/docs/platforms/python/tracing/instrumentation/custom-instrumentation/ai-agents-module.mdx +++ b/docs/platforms/python/tracing/instrumentation/custom-instrumentation/ai-agents-module.mdx @@ -6,6 +6,24 @@ description: "Learn how to manually instrument your code to use Sentry's Agents With Sentry AI Agent Monitoring, you can monitor and debug your AI systems with full-stack context. You'll be able to track key insights like token usage, latency, tool usage, and error rates. AI Agent Monitoring data will be fully connected to your other Sentry data like logs, errors, and traces. + + +Install Sentry's [agent skills](/ai/agent-skills/) to teach your AI coding assistant how to set up AI Agent Monitoring in your Python application. + +### Install Skills + +```bash {tabTitle: dotagents} +npx @sentry/dotagents add getsentry/sentry-agent-skills --name sentry-setup-ai-monitoring +``` + +```bash {tabTitle: npx skills} +npx skills add getsentry/sentry-agent-skills --skill sentry-setup-ai-monitoring +``` + +See the [full list of available skills](https://skills.sh/getsentry/sentry-agent-skills) and [installation docs](/ai/agent-skills/) for more details. + + + As a prerequisite to setting up AI Agent Monitoring with Python, you'll need to first set up tracing. Once this is done, the Python SDK will automatically instrument AI agents created with supported libraries. If that doesn't fit your use case, you can use custom instrumentation described below. ## Automatic Instrumentation diff --git a/docs/platforms/ruby/common/metrics/index.mdx b/docs/platforms/ruby/common/metrics/index.mdx index 6c65adceb391e..ece5b06dbeb82 100644 --- a/docs/platforms/ruby/common/metrics/index.mdx +++ b/docs/platforms/ruby/common/metrics/index.mdx @@ -7,6 +7,24 @@ sidebar_section: features beta: true --- + + +Install Sentry's [agent skills](/ai/agent-skills/) to teach your AI coding assistant how to set up metrics in your Ruby application. + +### Install Skills + +```bash {tabTitle: dotagents} +npx @sentry/dotagents add getsentry/sentry-agent-skills --name sentry-setup-metrics +``` + +```bash {tabTitle: npx skills} +npx skills add getsentry/sentry-agent-skills --skill sentry-setup-metrics +``` + +See the [full list of available skills](https://skills.sh/getsentry/sentry-agent-skills) and [installation docs](/ai/agent-skills/) for more details. + + + This feature is currently in open beta. Please reach out on [GitHub](https://github.com/getsentry/sentry/discussions/102275) if you have feedback or questions. Features in beta are still in-progress and may have bugs. We recognize the irony. diff --git a/docs/platforms/ruby/common/tracing/index.mdx b/docs/platforms/ruby/common/tracing/index.mdx index 03548a4ffd191..295f0280b3697 100644 --- a/docs/platforms/ruby/common/tracing/index.mdx +++ b/docs/platforms/ruby/common/tracing/index.mdx @@ -6,6 +6,24 @@ sidebar_order: 6 sidebar_section: features --- + + +Install Sentry’s [agent skills](/ai/agent-skills/) to teach your AI coding assistant how to set up tracing in your Ruby application. + +### Install Skills + +```bash {tabTitle: dotagents} +npx @sentry/dotagents add getsentry/sentry-agent-skills --name sentry-setup-tracing +``` + +```bash {tabTitle: npx skills} +npx skills add getsentry/sentry-agent-skills --skill sentry-setup-tracing +``` + +See the [full list of available skills](https://skills.sh/getsentry/sentry-agent-skills) and [installation docs](/ai/agent-skills/) for more details. + + + With [tracing](/product/insights/overview/), Sentry tracks your software performance, measuring metrics like throughput and latency, and displaying the impact of errors across multiple systems. Sentry captures distributed traces consisting of transactions and spans, which measure individual services and individual operations within those services. Learn more about our model in [Distributed Tracing](/product/sentry-basics/tracing/distributed-tracing/). diff --git a/docs/platforms/ruby/logs/index.mdx b/docs/platforms/ruby/logs/index.mdx index 78a03abe74313..200d686d44022 100644 --- a/docs/platforms/ruby/logs/index.mdx +++ b/docs/platforms/ruby/logs/index.mdx @@ -7,6 +7,24 @@ sidebar_section: features new: true --- + + +Install Sentry's [agent skills](/ai/agent-skills/) to teach your AI coding assistant how to set up logging in your Ruby application. + +### Install Skills + +```bash {tabTitle: dotagents} +npx @sentry/dotagents add getsentry/sentry-agent-skills --name sentry-setup-logging +``` + +```bash {tabTitle: npx skills} +npx skills add getsentry/sentry-agent-skills --skill sentry-setup-logging +``` + +See the [full list of available skills](https://skills.sh/getsentry/sentry-agent-skills) and [installation docs](/ai/agent-skills/) for more details. + + + With Sentry Structured Logs, you can send text-based log information from your applications to Sentry. Once in Sentry, these logs can be viewed alongside relevant errors, searched by text-string, or searched using their individual attributes. ## Requirements diff --git a/platform-includes/llm-rules-logs/_default.mdx b/platform-includes/llm-rules-logs/_default.mdx new file mode 100644 index 0000000000000..4b7360faa788c --- /dev/null +++ b/platform-includes/llm-rules-logs/_default.mdx @@ -0,0 +1,17 @@ + + +Install Sentry's [agent skills](/ai/agent-skills/) to teach your AI coding assistant how to set up logging in your application. + +### Install Skills + +```bash {tabTitle: dotagents} +npx @sentry/dotagents add getsentry/sentry-agent-skills --name sentry-setup-logging +``` + +```bash {tabTitle: npx skills} +npx skills add getsentry/sentry-agent-skills --skill sentry-setup-logging +``` + +See the [full list of available skills](https://skills.sh/getsentry/sentry-agent-skills) and [installation docs](/ai/agent-skills/) for more details. + + diff --git a/platform-includes/llm-rules-logs/javascript.nextjs.mdx b/platform-includes/llm-rules-logs/javascript.nextjs.mdx index 6e7c9e79e038b..df3c71c1f16d6 100644 --- a/platform-includes/llm-rules-logs/javascript.nextjs.mdx +++ b/platform-includes/llm-rules-logs/javascript.nextjs.mdx @@ -1,66 +1,17 @@ - + -When created as a rules file this should be placed alongside other editor specific rule files. For example, if you are using Cursor, place this file in the `.cursor/rules` directory, or the contents in the `AGENTS.md` or `.cursorrules` (legacy) files. +Install Sentry's [agent skills](/ai/agent-skills/) to teach your AI coding assistant how to set up logging in your Next.js application. -````markdown {filename:rules.mdc} -# Logs +### Install Skills -- Where logs are used, ensure Sentry is imported using `import * as Sentry from "@sentry/nextjs"` -- Enable logging in Sentry using `Sentry.init({ enableLogs: true })` -- Sentry offers a `consoleLoggingIntegration` that can be used to log specific console error types automatically without instrumenting the individual logger calls - -## Configuration - -The Sentry initialization needs to be updated to enable the logs feature. - -### Baseline - -```javascript -import * as Sentry from "@sentry/nextjs"; - -Sentry.init({ - dsn: "https://examplePublicKey@o0.ingest.sentry.io/0", - // Enable logs to be sent to Sentry - enableLogs: true, -}); +```bash {tabTitle: dotagents} +npx @sentry/dotagents add getsentry/sentry-agent-skills --name sentry-setup-logging ``` -### Logger Integration - -```javascript -Sentry.init({ - dsn: "https://examplePublicKey@o0.ingest.sentry.io/0", - enableLogs: true, - integrations: [ - // send console.log, console.warn, and console.error calls as logs to Sentry - Sentry.consoleLoggingIntegration({ levels: ["log", "warn", "error"] }), - ], -}); +```bash {tabTitle: npx skills} +npx skills add getsentry/sentry-agent-skills --skill sentry-setup-logging ``` -## Logger Examples - -`Sentry.logger.fmt` is a template literal function that should be used to bring variables into the structured logs. - -```javascript -import * as Sentry from "@sentry/nextjs"; - -Sentry.logger.trace("Starting database connection", { database: "users" }); -Sentry.logger.debug(Sentry.logger.fmt`Cache miss for user: ${userId}`); -Sentry.logger.info("Updated profile", { profileId: 345 }); -Sentry.logger.warn("Rate limit reached for endpoint", { - endpoint: "/api/results/", - isEnterprise: false, -}); -Sentry.logger.error("Failed to process payment", { - orderId: "order_123", - amount: 99.99, -}); -Sentry.logger.fatal("Database connection pool exhausted", { - database: "users", - activeConnections: 100, -}); -``` -```` +See the [full list of available skills](https://skills.sh/getsentry/sentry-agent-skills) and [installation docs](/ai/agent-skills/) for more details. diff --git a/platform-includes/llm-rules-logs/javascript.node.mdx b/platform-includes/llm-rules-logs/javascript.node.mdx index 1f832c17636f6..1e9b6a3c9f59d 100644 --- a/platform-includes/llm-rules-logs/javascript.node.mdx +++ b/platform-includes/llm-rules-logs/javascript.node.mdx @@ -1,66 +1,17 @@ - + -When created as a rules file this should be placed alongside other editor specific rule files. For example, if you are using Cursor, place this file in the `.cursor/rules` directory, or the contents in the `AGENTS.md` or `.cursorrules` (legacy) files. +Install Sentry's [agent skills](/ai/agent-skills/) to teach your AI coding assistant how to set up logging in your Node.js application. -````markdown {filename:rules.mdc} -# Logs +### Install Skills -- Where logs are used, ensure Sentry is imported using `import * as Sentry from "@sentry/node"` -- Enable logging in Sentry using `Sentry.init({ enableLogs: true })` -- Sentry offers a `consoleLoggingIntegration` that can be used to log specific console error types automatically without instrumenting the individual logger calls - -## Configuration - -The Sentry initialization needs to be updated to enable the logs feature. - -### Baseline - -```javascript -import * as Sentry from "@sentry/node"; - -Sentry.init({ - dsn: "https://examplePublicKey@o0.ingest.sentry.io/0", - // Enable logs to be sent to Sentry - enableLogs: true, -}); +```bash {tabTitle: dotagents} +npx @sentry/dotagents add getsentry/sentry-agent-skills --name sentry-setup-logging ``` -### Logger Integration - -```javascript -Sentry.init({ - dsn: "https://examplePublicKey@o0.ingest.sentry.io/0", - enableLogs: true, - integrations: [ - // send console.log, console.warn, and console.error calls as logs to Sentry - Sentry.consoleLoggingIntegration({ levels: ["log", "warn", "error"] }), - ], -}); +```bash {tabTitle: npx skills} +npx skills add getsentry/sentry-agent-skills --skill sentry-setup-logging ``` -## Logger Examples - -`Sentry.logger.fmt` is a template literal function that should be used to bring variables into the structured logs. - -```javascript -import * as Sentry from "@sentry/node"; - -Sentry.logger.trace("Starting database connection", { database: "users" }); -Sentry.logger.debug(Sentry.logger.fmt`Cache miss for user: ${userId}`); -Sentry.logger.info("Updated profile", { profileId: 345 }); -Sentry.logger.warn("Rate limit reached for endpoint", { - endpoint: "/api/results/", - isEnterprise: false, -}); -Sentry.logger.error("Failed to process payment", { - orderId: "order_123", - amount: 99.99, -}); -Sentry.logger.fatal("Database connection pool exhausted", { - database: "users", - activeConnections: 100, -}); -``` -```` +See the [full list of available skills](https://skills.sh/getsentry/sentry-agent-skills) and [installation docs](/ai/agent-skills/) for more details. diff --git a/platform-includes/llm-rules-logs/javascript.react.mdx b/platform-includes/llm-rules-logs/javascript.react.mdx index 4338c8c736de7..1c8f85eb50380 100644 --- a/platform-includes/llm-rules-logs/javascript.react.mdx +++ b/platform-includes/llm-rules-logs/javascript.react.mdx @@ -1,64 +1,17 @@ - + -When created as a rules file this should be placed alongside other editor specific rule files. For example, if you are using Cursor, place this file in the `.cursor/rules` directory, or the contents in the `AGENTS.md` or `.cursorrules` (legacy) files. +Install Sentry's [agent skills](/ai/agent-skills/) to teach your AI coding assistant how to set up logging in your React application. -````markdown {filename:rules.mdc} -# Logs +### Install Skills -- Where logs are used, ensure Sentry is imported using `import * as Sentry from "@sentry/react"` -- Enable logging in Sentry using `Sentry.init({ enableLogs: true })` -- Sentry offers a `consoleLoggingIntegration` that can be used to log specific console error types automatically without instrumenting the individual logger calls - -## Configuration - -The Sentry initialization needs to be updated to enable the logs feature. - -### Baseline - -```javascript -Sentry.init({ - dsn: "https://examplePublicKey@o0.ingest.sentry.io/0", - // Enable logs to be sent to Sentry - enableLogs: true, -}); +```bash {tabTitle: dotagents} +npx @sentry/dotagents add getsentry/sentry-agent-skills --name sentry-setup-logging ``` -### Logger Integration - -```javascript -Sentry.init({ - dsn: "https://examplePublicKey@o0.ingest.sentry.io/0", - enableLogs: true, - integrations: [ - // send console.log, console.error, and console.warn calls as logs to Sentry - Sentry.consoleLoggingIntegration({ levels: ["log", "error", "warn"] }), - ], -}); +```bash {tabTitle: npx skills} +npx skills add getsentry/sentry-agent-skills --skill sentry-setup-logging ``` -## Logger Examples - -`Sentry.logger.fmt` is a template literal function that should be used to bring variables into the structured logs. - -```javascript -import * as Sentry from "@sentry/react"; - -Sentry.logger.trace("Starting database connection", { database: "users" }); -Sentry.logger.debug(Sentry.logger.fmt`Cache miss for user: ${userId}`); -Sentry.logger.info("Updated profile", { profileId: 345 }); -Sentry.logger.warn("Rate limit reached for endpoint", { - endpoint: "/api/results/", - isEnterprise: false, -}); -Sentry.logger.error("Failed to process payment", { - orderId: "order_123", - amount: 99.99, -}); -Sentry.logger.fatal("Database connection pool exhausted", { - database: "users", - activeConnections: 100, -}); -``` -```` +See the [full list of available skills](https://skills.sh/getsentry/sentry-agent-skills) and [installation docs](/ai/agent-skills/) for more details. diff --git a/platform-includes/llm-rules-platform/_default.mdx b/platform-includes/llm-rules-platform/_default.mdx index 8384bd0da4937..544a29fa10cbb 100644 --- a/platform-includes/llm-rules-platform/_default.mdx +++ b/platform-includes/llm-rules-platform/_default.mdx @@ -1,137 +1,17 @@ - + -Sentry provides a set of rules you can use to help your LLM use Sentry correctly. Copy this file and add it to your projects rules configuration. When created as a rules file this should be placed alongside other editor specific rule files. For example, if you are using Cursor, place this file in the `.cursor/rules` directory, or the contents in the `AGENTS.md` or `.cursorrules` (legacy) files. +Install Sentry's [agent skills](/ai/agent-skills/) to teach your AI coding assistant how to set up and use Sentry correctly. -{/* ATTENTION: The rules defined here must match those in the app's onboarding documentation (see: https://github.com/getsentry/sentry/blob/master/static/app/gettingStartedDocs/javascript/javascript.tsx). -If you make any changes, please update the getting started doc accordingly. */} +### Install Skills -````markdown {filename:rules.mdc} -These examples should be used as guidance when configuring Sentry functionality within a project. - -# Error / Exception Tracking - -- Use `Sentry.captureException(error)` to capture an exception and log the error in Sentry. -- Use this in try catch blocks or areas where exceptions are expected - -# Tracing Examples - -- Spans should be created for meaningful actions within applications like button clicks, API calls, and function calls -- Use the `Sentry.startSpan` function to create a span -- Child spans can exist within a parent span - -## Custom Span instrumentation in component actions - -- Name custom spans with meaningful names and operations. -- Attach attributes based on relevant information and metrics from the request - -```javascript -function TestComponent() { - const handleTestButtonClick = () => { - // Create a transaction/span to measure performance - Sentry.startSpan( - { - op: "ui.click", - name: "Test Button Click", - }, - (span) => { - const value = "some config"; - const metric = "some metric"; - - // Metrics can be added to the span - span.setAttribute("config", value); - span.setAttribute("metric", metric); - - doSomething(); - } - ); - }; - - return ( - - ); -} +```bash {tabTitle: dotagents} +npx @sentry/dotagents add getsentry/sentry-agent-skills --all ``` -## Custom span instrumentation in API calls - -- Name custom spans with meaningful names and operations. -- Attach attributes based on relevant information and metrics from the request - -```javascript -async function fetchUserData(userId) { - return Sentry.startSpan( - { - op: "http.client", - name: `GET /api/users/${userId}`, - }, - async () => { - const response = await fetch(`/api/users/${userId}`); - const data = await response.json(); - return data; - } - ); -} +```bash {tabTitle: npx skills} +npx skills add getsentry/sentry-agent-skills ``` -# Logs - -- Where logs are used, ensure Sentry is imported using `import * as Sentry from "@sentry/browser"` -- Enable logging in Sentry using `Sentry.init({ enableLogs: true })` -- Reference the logger using `Sentry.logger` -- Sentry offers a `consoleLoggingIntegration` that can be used to log specific console error types automatically without instrumenting the individual logger calls - -## Configuration - -### Baseline - -```javascript -import * as Sentry from "@sentry/browser"; - -Sentry.init({ - dsn: "https://examplePublicKey@o0.ingest.sentry.io/0", - - enableLogs: true, -}); -``` - -### Logger Integration - -```javascript -Sentry.init({ - dsn: "https://examplePublicKey@o0.ingest.sentry.io/0", - enableLogs: true, - integrations: [ - // send console.log, console.error, and console.warn calls as logs to Sentry - Sentry.consoleLoggingIntegration({ levels: ["log", "error", "warn"] }), - ], -}); -``` - -## Logger Examples - -`Sentry.logger.fmt` is a template literal function that should be used to bring variables into the structured logs. - -```javascript -import * as Sentry from "@sentry/browser"; - -Sentry.logger.trace("Starting database connection", { database: "users" }); -Sentry.logger.debug(Sentry.logger.fmt`Cache miss for user: ${userId}`); -Sentry.logger.info("Updated profile", { profileId: 345 }); -Sentry.logger.warn("Rate limit reached for endpoint", { - endpoint: "/api/results/", - isEnterprise: false, -}); -Sentry.logger.error("Failed to process payment", { - orderId: "order_123", - amount: 99.99, -}); -Sentry.logger.fatal("Database connection pool exhausted", { - database: "users", - activeConnections: 100, -}); -``` -```` +See the [full list of available skills](https://skills.sh/getsentry/sentry-agent-skills) and [installation docs](/ai/agent-skills/) for more details. diff --git a/platform-includes/llm-rules-platform/javascript.nextjs.mdx b/platform-includes/llm-rules-platform/javascript.nextjs.mdx index 48ea4ff56a132..d3204dad81003 100644 --- a/platform-includes/llm-rules-platform/javascript.nextjs.mdx +++ b/platform-includes/llm-rules-platform/javascript.nextjs.mdx @@ -1,138 +1,17 @@ - + -Sentry provides a set of rules you can use to help your LLM use Sentry correctly. Copy this file and add it to your projects rules configuration. When created as a rules file this should be placed alongside other editor specific rule files. For example, if you are using Cursor, place this file in the `.cursor/rules` directory, or the contents in the `AGENTS.md` or `.cursorrules` (legacy) files. +Install Sentry's [agent skills](/ai/agent-skills/) to teach your AI coding assistant how to set up and use Sentry in your Next.js application. -{/* ATTENTION: The rules defined here must match those in the app's onboarding documentation (see: https://github.com/getsentry/sentry/blob/master/static/app/gettingStartedDocs/javascript/nextjs.tsx). -If you make any changes, please update the getting started doc accordingly. */} +### Install Skills -````markdown {filename:rules.mdc} -These examples should be used as guidance when configuring Sentry functionality within a project. - -# Exception Catching - -- Use `Sentry.captureException(error)` to capture an exception and log the error in Sentry. -- Use this in try catch blocks or areas where exceptions are expected - -# Tracing Examples - -- Spans should be created for meaningful actions within applications like button clicks, API calls, and function calls -- Use the `Sentry.startSpan` function to create a span -- Child spans can exist within a parent span - -## Custom Span instrumentation in component actions - -- The `name` and `op` properties should be meaningful for the activities in the call. -- Attach attributes based on relevant information and metrics from the request - -```javascript -function TestComponent() { - const handleTestButtonClick = () => { - // Create a transaction/span to measure performance - Sentry.startSpan( - { - op: "ui.click", - name: "Test Button Click", - }, - (span) => { - const value = "some config"; - const metric = "some metric"; - - // Metrics can be added to the span - span.setAttribute("config", value); - span.setAttribute("metric", metric); - - doSomething(); - } - ); - }; - - return ( - - ); -} +```bash {tabTitle: dotagents} +npx @sentry/dotagents add getsentry/sentry-agent-skills --all ``` -## Custom span instrumentation in API calls - -- The `name` and `op` properties should be meaningful for the activities in the call. -- Attach attributes based on relevant information and metrics from the request - -```javascript -async function fetchUserData(userId) { - return Sentry.startSpan( - { - op: "http.client", - name: `GET /api/users/${userId}`, - }, - async () => { - const response = await fetch(`/api/users/${userId}`); - const data = await response.json(); - return data; - } - ); -} +```bash {tabTitle: npx skills} +npx skills add getsentry/sentry-agent-skills ``` -# Logs - -- Where logs are used, ensure Sentry is imported using `import * as Sentry from "@sentry/nextjs"` -- Enable logging in Sentry using `Sentry.init({ enableLogs: true })` -- Reference the logger using `Sentry.logger` -- Sentry offers a consoleLoggingIntegration that can be used to log specific console error types automatically without instrumenting the individual logger calls - -## Configuration - -- In NextJS the client side Sentry initialization is in `instrumentation-client.ts`, the server initialization is in `sentry.server.config.ts` and the edge initialization is in `sentry.edge.config.ts` -- Initialization does not need to be repeated in other files, it only needs to happen the files mentioned above. You should use `import * as Sentry from "@sentry/nextjs"` to reference Sentry functionality - -### Baseline - -```javascript -import * as Sentry from "@sentry/nextjs"; - -Sentry.init({ - dsn: "https://examplePublicKey@o0.ingest.sentry.io/0", - - enableLogs: true, -}); -``` - -### Logger Integration - -```javascript -Sentry.init({ - dsn: "https://examplePublicKey@o0.ingest.sentry.io/0", - enableLogs: true, - integrations: [ - // send console.log, console.error, and console.warn calls as logs to Sentry - Sentry.consoleLoggingIntegration({ levels: ["log", "error", "warn"] }), - ], -}); -``` - -## Logger Examples - -`logger.fmt` is a template literal function that should be used to bring variables into the structured logs. - -```javascript -logger.trace("Starting database connection", { database: "users" }); -logger.debug(logger.fmt`Cache miss for user: ${userId}`); -logger.info("Updated profile", { profileId: 345 }); -logger.warn("Rate limit reached for endpoint", { - endpoint: "/api/results/", - isEnterprise: false, -}); -logger.error("Failed to process payment", { - orderId: "order_123", - amount: 99.99, -}); -logger.fatal("Database connection pool exhausted", { - database: "users", - activeConnections: 100, -}); -``` -```` +See the [full list of available skills](https://skills.sh/getsentry/sentry-agent-skills) and [installation docs](/ai/agent-skills/) for more details. diff --git a/platform-includes/llm-rules-platform/javascript.node.mdx b/platform-includes/llm-rules-platform/javascript.node.mdx index b9bd63d4f46dc..3c1f03e483921 100644 --- a/platform-includes/llm-rules-platform/javascript.node.mdx +++ b/platform-includes/llm-rules-platform/javascript.node.mdx @@ -1,132 +1,17 @@ - + -Sentry provides a set of rules you can use to help your LLM use Sentry correctly. Copy this file and add it to your projects rules configuration. When created as a rules file this should be placed alongside other editor specific rule files. For example, if you are using Cursor, place this file in the `.cursor/rules` directory, or the contents in the `AGENTS.md` or `.cursorrules` (legacy) files. +Install Sentry's [agent skills](/ai/agent-skills/) to teach your AI coding assistant how to set up and use Sentry in your Node.js application. -{/* ATTENTION: The rules defined here must match those in the app's onboarding documentation (see: https://github.com/getsentry/sentry/blob/master/static/app/gettingStartedDocs/node/node.tsx). -If you make any changes, please update the getting started doc accordingly. */} +### Install Skills -````markdown {filename:rules.mdc} -These examples should be used as guidance when configuring Sentry functionality within a project. - -# Error / Exception Tracking - -- Use `Sentry.captureException(error)` to capture an exception and log the error in Sentry. -- Use this in try catch blocks or areas where exceptions are expected - -# Tracing Examples - -- Spans should be created for meaningful actions within applications like button clicks, API calls, and function calls -- Ensure you are creating custom spans with meaningful names and operations -- Use the `Sentry.startSpan` function to create a span -- Child spans can exist within a parent span - -## Custom Span instrumentation in component actions - -```javascript -function TestComponent() { - const handleTestButtonClick = () => { - // Create a transaction/span to measure performance - Sentry.startSpan( - { - op: "ui.click", - name: "Test Button Click", - }, - (span) => { - const value = "some config"; - const metric = "some metric"; - - // Metrics can be added to the span - span.setAttribute("config", value); - span.setAttribute("metric", metric); - - doSomething(); - } - ); - }; - - return ( - - ); -} +```bash {tabTitle: dotagents} +npx @sentry/dotagents add getsentry/sentry-agent-skills --all ``` -## Custom span instrumentation in API calls - -```javascript -async function fetchUserData(userId) { - return Sentry.startSpan( - { - op: "http.client", - name: `GET /api/users/${userId}`, - }, - async () => { - const response = await fetch(`/api/users/${userId}`); - const data = await response.json(); - return data; - } - ); -} +```bash {tabTitle: npx skills} +npx skills add getsentry/sentry-agent-skills ``` -# Logs - -- Where logs are used, ensure they are imported using `import * as Sentry from "@sentry/node"` -- Enable logging in Sentry using `Sentry.init({ enableLogs: true, })` -- Reference the logger using `Sentry.logger` -- Sentry offers a consoleLoggingIntegration that can be used to log specific console error types automatically without instrumenting the individual logger calls - -## Configuration - -- In Node.js the Sentry initialization is typically in `instrumentation.ts` - -### Baseline - -```javascript -import * as Sentry from "@sentry/node"; - -Sentry.init({ - dsn: "https://examplePublicKey@o0.ingest.sentry.io/0", - - enableLogs: true, -}); -``` - -### Logger Integration - -```javascript -Sentry.init({ - dsn: "https://examplePublicKey@o0.ingest.sentry.io/0", - enableLogs: true, - integrations: [ - // send console.log, console.error, and console.warn calls as logs to Sentry - Sentry.consoleLoggingIntegration({ levels: ["log", "error", "warn"] }), - ], -}); -``` - -## Logger Examples - -`logger.fmt` is a template literal function that should be used to bring variables into the structured logs. - -```javascript -logger.trace("Starting database connection", { database: "users" }); -logger.debug(logger.fmt`Cache miss for user: ${userId}`); -logger.info("Updated profile", { profileId: 345 }); -logger.warn("Rate limit reached for endpoint", { - endpoint: "/api/results/", - isEnterprise: false, -}); -logger.error("Failed to process payment", { - orderId: "order_123", - amount: 99.99, -}); -logger.fatal("Database connection pool exhausted", { - database: "users", - activeConnections: 100, -}); -``` -```` +See the [full list of available skills](https://skills.sh/getsentry/sentry-agent-skills) and [installation docs](/ai/agent-skills/) for more details. diff --git a/platform-includes/llm-rules-platform/javascript.react.mdx b/platform-includes/llm-rules-platform/javascript.react.mdx index 26b21394e5887..7bbfca9685d98 100644 --- a/platform-includes/llm-rules-platform/javascript.react.mdx +++ b/platform-includes/llm-rules-platform/javascript.react.mdx @@ -1,130 +1,17 @@ - + -Sentry provides a set of rules you can use to help your LLM use Sentry correctly. Copy this file and add it to your projects rules configuration. When created as a rules file this should be placed alongside other editor specific rule files. For example, if you are using Cursor, place this file in the `.cursor/rules` directory, or the contents in the `AGENTS.md` or `.cursorrules` (legacy) files. +Install Sentry's [agent skills](/ai/agent-skills/) to teach your AI coding assistant how to set up and use Sentry in your React application. -{/* ATTENTION: The rules defined here must match those in the app's onboarding documentation (see: https://github.com/getsentry/sentry/blob/master/static/app/gettingStartedDocs/javascript/react.tsx). -If you make any changes, please update the getting started doc accordingly. */} +### Install Skills -````markdown {filename:rules.mdc} -These examples should be used as guidance when configuring Sentry functionality within a project. - -# Error / Exception Tracking - -- Use `Sentry.captureException(error)` to capture an exception and log the error in Sentry. -- Use this in try catch blocks or areas where exceptions are expected - -# Tracing Examples - -- Spans should be created for meaningful actions within applications like button clicks, API calls, and function calls -- Ensure you are creating custom spans with meaningful names and operations -- Use the `Sentry.startSpan` function to create a span -- Child spans can exist within a parent span - -## Custom Span instrumentation in component actions - -```javascript -function TestComponent() { - const handleTestButtonClick = () => { - // Create a transaction/span to measure performance - Sentry.startSpan( - { - op: "ui.click", - name: "Test Button Click", - }, - (span) => { - const value = "some config"; - const metric = "some metric"; - - // Metrics can be added to the span - span.setAttribute("config", value); - span.setAttribute("metric", metric); - - doSomething(); - } - ); - }; - - return ( - - ); -} -``` - -## Custom span instrumentation in API calls - -```javascript -async function fetchUserData(userId) { - return Sentry.startSpan( - { - op: "http.client", - name: `GET /api/users/${userId}`, - }, - async () => { - const response = await fetch(`/api/users/${userId}`); - const data = await response.json(); - return data; - } - ); -} +```bash {tabTitle: dotagents} +npx @sentry/dotagents add getsentry/sentry-agent-skills --all ``` -# Logs - -- Where logs are used, ensure Sentry is imported using `import * as Sentry from "@sentry/react"` -- Enable logging in Sentry using `Sentry.init({ enableLogs: true })` -- Reference the logger using `Sentry.logger` -- Sentry offers a consoleLoggingIntegration that can be used to log specific console error types automatically without instrumenting the individual logger calls - -## Configuration - -### Baseline - -```javascript -import * as Sentry from "@sentry/react"; - -Sentry.init({ - dsn: "https://examplePublicKey@o0.ingest.sentry.io/0", - - enableLogs: true, -}); +```bash {tabTitle: npx skills} +npx skills add getsentry/sentry-agent-skills ``` -### Logger Integration - -```javascript -Sentry.init({ - dsn: "https://examplePublicKey@o0.ingest.sentry.io/0", - enableLogs: true, - integrations: [ - // send console.log, console.error, and console.warn calls as logs to Sentry - Sentry.consoleLoggingIntegration({ levels: ["log", "error", "warn"] }), - ], -}); -``` - -## Logger Examples - -`logger.fmt` is a template literal function that should be used to bring variables into the structured logs. - -```javascript -logger.trace("Starting database connection", { database: "users" }); -logger.debug(logger.fmt`Cache miss for user: ${userId}`); -logger.info("Updated profile", { profileId: 345 }); -logger.warn("Rate limit reached for endpoint", { - endpoint: "/api/results/", - isEnterprise: false, -}); -logger.error("Failed to process payment", { - orderId: "order_123", - amount: 99.99, -}); -logger.fatal("Database connection pool exhausted", { - database: "users", - activeConnections: 100, -}); -``` -```` +See the [full list of available skills](https://skills.sh/getsentry/sentry-agent-skills) and [installation docs](/ai/agent-skills/) for more details. diff --git a/src/components/expandable/index.tsx b/src/components/expandable/index.tsx index 66364b877aed9..a79c973b7477f 100644 --- a/src/components/expandable/index.tsx +++ b/src/components/expandable/index.tsx @@ -14,7 +14,8 @@ import styles from './style.module.scss'; type Props = { children: ReactNode; title: string; - copy?: boolean; + /** If true, shows "Copy Rules" button. If a string, uses it as the button label. */ + copy?: boolean | string; /** If defined, the expandable will be grouped with other expandables that have the same group. */ group?: string; // If true, the expandable will not be rendered in the markdown version of the page @@ -77,6 +78,9 @@ export function Expandable({ event.stopPropagation(); // Prevent the details element from toggling event.preventDefault(); // Prevent default summary click behavior + // Expand the section so the user can see what was copied + setIsExpanded(true); + if (contentRef.current === null) { return; } @@ -88,11 +92,16 @@ export function Expandable({ let contentToCopy = ''; if (preCodeBlocks.length > 0) { - // If there are pre code blocks, concatenate their text content - preCodeBlocks.forEach(block => { - contentToCopy += (block.textContent || '') + '\n'; - }); - contentToCopy = contentToCopy.trim(); + if (typeof copy === 'string') { + // When using a custom copy label, copy only the first code block (primary install command) + contentToCopy = (preCodeBlocks[0].textContent || '').trim(); + } else { + // Default behavior: concatenate all code blocks + preCodeBlocks.forEach(block => { + contentToCopy += (block.textContent || '') + '\n'; + }); + contentToCopy = contentToCopy.trim(); + } } else { // Fallback: Look for large standalone code blocks (not inline code) const allCodeBlocks = contentRef.current.querySelectorAll('code'); @@ -131,7 +140,7 @@ export function Expandable({ setCopied(false); } }, - [emit, title] + [copy, emit, title] ); function toggleIsExpanded(event: React.MouseEvent) { @@ -175,7 +184,7 @@ export function Expandable({ onClick={copyContentOnClick} type="button" // Important for buttons in summaries > - {!copied && 'Copy Rules'} + {!copied && (typeof copy === 'string' ? copy : 'Copy Rules')} {copied && 'Copied!'} )}