Files
tom goriunovandGitHub 5ba45dbb98 Migrate from Sentry.io to Rollbar monitoring solution (#2403)
* basic Rollbar setup

* remove sentry code

* add rollback env to values for demo

* [skip ci] adjust instance name

* fix validator

* don't log errors from API by default and change error levels

* [skip ci] change default value for environment property

* [skip ci] do not log api errors of address endpoint
2024-11-29 15:25:59 +01:00

44 lines
1.0 KiB
TypeScript

import type { Feature } from './types';
import app from '../app';
import { getEnvValue } from '../utils';
const clientToken = getEnvValue('NEXT_PUBLIC_ROLLBAR_CLIENT_TOKEN');
const instance = (() => {
const envValue = getEnvValue('NEXT_PUBLIC_APP_INSTANCE');
if (envValue) {
return envValue;
}
return app.host?.replace('.blockscout.com', '').replace('.k8s-dev', '').replaceAll('-', '_');
})();
const environment = getEnvValue('NEXT_PUBLIC_APP_ENV') || 'production';
const codeVersion = getEnvValue('NEXT_PUBLIC_GIT_TAG') || getEnvValue('NEXT_PUBLIC_GIT_COMMIT_SHA');
const title = 'Rollbar error monitoring';
const config: Feature<{
clientToken: string;
environment: string;
instance: string | undefined;
codeVersion: string | undefined;
}> = (() => {
if (clientToken) {
return Object.freeze({
title,
isEnabled: true,
clientToken,
environment,
instance,
codeVersion,
});
}
return Object.freeze({
title,
isEnabled: false,
});
})();
export default config;