Frontend logging: Remove Sentry javascript agent support (#67493)

* remove Sentry

* fix sourcemap resolve
This commit is contained in:
Domas
2023-05-02 12:10:56 +03:00
committed by GitHub
parent 9614dc2446
commit 15d4169813
38 changed files with 47 additions and 1288 deletions
-4
View File
@@ -363,9 +363,6 @@ type Cfg struct {
DashboardAnnotationCleanupSettings AnnotationCleanupSettings
APIAnnotationCleanupSettings AnnotationCleanupSettings
// Sentry config
Sentry Sentry
// GrafanaJavascriptAgent config
GrafanaJavascriptAgent GrafanaJavascriptAgent
@@ -1187,7 +1184,6 @@ func (cfg *Cfg) Load(args CommandLineArgs) error {
cfg.GeomapEnableCustomBaseLayers = geomapSection.Key("enable_custom_baselayers").MustBool(true)
cfg.readDateFormats()
cfg.readSentryConfig()
cfg.readGrafanaJavascriptAgentConfig()
if err := cfg.readLiveSettings(iniFile); err != nil {
@@ -13,17 +13,14 @@ type GrafanaJavascriptAgent struct {
func (cfg *Cfg) readGrafanaJavascriptAgentConfig() {
raw := cfg.Raw.Section("log.frontend")
provider := raw.Key("provider").MustString("sentry")
if provider == "grafana" {
cfg.GrafanaJavascriptAgent = GrafanaJavascriptAgent{
Enabled: raw.Key("enabled").MustBool(true),
CustomEndpoint: raw.Key("custom_endpoint").MustString("/log-grafana-javascript-agent"),
EndpointRPS: raw.Key("log_endpoint_requests_per_second_limit").MustInt(3),
EndpointBurst: raw.Key("log_endpoint_burst_limit").MustInt(15),
ErrorInstrumentalizationEnabled: raw.Key("instrumentations_errors_enabled").MustBool(true),
ConsoleInstrumentalizationEnabled: raw.Key("instrumentations_console_enabled").MustBool(true),
WebVitalsInstrumentalizationEnabled: raw.Key("instrumentations_webvitals_enabled").MustBool(true),
ApiKey: raw.Key("api_key").String(),
}
cfg.GrafanaJavascriptAgent = GrafanaJavascriptAgent{
Enabled: raw.Key("enabled").MustBool(true),
CustomEndpoint: raw.Key("custom_endpoint").MustString("/log-grafana-javascript-agent"),
EndpointRPS: raw.Key("log_endpoint_requests_per_second_limit").MustInt(3),
EndpointBurst: raw.Key("log_endpoint_burst_limit").MustInt(15),
ErrorInstrumentalizationEnabled: raw.Key("instrumentations_errors_enabled").MustBool(true),
ConsoleInstrumentalizationEnabled: raw.Key("instrumentations_console_enabled").MustBool(true),
WebVitalsInstrumentalizationEnabled: raw.Key("instrumentations_webvitals_enabled").MustBool(true),
ApiKey: raw.Key("api_key").String(),
}
}
-28
View File
@@ -1,28 +0,0 @@
package setting
import "github.com/go-kit/log/level"
type Sentry struct {
Enabled bool `json:"enabled"`
DSN string `json:"dsn"`
CustomEndpoint string `json:"customEndpoint"`
SampleRate float64 `json:"sampleRate"`
EndpointRPS int `json:"-"`
EndpointBurst int `json:"-"`
}
func (cfg *Cfg) readSentryConfig() {
raw := cfg.Raw.Section("log.frontend")
provider := raw.Key("provider").MustString("sentry")
if provider == "sentry" || provider != "grafana" {
_ = level.Warn(cfg.Logger).Log("msg", "\"sentry\" frontend logging provider is deprecated and will be removed in the next major version. Use \"grafana\" provider instead.")
cfg.Sentry = Sentry{
Enabled: raw.Key("enabled").MustBool(true),
DSN: raw.Key("sentry_dsn").String(),
CustomEndpoint: raw.Key("custom_endpoint").MustString("/log"),
SampleRate: raw.Key("sample_rate").MustFloat64(),
EndpointRPS: raw.Key("log_endpoint_requests_per_second_limit").MustInt(3),
EndpointBurst: raw.Key("log_endpoint_burst_limit").MustInt(15),
}
}
}