mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Frontend Monitoring: Add config option to enable all default instrumentations (#94862)
* Add config options to enable all faro instrumentation * Fix ts error * Fix type in test * Add to default config files
This commit is contained in:
@@ -1126,6 +1126,9 @@ log_endpoint_requests_per_second_limit = 3
|
|||||||
# Max requests accepted per short interval of time for Grafana backend log ingestion endpoint (/log)
|
# Max requests accepted per short interval of time for Grafana backend log ingestion endpoint (/log)
|
||||||
log_endpoint_burst_limit = 15
|
log_endpoint_burst_limit = 15
|
||||||
|
|
||||||
|
# Enables all Faro default instrumentation by using `getWebInstrumentations`. Overrides other instrumentation flags.
|
||||||
|
instrumentations_all_enabled = false
|
||||||
|
|
||||||
# Should error instrumentation be enabled, only affects Grafana Javascript Agent
|
# Should error instrumentation be enabled, only affects Grafana Javascript Agent
|
||||||
instrumentations_errors_enabled = true
|
instrumentations_errors_enabled = true
|
||||||
|
|
||||||
|
|||||||
@@ -1119,6 +1119,9 @@
|
|||||||
# Max requests accepted per short interval of time for Grafana backend log ingestion endpoint (/log).
|
# Max requests accepted per short interval of time for Grafana backend log ingestion endpoint (/log).
|
||||||
;log_endpoint_burst_limit = 15
|
;log_endpoint_burst_limit = 15
|
||||||
|
|
||||||
|
# Enables all Faro default instrumentation by using `getWebInstrumentations`. Overrides other instrumentation flags.
|
||||||
|
;instrumentations_all_enabled = false
|
||||||
|
|
||||||
# Should error instrumentation be enabled, only affects Grafana Javascript Agent
|
# Should error instrumentation be enabled, only affects Grafana Javascript Agent
|
||||||
;instrumentations_errors_enabled = true
|
;instrumentations_errors_enabled = true
|
||||||
|
|
||||||
|
|||||||
@@ -1499,6 +1499,10 @@ Requests per second limit enforced per an extended period, for Grafana backend l
|
|||||||
|
|
||||||
Maximum requests accepted per short interval of time for Grafana backend log ingestion endpoint, `/log-grafana-javascript-agent`. Default is `15`.
|
Maximum requests accepted per short interval of time for Grafana backend log ingestion endpoint, `/log-grafana-javascript-agent`. Default is `15`.
|
||||||
|
|
||||||
|
### instrumentations_all_enabled
|
||||||
|
|
||||||
|
Enables all Faro default instrumentation by using `getWebInstrumentations`. Overrides other instrumentation flags.
|
||||||
|
|
||||||
### instrumentations_errors_enabled
|
### instrumentations_errors_enabled
|
||||||
|
|
||||||
Turn on error instrumentation. Only affects Grafana Javascript Agent.
|
Turn on error instrumentation. Only affects Grafana Javascript Agent.
|
||||||
|
|||||||
@@ -126,6 +126,7 @@ export class GrafanaBootConfig implements GrafanaConfig {
|
|||||||
enabled: false,
|
enabled: false,
|
||||||
customEndpoint: '',
|
customEndpoint: '',
|
||||||
apiKey: '',
|
apiKey: '',
|
||||||
|
allInstrumentationsEnabled: false,
|
||||||
errorInstrumentalizationEnabled: true,
|
errorInstrumentalizationEnabled: true,
|
||||||
consoleInstrumentalizationEnabled: false,
|
consoleInstrumentalizationEnabled: false,
|
||||||
webVitalsInstrumentalizationEnabled: false,
|
webVitalsInstrumentalizationEnabled: false,
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ type GrafanaJavascriptAgent struct {
|
|||||||
CustomEndpoint string `json:"customEndpoint"`
|
CustomEndpoint string `json:"customEndpoint"`
|
||||||
EndpointRPS int `json:"-"`
|
EndpointRPS int `json:"-"`
|
||||||
EndpointBurst int `json:"-"`
|
EndpointBurst int `json:"-"`
|
||||||
|
AllInstrumentationsEnabeld bool `json:"allInstrumentationEnabeld"`
|
||||||
ErrorInstrumentalizationEnabled bool `json:"errorInstrumentalizationEnabled"`
|
ErrorInstrumentalizationEnabled bool `json:"errorInstrumentalizationEnabled"`
|
||||||
ConsoleInstrumentalizationEnabled bool `json:"consoleInstrumentalizationEnabled"`
|
ConsoleInstrumentalizationEnabled bool `json:"consoleInstrumentalizationEnabled"`
|
||||||
WebVitalsInstrumentalizationEnabled bool `json:"webVitalsInstrumentalizationEnabled"`
|
WebVitalsInstrumentalizationEnabled bool `json:"webVitalsInstrumentalizationEnabled"`
|
||||||
@@ -20,6 +21,7 @@ func (cfg *Cfg) readGrafanaJavascriptAgentConfig() {
|
|||||||
CustomEndpoint: raw.Key("custom_endpoint").MustString("/log-grafana-javascript-agent"),
|
CustomEndpoint: raw.Key("custom_endpoint").MustString("/log-grafana-javascript-agent"),
|
||||||
EndpointRPS: raw.Key("log_endpoint_requests_per_second_limit").MustInt(3),
|
EndpointRPS: raw.Key("log_endpoint_requests_per_second_limit").MustInt(3),
|
||||||
EndpointBurst: raw.Key("log_endpoint_burst_limit").MustInt(15),
|
EndpointBurst: raw.Key("log_endpoint_burst_limit").MustInt(15),
|
||||||
|
AllInstrumentationsEnabeld: raw.Key("instrumentations_all_enabled").MustBool(true),
|
||||||
ErrorInstrumentalizationEnabled: raw.Key("instrumentations_errors_enabled").MustBool(true),
|
ErrorInstrumentalizationEnabled: raw.Key("instrumentations_errors_enabled").MustBool(true),
|
||||||
ConsoleInstrumentalizationEnabled: raw.Key("instrumentations_console_enabled").MustBool(true),
|
ConsoleInstrumentalizationEnabled: raw.Key("instrumentations_console_enabled").MustBool(true),
|
||||||
WebVitalsInstrumentalizationEnabled: raw.Key("instrumentations_webvitals_enabled").MustBool(true),
|
WebVitalsInstrumentalizationEnabled: raw.Key("instrumentations_webvitals_enabled").MustBool(true),
|
||||||
|
|||||||
@@ -65,6 +65,7 @@ describe('GrafanaJavascriptAgentEchoBackend', () => {
|
|||||||
app: {
|
app: {
|
||||||
version: '1.0',
|
version: '1.0',
|
||||||
},
|
},
|
||||||
|
allInstrumentationsEnabled: true,
|
||||||
errorInstrumentalizationEnabled: true,
|
errorInstrumentalizationEnabled: true,
|
||||||
consoleInstrumentalizationEnabled: true,
|
consoleInstrumentalizationEnabled: true,
|
||||||
webVitalsInstrumentalizationEnabled: true,
|
webVitalsInstrumentalizationEnabled: true,
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import {
|
|||||||
SessionInstrumentation,
|
SessionInstrumentation,
|
||||||
FetchTransport,
|
FetchTransport,
|
||||||
type Instrumentation,
|
type Instrumentation,
|
||||||
|
getWebInstrumentations,
|
||||||
} from '@grafana/faro-web-sdk';
|
} from '@grafana/faro-web-sdk';
|
||||||
import { TracingInstrumentation } from '@grafana/faro-web-tracing';
|
import { TracingInstrumentation } from '@grafana/faro-web-tracing';
|
||||||
import { EchoBackend, EchoEvent, EchoEventType } from '@grafana/runtime';
|
import { EchoBackend, EchoEvent, EchoEventType } from '@grafana/runtime';
|
||||||
@@ -20,6 +21,7 @@ export interface GrafanaJavascriptAgentBackendOptions extends BrowserConfig {
|
|||||||
buildInfo: BuildInfo;
|
buildInfo: BuildInfo;
|
||||||
customEndpoint: string;
|
customEndpoint: string;
|
||||||
user: User;
|
user: User;
|
||||||
|
allInstrumentationsEnabled: boolean;
|
||||||
errorInstrumentalizationEnabled: boolean;
|
errorInstrumentalizationEnabled: boolean;
|
||||||
consoleInstrumentalizationEnabled: boolean;
|
consoleInstrumentalizationEnabled: boolean;
|
||||||
webVitalsInstrumentalizationEnabled: boolean;
|
webVitalsInstrumentalizationEnabled: boolean;
|
||||||
@@ -67,7 +69,9 @@ export class GrafanaJavascriptAgentBackend
|
|||||||
version: options.buildInfo.version,
|
version: options.buildInfo.version,
|
||||||
environment: options.buildInfo.env,
|
environment: options.buildInfo.env,
|
||||||
},
|
},
|
||||||
instrumentations,
|
instrumentations: options.allInstrumentationsEnabled
|
||||||
|
? instrumentations
|
||||||
|
: [...getWebInstrumentations(), new TracingInstrumentation()],
|
||||||
transports,
|
transports,
|
||||||
ignoreErrors: [
|
ignoreErrors: [
|
||||||
'ResizeObserver loop limit exceeded',
|
'ResizeObserver loop limit exceeded',
|
||||||
|
|||||||
Reference in New Issue
Block a user