Logging: Log frontend errors (#28073)

* basic frontend  Sentry integration

* backend endpoint to capture sentry events

* WIP!

* log user email for frontend logs

* remove debug logging

* lint fixes

* Fix type exports & property names

Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com>

* additional struct naming fix

* rename log endpoint, config section & interface

* add sentry sample rate to config

* refac to use EchoSrv

* log user id

* backend tests

* tests for SentryEchoBackend

* sentry echo backend tests

* CustomEndpointTransport tests

* Update pkg/api/frontend_logging_test.go

Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com>

* Update conf/defaults.ini

Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com>

* Update pkg/api/frontend_logging_test.go

Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com>

* don't export unnecesasrily

* update go.sum

* get rid of Convey in tests, use stdlib

* add sentry config to sample.ini

* cleanup to set orig logging handler in test

* Apply suggestions from code review

Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com>

* PR feedback changes

* lock sentry version

Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com>
This commit is contained in:
Domas
2020-11-12 13:29:43 +02:00
committed by GitHub
parent 0c054d1a9f
commit 76df096791
25 changed files with 880 additions and 3 deletions

View File

@@ -59,6 +59,18 @@ export interface LicenseInfo {
edition: string;
}
/**
* Describes Sentry integration config
*
* @public
*/
export interface SentryConfig {
enabled: boolean;
dsn: string;
customEndpoint: string;
sampleRate: number;
}
/**
* Describes all the different Grafana configuration values available for an instance.
*
@@ -105,4 +117,5 @@ export interface GrafanaConfig {
licenseInfo: LicenseInfo;
http2Enabled: boolean;
dateFormats?: SystemDateFormatSettings;
sentry: SentryConfig;
}

View File

@@ -62,6 +62,12 @@ export class GrafanaBootConfig implements GrafanaConfig {
rendererAvailable = false;
http2Enabled = false;
dateFormats?: SystemDateFormatSettings;
sentry = {
enabled: false,
dsn: '',
customEndpoint: '',
sampleRate: 1,
};
marketplaceUrl?: string;
constructor(options: GrafanaBootConfig) {

View File

@@ -78,6 +78,7 @@ export interface EchoEvent<T extends EchoEventType = any, P = any> {
export enum EchoEventType {
Performance = 'performance',
MetaAnalytics = 'meta-analytics',
Sentry = 'sentry',
}
/**