Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sentry integration #1047

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions app/services/configuration.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ export default class ConfigurationService extends Service {
pendo_key: '',
rollbar_key: '',
document360_key: '',
sentry_dsn: '',
environment: '',
};

serverData = {
Expand Down Expand Up @@ -74,6 +76,8 @@ export default class ConfigurationService extends Service {
this.integrationData.rollbar_key ||= data.integrations.rollbar_key;
this.integrationData.document360_key ||=
data.integrations.document360_key;
this.integrationData.sentry_dsn ||= data.integrations.sentry_dsn;
this.integrationData.environment ||= data.integrations.environment;

this.themeData.scheme ||= data.theme.scheme;
this.themeData.primary_color ||= data.theme.primary_color;
Expand Down
30 changes: 30 additions & 0 deletions app/services/integration.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { inject as service } from '@ember/service';
import Service from '@ember/service';
import ENV from 'irene/config/environment';
import { injectDocument360 } from 'irene/utils/knowledge-base';
import Sentry from '@sentry/ember';

export default class IntegrationService extends Service {
@service configuration;
Expand All @@ -22,8 +23,11 @@ export default class IntegrationService extends Service {
async configure(user) {
await this.configuration.getIntegrationConfig();
this.currentUser = user;

await this.configureCrisp();
await this.configureDocument360();

this.configureSentry();
}

// Crisp
Expand Down Expand Up @@ -60,6 +64,32 @@ export default class IntegrationService extends Service {
return this.configuration.integrationData.document360_key;
}

get sentryDsn() {
return this.configuration.integrationData.sentry_dsn;
}

get deployedEnvironment() {
return this.configuration.integrationData.environment;
}

isSentryEnabled() {
return !!this.sentryDsn;
}

configureSentry() {
if (!this.isSentryEnabled()) {
this.logger.debug('Sentry Disabled');
return;
}

Sentry.init({
dsn: this.sentryDsn,
tracesSampleRate: this.deployedEnvironment === 'production' ? 1.0 : 0.7,
environment: this.deployedEnvironment,
release: ENV.APP.version,
});
}

// get the snippet code from https://app.crisp.chat/settings/website/
// the window object is retrieved from this.window;
// the document object is retrieved from this.document; this is done for fastboot
Expand Down
Loading