# Ember | Sentry for Ember

Sentry's Ember addon enables automatic reporting of errors, exceptions, and transactions.

The minimum supported Ember.js version is `4.0.0`.

## [Prerequisites](https://docs.sentry.io/platforms/javascript/guides/ember.md#prerequisites)

You need:

* A Sentry [account](https://sentry.io/signup/) and [project](https://docs.sentry.io/product/projects.md)
* Your application up and running

## [Features](https://docs.sentry.io/platforms/javascript/guides/ember.md#features)

In addition to capturing errors, you can monitor interactions between multiple services or applications by [enabling tracing](https://docs.sentry.io/concepts/key-terms/tracing.md). You can also get to the root of an error or performance issue faster, by watching a video-like reproduction of a user session with [session replay](https://docs.sentry.io/product/explore/session-replay/web/getting-started.md).

Select which Sentry features you'd like to install in addition to Error Monitoring to get the corresponding installation and configuration instructions below.

## [Install](https://docs.sentry.io/platforms/javascript/guides/ember.md#install)

Error Monitoring\[ ]Tracing\[ ]Session Replay\[ ]User Feedback\[ ]Logs (Beta)

Sentry captures data by using an SDK within your application's runtime.

```bash
ember install @sentry/ember
```

## [Configure](https://docs.sentry.io/platforms/javascript/guides/ember.md#configure)

Configuration should happen as early as possible in your application's lifecycle.

This snippet includes automatic instrumentation to monitor the performance of your application, which registers and configures the Tracing integration, including custom [Ember instrumentation](https://docs.sentry.io/platforms/javascript/guides/ember/configuration/ember-options.md).

```javascript
import Application from "@ember/application";
import Resolver from "ember-resolver";
import loadInitializers from "ember-load-initializers";
import config from "./config/environment";

import * as Sentry from "@sentry/ember";

Sentry.init({
  dsn: "https://examplePublicKey@o0.ingest.sentry.io/0",

  // Adds request headers and IP for users, for more info visit:
  // https://docs.sentry.io/platforms/javascript/guides/ember/configuration/options/#sendDefaultPii
  sendDefaultPii: true,

  //  session-replay
  integrations: [
    Sentry.replayIntegration(),
    //  user-feedback
    Sentry.feedbackIntegration({
      // Additional SDK configuration goes in here, for example:
      colorScheme: "system",
    }),
    //  user-feedback
  ],
  //  session-replay
  //  logs

  // Enable logs to be sent to Sentry
  _experiments: { enableLogs: true },
  //  logs

  //  performance
  // Set tracesSampleRate to 1.0 to capture 100%
  // of transactions for tracing.
  // We recommend adjusting this value in production
  // Learn more at
  // https://docs.sentry.io/platforms/javascript/configuration/options/#traces-sample-rate
  tracesSampleRate: 1.0,
  //  performance
  //  session-replay

  // Capture Replay for 10% of all sessions,
  // plus for 100% of sessions with an error
  // Learn more at
  // https://docs.sentry.io/platforms/javascript/session-replay/configuration/#general-integration-configuration
  replaysSessionSampleRate: 0.1,
  replaysOnErrorSampleRate: 1.0,
  //  session-replay
});

export default class App extends Application {
  modulePrefix = config.modulePrefix;
  podModulePrefix = config.podModulePrefix;
  Resolver = Resolver;
}
```

This SDK uses Ember configuration conventions to manage its automatic instrumentation and other Sentry options. This additional configuration can be found under [Ember options](https://docs.sentry.io/platforms/javascript/guides/ember/configuration/ember-options.md).

## [Add Readable Stack Traces to Errors](https://docs.sentry.io/platforms/javascript/guides/ember.md#add-readable-stack-traces-to-errors)

Depending on how you've set up your project, the stack traces in your Sentry errors probably won't look like your actual code.

To fix this, upload your source maps to Sentry. The easiest way to do this is by using the Sentry Wizard:

```bash
npx @sentry/wizard@latest -i sourcemaps
```

The wizard will guide you through the following steps:

* Logging into Sentry and selecting a project
* Installing the necessary Sentry packages
* Configuring your build tool to generate and upload source maps
* Configuring your CI to upload source maps

For more information on source maps or for more options to upload them, head over to our [Source Maps](https://docs.sentry.io/platforms/javascript/guides/ember/sourcemaps.md) documentation.

## [Verify](https://docs.sentry.io/platforms/javascript/guides/ember.md#verify)

This snippet includes an intentional error, so you can test that everything is working as soon as you set it up.

```javascript
setTimeout(() => {
  throw new Error("Sentry Test Error");
});
```

Errors triggered from within Browser DevTools are sandboxed and won't trigger an error handler. Place the snippet directly in your code instead.

Learn more about manually capturing an error or message in our [Usage documentation](https://docs.sentry.io/platforms/javascript/guides/ember/usage.md).

To view and resolve the recorded error, log into [sentry.io](https://sentry.io) and select your project. Clicking on the error's title will open a page where you can see detailed information and mark it as resolved.
