feat: Proxy all RudderStack frontend telemetry events through the backend (#17177)

Co-authored-by: Nikhil Kuriakose <nikhil.kuriakose@n8n.io>
This commit is contained in:
Ricardo Espinoza
2025-07-23 09:17:01 -04:00
committed by GitHub
parent e317c92916
commit 5524b2137a
9 changed files with 116 additions and 7 deletions

View File

@@ -16,7 +16,7 @@ describe('telemetry', () => {
setActivePinia(createPinia());
settingsStore = useSettingsStore();
telemetry.init(
{ enabled: true, config: { url: '', key: '' } },
{ enabled: true, config: { proxy: '', key: '', sourceConfig: '', url: '' } },
{ versionCli: '1', instanceId: '1' },
);
});

View File

@@ -47,7 +47,7 @@ export class Telemetry {
if (!telemetrySettings.enabled || !telemetrySettings.config || this.rudderStack) return;
const {
config: { key, url },
config: { key, proxy, sourceConfig },
} = telemetrySettings;
const settingsStore = useSettingsStore();
@@ -57,10 +57,10 @@ export class Telemetry {
const logging = logLevel === 'debug' ? { logLevel: 'DEBUG' } : {};
this.initRudderStack(key, url, {
this.initRudderStack(key, proxy, {
integrations: { All: false },
loadIntegration: false,
configUrl: 'https://api-rs.n8n.io',
configUrl: sourceConfig,
...logging,
});
@@ -201,7 +201,7 @@ export class Telemetry {
}
}
private initRudderStack(key: string, url: string, options: IDataObject) {
private initRudderStack(key: string, proxy: string, options: IDataObject) {
window.rudderanalytics = window.rudderanalytics || [];
if (!this.rudderStack) {
return;
@@ -252,7 +252,7 @@ export class Telemetry {
};
this.rudderStack.loadJS();
this.rudderStack.load(key, url, options);
this.rudderStack.load(key, proxy, options);
}
}