diff --git a/packages/bun/README.md b/packages/bun/README.md index 1867f5a0fef9..5e9c8df00672 100644 --- a/packages/bun/README.md +++ b/packages/bun/README.md @@ -10,52 +10,17 @@ [![npm dm](https://img.shields.io/npm/dm/@sentry/bun.svg)](https://www.npmjs.com/package/@sentry/bun) [![npm dt](https://img.shields.io/npm/dt/@sentry/bun.svg)](https://www.npmjs.com/package/@sentry/bun) -## Links - -- [Official SDK Docs](https://docs.sentry.io/quickstart/) +The official Sentry SDK for monitoring Bun applications. The Sentry Bun SDK is in beta. Please help us improve the SDK by [reporting any issues or giving us feedback](https://github.com/getsentry/sentry-javascript/issues). -## Usage - -To use this SDK, call `init(options)` as early as possible in the main entry module. This will initialize the SDK and -hook into the environment. Note that you can turn off almost all side effects using the respective options. - -```javascript -// CJS Syntax -const Sentry = require('@sentry/bun'); -// ESM Syntax -import * as Sentry from '@sentry/bun'; - -Sentry.init({ - dsn: '__DSN__', - // ... -}); -``` - -To set context information or send manual events, use the exported functions of `@sentry/bun`. Note that these functions -will not perform any action before you have called `init()`: - -```javascript -// Set user information, as well as tags and further extras -Sentry.setExtra('battery', 0.7); -Sentry.setTag('user_mode', 'admin'); -Sentry.setUser({ id: '4711' }); - -// Add a breadcrumb for future events -Sentry.addBreadcrumb({ - message: 'My Breadcrumb', - // ... -}); - -// Capture exceptions, messages or manual events -Sentry.captureMessage('Hello, world!'); -Sentry.captureException(new Error('Good bye')); -Sentry.captureEvent({ - message: 'Manual', - stacktrace: [ - // ... - ], -}); -``` +## Documentation + +- [Getting started](https://docs.sentry.io/platforms/javascript/guides/bun/) +- [Configuration](https://docs.sentry.io/platforms/javascript/guides/bun/configuration/) + +## Support + +- [Report a bug](https://github.com/getsentry/sentry-javascript/issues/new/choose) +- [Contributing](https://github.com/getsentry/sentry-javascript/blob/develop/CONTRIBUTING.md) diff --git a/packages/deno/README.md b/packages/deno/README.md index 2763652bed17..5a523dc6a94f 100644 --- a/packages/deno/README.md +++ b/packages/deno/README.md @@ -10,77 +10,17 @@ [![npm dm](https://img.shields.io/npm/dm/@sentry/deno.svg)](https://www.npmjs.com/package/@sentry/deno) [![npm dt](https://img.shields.io/npm/dt/@sentry/deno.svg)](https://www.npmjs.com/package/@sentry/deno) -## Links - -- [Official SDK Docs](https://docs.sentry.io/quickstart/) +The official Sentry SDK for monitoring Deno applications. The Sentry Deno SDK is in beta. Please help us improve the SDK by [reporting any issues or giving us feedback](https://github.com/getsentry/sentry-javascript/issues). -## Usage - -To use this SDK, call `Sentry.init(options)` as early as possible in the main entry module. This will initialize the SDK -and hook into the environment. Note that you can turn off almost all side effects using the respective options. - -```javascript -import * as Sentry from 'npm:@sentry/deno'; - -Sentry.init({ - dsn: '__DSN__', - // ... -}); -``` - -To set context information or send manual events, use the exported functions of the Deno SDK. Note that these functions -will not perform any action before you have called `init()`: - -```javascript -// Set user information, as well as tags and further extras -Sentry.setExtra('battery', 0.7); -Sentry.setTag('user_mode', 'admin'); -Sentry.setUser({ id: '4711' }); - -// Add a breadcrumb for future events -Sentry.addBreadcrumb({ - message: 'My Breadcrumb', - // ... -}); - -// Capture exceptions, messages or manual events -Sentry.captureMessage('Hello, world!'); -Sentry.captureException(new Error('Good bye')); -Sentry.captureEvent({ - message: 'Manual', - stacktrace: [ - // ... - ], -}); -``` - -## Auto-instrumentation - -Some libraries (e.g. `mysql`) don't emit tracing signals on their -own. To instrument them, Sentry transforms them at load time so they -publish to `node:diagnostics_channel`. - -Use the `--preload` argument to `deno run` to enable -these instrumentations. - -```bash -$ deno run --preload=npm:@sentry/deno/import app.ts -``` - -If your `deno.json` maps `@sentry/deno` to the npm package, the bare -`--preload=@sentry/deno/import` form works as well. - -Your `app.ts` should simply load Sentry as usual: +## Documentation -```ts -// app.ts +- [Getting started](https://docs.sentry.io/platforms/javascript/guides/deno/) +- [Configuration](https://docs.sentry.io/platforms/javascript/guides/deno/configuration/) -// initialize Sentry as early as possible -import * as Sentry from 'npm:@sentry/deno'; -Sentry.init({ dsn: '__DSN__' }); +## Support -// ... the rest of the app... -``` +- [Report a bug](https://github.com/getsentry/sentry-javascript/issues/new/choose) +- [Contributing](https://github.com/getsentry/sentry-javascript/blob/develop/CONTRIBUTING.md) diff --git a/packages/google-cloud-serverless/README.md b/packages/google-cloud-serverless/README.md index 833d47a95f56..e363a91a4345 100644 --- a/packages/google-cloud-serverless/README.md +++ b/packages/google-cloud-serverless/README.md @@ -6,41 +6,14 @@ # Official Sentry SDK for Google Cloud Functions -## Links +The official Sentry SDK for monitoring Google Cloud Functions. -- [Official SDK Docs](https://docs.sentry.io/) +## Documentation -## General +- [Getting started](https://docs.sentry.io/platforms/javascript/guides/gcp-functions/) +- [Configuration](https://docs.sentry.io/platforms/javascript/guides/gcp-functions/configuration/) -This package is a wrapper around `@sentry/node`, with added functionality related to various Serverless solutions. All -methods available in `@sentry/node` can be imported from `@sentry/google-cloud-serverless`. +## Support -To use this SDK, call `Sentry.init(options)` at the very beginning of your JavaScript file. - -```javascript -const Sentry = require('@sentry/google-cloud-serverless'); - -Sentry.init({ - dsn: '__DSN__', - tracesSampleRate: 1.0, - // ... -}); - -// For HTTP Functions: - -exports.helloHttp = Sentry.wrapHttpFunction((req, res) => { - throw new Error('oh, hello there!'); -}); - -// For Background Functions: - -exports.helloEvents = Sentry.wrapEventFunction((data, context, callback) => { - throw new Error('oh, hello there!'); -}); - -// For CloudEvents: - -exports.helloEvents = Sentry.wrapCloudEventFunction((context, callback) => { - throw new Error('oh, hello there!'); -}); -``` +- [Report a bug](https://github.com/getsentry/sentry-javascript/issues/new/choose) +- [Contributing](https://github.com/getsentry/sentry-javascript/blob/develop/CONTRIBUTING.md) diff --git a/packages/node/README.md b/packages/node/README.md index a71d049b777f..90f6a15f9b1e 100644 --- a/packages/node/README.md +++ b/packages/node/README.md @@ -10,87 +10,14 @@ [![npm dm](https://img.shields.io/npm/dm/@sentry/node.svg)](https://www.npmjs.com/package/@sentry/node) [![npm dt](https://img.shields.io/npm/dt/@sentry/node.svg)](https://www.npmjs.com/package/@sentry/node) -## Installation +The official Sentry SDK for monitoring Node.js applications. -```bash -npm install @sentry/node +## Documentation -# Or yarn -yarn add @sentry/node -``` +- [Getting started](https://docs.sentry.io/platforms/javascript/guides/node/) +- [Configuration](https://docs.sentry.io/platforms/javascript/guides/node/configuration/) -## Usage +## Support -Sentry should be initialized as early in your app as possible. It is essential that you call `Sentry.init` before you -require any other modules in your application, otherwise auto-instrumentation of these modules will **not** work. - -You need to create a file named `instrument.js` that imports and initializes Sentry: - -```js -// CJS Syntax -const Sentry = require('@sentry/node'); -// ESM Syntax -import * as Sentry from '@sentry/node'; - -Sentry.init({ - dsn: '__DSN__', - // ... -}); -``` - -You need to require or import the `instrument.js` file before importing any other modules in your application. This is -necessary to ensure that Sentry can automatically instrument all modules in your application: - -```js -// Import this first! -import './instrument'; - -// Now import other modules -import http from 'http'; - -// Your application code goes here -``` - -### ESM Support - -When running your application in ESM mode, you should use the Node.js -[`--import`](https://nodejs.org/api/cli.html#--importmodule) command line option to ensure that Sentry is loaded before -the application code is evaluated. - -Adjust the Node.js call for your application to use the `--import` parameter and point it at `instrument.js`, which -contains your `Sentry.init`() code: - -```bash -# Note: This is only available for Node v18.19.0 onwards. -node --import ./instrument.mjs app.mjs -``` - -If it is not possible for you to pass the `--import` flag to the Node.js binary, you can alternatively use the -`NODE_OPTIONS` environment variable as follows: - -```bash -NODE_OPTIONS="--import ./instrument.mjs" npm run start -``` - -### Bundling your server - -`@sentry/node` installs its automatic (diagnostics-channel) instrumentation through a runtime module -hook that ships in `@sentry/server-runtime-injection` and is designed to run from `node_modules`. There are two -supported ways to keep auto-instrumentation working when you bundle your server: - -1. **Keep `@sentry/server-runtime-injection` external** (do not inline it into the bundle) so the runtime hook - loads from `node_modules`. Most bundlers externalize `node_modules` for a Node target by default; - if yours inlines everything, mark `@sentry/server-runtime-injection` as external explicitly. -2. **Instrument at build time** with the Sentry bundler plugins (`@sentry/node/esbuild`, - `@sentry/node/webpack`, `@sentry/node/vite`, `@sentry/node/rollup`), which inject the - instrumentation into your bundled dependencies during the build. In this mode the runtime hook is - not needed. - -If you bundle `@sentry/server-runtime-injection` **and** don't use the build-time plugin, its internal code -transformer is stripped and runtime auto-instrumentation is disabled. `@sentry/node` warns the -first time an instrumented dependency loads uninstrumented, so a build-time-instrumented app never -sees the warning. - -## Links - -- [Official SDK Docs](https://docs.sentry.io/quickstart/) +- [Report a bug](https://github.com/getsentry/sentry-javascript/issues/new/choose) +- [Contributing](https://github.com/getsentry/sentry-javascript/blob/develop/CONTRIBUTING.md)