mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Analytics: Fix ApplicationInsights integration (#89299)
change ApplicationInsights backend to use SystemJS to load
This commit is contained in:
parent
8c5a925202
commit
7bb883e375
@ -1320,10 +1320,6 @@ exports[`better eslint`] = {
|
||||
[0, 0, 0, "Do not use any type assertions.", "0"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "1"]
|
||||
],
|
||||
"public/app/core/services/echo/backends/analytics/ApplicationInsightsBackend.ts:5381": [
|
||||
[0, 0, 0, "Do not use any type assertions.", "0"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "1"]
|
||||
],
|
||||
"public/app/core/services/echo/backends/analytics/RudderstackBackend.ts:5381": [
|
||||
[0, 0, 0, "Do not use any type assertions.", "0"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "1"],
|
||||
|
@ -7,8 +7,6 @@ import {
|
||||
PageviewEchoEvent,
|
||||
} from '@grafana/runtime';
|
||||
|
||||
import { loadScript } from '../../utils';
|
||||
|
||||
interface ApplicationInsights {
|
||||
trackPageView: () => void;
|
||||
trackEvent: (event: { name: string; properties?: Record<string, unknown> }) => void;
|
||||
@ -39,8 +37,10 @@ export class ApplicationInsightsBackend implements EchoBackend<PageviewEchoEvent
|
||||
};
|
||||
|
||||
const url = 'https://js.monitor.azure.com/scripts/b/ai.2.min.js';
|
||||
loadScript(url).then(() => {
|
||||
const init = new (window as any).Microsoft.ApplicationInsights.ApplicationInsights(applicationInsightsOpts);
|
||||
System.import(url)
|
||||
.then((m) => (m.default ? m.default : m))
|
||||
.then(({ ApplicationInsights }) => {
|
||||
const init = new ApplicationInsights(applicationInsightsOpts);
|
||||
window.applicationInsights = init.loadAppInsights();
|
||||
});
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user