Skip to content

Commit

Permalink
sentry integration
Browse files Browse the repository at this point in the history
  • Loading branch information
future-pirate-king committed Aug 30, 2022
1 parent 77398e1 commit cba39c9
Show file tree
Hide file tree
Showing 4 changed files with 7,358 additions and 5,848 deletions.
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: 1.0,
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

0 comments on commit cba39c9

Please sign in to comment.