Frontend logging: Remove Sentry javascript agent support (#67493)
* remove Sentry * fix sourcemap resolve
This commit is contained in:
@@ -41,7 +41,6 @@
|
||||
"@grafana/e2e-selectors": "10.1.0-pre",
|
||||
"@grafana/faro-web-sdk": "1.0.2",
|
||||
"@grafana/ui": "10.1.0-pre",
|
||||
"@sentry/browser": "6.19.7",
|
||||
"history": "4.10.1",
|
||||
"lodash": "4.17.21",
|
||||
"rxjs": "7.8.0",
|
||||
|
||||
@@ -103,12 +103,6 @@ export class GrafanaBootConfig implements GrafanaConfig {
|
||||
supportBundlesEnabled = false;
|
||||
http2Enabled = false;
|
||||
dateFormats?: SystemDateFormatSettings;
|
||||
sentry = {
|
||||
enabled: false,
|
||||
dsn: '',
|
||||
customEndpoint: '',
|
||||
sampleRate: 1,
|
||||
};
|
||||
grafanaJavascriptAgent = {
|
||||
enabled: false,
|
||||
customEndpoint: '',
|
||||
|
||||
@@ -78,7 +78,6 @@ export interface EchoEvent<T extends EchoEventType = any, P = any> {
|
||||
export enum EchoEventType {
|
||||
Performance = 'performance',
|
||||
MetaAnalytics = 'meta-analytics',
|
||||
Sentry = 'sentry',
|
||||
Pageview = 'pageview',
|
||||
Interaction = 'interaction',
|
||||
ExperimentView = 'experimentview',
|
||||
|
||||
@@ -1,76 +1,54 @@
|
||||
import { captureMessage, captureException, Severity as LogLevel } from '@sentry/browser';
|
||||
|
||||
import { faro, LogLevel as GrafanaLogLevel } from '@grafana/faro-web-sdk';
|
||||
import { faro, LogLevel } from '@grafana/faro-web-sdk';
|
||||
|
||||
import { config } from '../config';
|
||||
|
||||
export { LogLevel };
|
||||
|
||||
// a bit stricter than what Sentry allows
|
||||
type Contexts = Record<string, Record<string, number | string | Record<string, string | number>>>;
|
||||
|
||||
/**
|
||||
* Log a message at INFO level. Depending on configuration might be forwarded to backend and logged to stdout or sent to Sentry
|
||||
*
|
||||
* Log a message at INFO level
|
||||
* @public
|
||||
*/
|
||||
export function logInfo(message: string, contexts?: Contexts) {
|
||||
if (config.grafanaJavascriptAgent.enabled) {
|
||||
faro.api.pushLog([message], {
|
||||
level: GrafanaLogLevel.INFO,
|
||||
level: LogLevel.INFO,
|
||||
context: contexts,
|
||||
});
|
||||
}
|
||||
if (config.sentry.enabled) {
|
||||
captureMessage(message, {
|
||||
level: LogLevel.Info,
|
||||
contexts,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Log a message at WARNING level. Depending on configuration might be forwarded to backend and logged to stdout or sent to Sentry
|
||||
* Log a message at WARNING level
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export function logWarning(message: string, contexts?: Contexts) {
|
||||
if (config.grafanaJavascriptAgent.enabled) {
|
||||
faro.api.pushLog([message], {
|
||||
level: GrafanaLogLevel.WARN,
|
||||
level: LogLevel.WARN,
|
||||
context: contexts,
|
||||
});
|
||||
}
|
||||
if (config.sentry.enabled) {
|
||||
captureMessage(message, {
|
||||
level: LogLevel.Warning,
|
||||
contexts,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Log a message at DEBUG level. Depending on configuration might be forwarded to backend and logged to stdout or sent to Sentry
|
||||
* Log a message at DEBUG level
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export function logDebug(message: string, contexts?: Contexts) {
|
||||
if (config.grafanaJavascriptAgent.enabled) {
|
||||
faro.api.pushLog([message], {
|
||||
level: GrafanaLogLevel.DEBUG,
|
||||
level: LogLevel.DEBUG,
|
||||
context: contexts,
|
||||
});
|
||||
}
|
||||
if (config.sentry.enabled) {
|
||||
captureMessage(message, {
|
||||
level: LogLevel.Debug,
|
||||
contexts,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Log an error. Depending on configuration might be forwarded to backend and logged to stdout or sent to Sentry
|
||||
* Log an error
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
@@ -78,7 +56,4 @@ export function logError(err: Error, contexts?: Contexts) {
|
||||
if (config.grafanaJavascriptAgent.enabled) {
|
||||
faro.api.pushError(err);
|
||||
}
|
||||
if (config.sentry.enabled) {
|
||||
captureException(err, { contexts });
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user