Hi All, how do we conditionally setup AppInsights if a key is present? We only use AppInsights in Production, and we'd like the option to have AppInsights not start at all if no instrumentationkey (or config) is present. Can we do that?
I am getting the following error;
And if I provide a configuration, I must provide an instrumentationKey.
Apart from doing something hacky like this.
if (constants.instrumentationKey) {applicationInsightsServiceProvider.configure({instrumentationKey: constants.instrumentationKey,applicationName: 'App',autoStateChangeTracking: false,autoLogTracking: true,sessionExpirationMs: 1800000});} else {// configure a dummy instance with telemetry disabled, cause we don't want itapplicationInsightsServiceProvider.configure({instrumentationKey: 'this-is-a-fake-key-cause-eff',disableTelemetry: true});}
Hi All, how do we conditionally setup AppInsights if a key is present? We only use AppInsights in Production, and we'd like the option to have AppInsights not start at all if no instrumentationkey (or config) is present. Can we do that?
I am getting the following error;
And if I provide a configuration, I must provide an instrumentationKey.
Apart from doing something hacky like this.
if (constants.instrumentationKey) {
applicationInsightsServiceProvider.configure({
instrumentationKey: constants.instrumentationKey,
applicationName: 'App',
autoStateChangeTracking: false,
autoLogTracking: true,
sessionExpirationMs: 1800000
});
} else {
// configure a dummy instance with telemetry disabled, cause we don't want it
applicationInsightsServiceProvider.configure({
instrumentationKey: 'this-is-a-fake-key-cause-eff',
disableTelemetry: true
});
}