mirror of
https://github.com/grafana/grafana.git
synced 2025-09-22 11:33:03 +08:00
Chore: Type GA and Rudderstack analytics config (#51197)
* Chore: Type GA and Rudderstack analytics config * rely on implicit unknown
This commit is contained in:
@ -188,4 +188,9 @@ export interface GrafanaConfig {
|
|||||||
unifiedAlertingEnabled: boolean;
|
unifiedAlertingEnabled: boolean;
|
||||||
angularSupportEnabled: boolean;
|
angularSupportEnabled: boolean;
|
||||||
feedbackLinksEnabled: boolean;
|
feedbackLinksEnabled: boolean;
|
||||||
|
googleAnalyticsId: string | undefined;
|
||||||
|
rudderstackWriteKey: string | undefined;
|
||||||
|
rudderstackDataPlaneUrl: string | undefined;
|
||||||
|
rudderstackSdkUrl: string | undefined;
|
||||||
|
rudderstackConfigUrl: string | undefined;
|
||||||
}
|
}
|
||||||
|
@ -119,6 +119,11 @@ export class GrafanaBootConfig implements GrafanaConfig {
|
|||||||
reporting = {
|
reporting = {
|
||||||
enabled: true,
|
enabled: true,
|
||||||
};
|
};
|
||||||
|
googleAnalyticsId: undefined;
|
||||||
|
rudderstackWriteKey: undefined;
|
||||||
|
rudderstackDataPlaneUrl: undefined;
|
||||||
|
rudderstackSdkUrl: undefined;
|
||||||
|
rudderstackConfigUrl: undefined;
|
||||||
|
|
||||||
constructor(options: GrafanaBootConfig) {
|
constructor(options: GrafanaBootConfig) {
|
||||||
const mode = options.bootData.user.lightTheme ? 'light' : 'dark';
|
const mode = options.bootData.user.lightTheme ? 'light' : 'dark';
|
||||||
|
@ -152,7 +152,7 @@ export class GrafanaApp {
|
|||||||
}),
|
}),
|
||||||
document.getElementById('reactRoot')
|
document.getElementById('reactRoot')
|
||||||
);
|
);
|
||||||
} catch (error: any) {
|
} catch (error) {
|
||||||
console.error('Failed to start Grafana', error);
|
console.error('Failed to start Grafana', error);
|
||||||
window.__grafana_load_failed();
|
window.__grafana_load_failed();
|
||||||
}
|
}
|
||||||
@ -204,22 +204,22 @@ function initEchoSrv() {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((config as any).googleAnalyticsId) {
|
if (config.googleAnalyticsId) {
|
||||||
registerEchoBackend(
|
registerEchoBackend(
|
||||||
new GAEchoBackend({
|
new GAEchoBackend({
|
||||||
googleAnalyticsId: (config as any).googleAnalyticsId,
|
googleAnalyticsId: config.googleAnalyticsId,
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((config as any).rudderstackWriteKey && (config as any).rudderstackDataPlaneUrl) {
|
if (config.rudderstackWriteKey && config.rudderstackDataPlaneUrl) {
|
||||||
registerEchoBackend(
|
registerEchoBackend(
|
||||||
new RudderstackBackend({
|
new RudderstackBackend({
|
||||||
writeKey: (config as any).rudderstackWriteKey,
|
writeKey: config.rudderstackWriteKey,
|
||||||
dataPlaneUrl: (config as any).rudderstackDataPlaneUrl,
|
dataPlaneUrl: config.rudderstackDataPlaneUrl,
|
||||||
user: config.bootData.user,
|
user: config.bootData.user,
|
||||||
sdkUrl: (config as any).rudderstackSdkUrl,
|
sdkUrl: config.rudderstackSdkUrl,
|
||||||
configUrl: (config as any).rudderstackConfigUrl,
|
configUrl: config.rudderstackConfigUrl,
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user