mirror of
https://github.com/grafana/grafana.git
synced 2024-11-22 00:47:38 -06:00
Frontend Traces: Ignore Faro tracking of Google Analytics and Rudderstack (#95322)
* Ignore Faro tracking of Google Analytics and Rudderstack * Fix test * Fancy it up Tom style
This commit is contained in:
parent
5a0ef46280
commit
c9984cbb7a
@ -317,6 +317,15 @@ function initEchoSrv() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (config.grafanaJavascriptAgent.enabled) {
|
if (config.grafanaJavascriptAgent.enabled) {
|
||||||
|
// Ignore Rudderstack URLs
|
||||||
|
const rudderstackUrls = [
|
||||||
|
config.rudderstackConfigUrl,
|
||||||
|
config.rudderstackDataPlaneUrl,
|
||||||
|
config.rudderstackIntegrationsUrl,
|
||||||
|
]
|
||||||
|
.filter(Boolean)
|
||||||
|
.map((url) => new RegExp(`${url}.*.`));
|
||||||
|
|
||||||
registerEchoBackend(
|
registerEchoBackend(
|
||||||
new GrafanaJavascriptAgentBackend({
|
new GrafanaJavascriptAgentBackend({
|
||||||
...config.grafanaJavascriptAgent,
|
...config.grafanaJavascriptAgent,
|
||||||
@ -329,6 +338,7 @@ function initEchoSrv() {
|
|||||||
id: String(config.bootData.user?.id),
|
id: String(config.bootData.user?.id),
|
||||||
email: config.bootData.user?.email,
|
email: config.bootData.user?.email,
|
||||||
},
|
},
|
||||||
|
ignoreUrls: rudderstackUrls,
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -76,6 +76,7 @@ describe('GrafanaJavascriptAgentEchoBackend', () => {
|
|||||||
id: '504',
|
id: '504',
|
||||||
orgId: 1,
|
orgId: 1,
|
||||||
},
|
},
|
||||||
|
ignoreUrls: [],
|
||||||
};
|
};
|
||||||
|
|
||||||
it('will set up FetchTransport if customEndpoint is provided', () => {
|
it('will set up FetchTransport if customEndpoint is provided', () => {
|
||||||
|
@ -34,8 +34,11 @@ export interface GrafanaJavascriptAgentBackendOptions extends BrowserConfig {
|
|||||||
consoleInstrumentalizationEnabled: boolean;
|
consoleInstrumentalizationEnabled: boolean;
|
||||||
webVitalsInstrumentalizationEnabled: boolean;
|
webVitalsInstrumentalizationEnabled: boolean;
|
||||||
tracingInstrumentalizationEnabled: boolean;
|
tracingInstrumentalizationEnabled: boolean;
|
||||||
|
ignoreUrls: RegExp[];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const TRACKING_URLS = [/.*.google-analytics.com*.*/, /.*.googletagmanager.com*.*/, /frontend-metrics/];
|
||||||
|
|
||||||
export class GrafanaJavascriptAgentBackend
|
export class GrafanaJavascriptAgentBackend
|
||||||
implements EchoBackend<GrafanaJavascriptAgentEchoEvent, GrafanaJavascriptAgentBackendOptions>
|
implements EchoBackend<GrafanaJavascriptAgentEchoEvent, GrafanaJavascriptAgentBackendOptions>
|
||||||
{
|
{
|
||||||
@ -87,7 +90,7 @@ export class GrafanaJavascriptAgentBackend
|
|||||||
'ResizeObserver loop completed',
|
'ResizeObserver loop completed',
|
||||||
'Non-Error exception captured with keys',
|
'Non-Error exception captured with keys',
|
||||||
],
|
],
|
||||||
ignoreUrls: [new RegExp(`/*${options.customEndpoint}/`), /frontend-metrics/],
|
ignoreUrls: [new RegExp(`/*${options.customEndpoint}/`), ...TRACKING_URLS, ...options.ignoreUrls],
|
||||||
sessionTracking: {
|
sessionTracking: {
|
||||||
persistent: true,
|
persistent: true,
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user