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, "Do not use any type assertions.", "0"],
|
||||||
[0, 0, 0, "Unexpected any. Specify a different type.", "1"]
|
[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": [
|
"public/app/core/services/echo/backends/analytics/RudderstackBackend.ts:5381": [
|
||||||
[0, 0, 0, "Do not use any type assertions.", "0"],
|
[0, 0, 0, "Do not use any type assertions.", "0"],
|
||||||
[0, 0, 0, "Unexpected any. Specify a different type.", "1"],
|
[0, 0, 0, "Unexpected any. Specify a different type.", "1"],
|
||||||
|
@ -7,8 +7,6 @@ import {
|
|||||||
PageviewEchoEvent,
|
PageviewEchoEvent,
|
||||||
} from '@grafana/runtime';
|
} from '@grafana/runtime';
|
||||||
|
|
||||||
import { loadScript } from '../../utils';
|
|
||||||
|
|
||||||
interface ApplicationInsights {
|
interface ApplicationInsights {
|
||||||
trackPageView: () => void;
|
trackPageView: () => void;
|
||||||
trackEvent: (event: { name: string; properties?: Record<string, unknown> }) => void;
|
trackEvent: (event: { name: string; properties?: Record<string, unknown> }) => void;
|
||||||
@ -39,10 +37,12 @@ export class ApplicationInsightsBackend implements EchoBackend<PageviewEchoEvent
|
|||||||
};
|
};
|
||||||
|
|
||||||
const url = 'https://js.monitor.azure.com/scripts/b/ai.2.min.js';
|
const url = 'https://js.monitor.azure.com/scripts/b/ai.2.min.js';
|
||||||
loadScript(url).then(() => {
|
System.import(url)
|
||||||
const init = new (window as any).Microsoft.ApplicationInsights.ApplicationInsights(applicationInsightsOpts);
|
.then((m) => (m.default ? m.default : m))
|
||||||
window.applicationInsights = init.loadAppInsights();
|
.then(({ ApplicationInsights }) => {
|
||||||
});
|
const init = new ApplicationInsights(applicationInsightsOpts);
|
||||||
|
window.applicationInsights = init.loadAppInsights();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
addEvent = (e: PageviewEchoEvent | InteractionEchoEvent) => {
|
addEvent = (e: PageviewEchoEvent | InteractionEchoEvent) => {
|
||||||
|
Loading…
Reference in New Issue
Block a user