Use this file to discover all available pages before exploring further.
The Sentry Ember SDK is an Ember addon that wraps @sentry/browser with Ember-specific functionality including automatic error capture and performance instrumentation.
Initialize Sentry in your app.js before the application initializes:
// app/app.jsimport 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: 'YOUR_DSN_HERE', // Performance Monitoring tracesSampleRate: 1.0, // Set tracesSampleRate to 1.0 to capture 100% // of transactions for performance monitoring. // We recommend adjusting this value in production});export default class App extends Application { modulePrefix = config.modulePrefix; podModulePrefix = config.podModulePrefix; Resolver = Resolver;}loadInitializers(App, config.modulePrefix);
// app/routes/dashboard.jsimport Route from '@ember/routing/route';import { instrumentRoutePerformance } from '@sentry/ember';class DashboardRoute extends Route { async beforeModel(transition) { // This will be tracked await this.checkPermissions(); } async model(params) { // This will be tracked return await this.store.query('dashboard', params); } async afterModel(model, transition) { // This will be tracked await this.loadRelatedData(model); } setupController(controller, model) { // This will be tracked super.setupController(controller, model); controller.set('extraData', this.computeExtraData(model)); }}// Wrap the route to enable instrumentationexport default instrumentRoutePerformance(DashboardRoute);
// app/routes/posts.jsimport Route from '@ember/routing/route';export default class PostsRoute extends Route { model() { // This error will be automatically captured throw new Error('Failed to load posts'); }}
// app/services/session.jsimport Service from '@ember/service';import * as Sentry from '@sentry/ember';export default class SessionService extends Service { async login(credentials) { const user = await this.authenticate(credentials); // Set user context Sentry.setUser({ id: user.id, email: user.email, username: user.username, }); return user; } logout() { Sentry.setUser(null); }}
// config/environment.jsENV['@sentry/ember'] = { // Only track runloop queues longer than 10ms minimumRunloopQueueDuration: 10, // Only track components that take longer than 5ms to render minimumComponentRenderDuration: 5,};
// config/environment.jsENV['@sentry/ember'] = { // Track all runloop queues minimumRunloopQueueDuration: 0, // Track all component renders minimumComponentRenderDuration: 0, // Show component definitions enableComponentDefinition: true,};