Comments (5)
You should be able to, what are you trying to do?
The API is (at least supposed) to be identical, to the normal application-insights.
from angular-application-insights.
userId is set with setAuthenticatedUserContext
.
To set custom properties i think you need to add a custom telemetry initializer.
This doesn't appear to exposed though in this library.
from angular-application-insights.
I think the problem is here:
AppInsightsService
defines a queue
and context
field but they are never set to anything.
public init(): void {
if (this.config) {
if (this.config.instrumentationKey) {
try {
AppInsights.downloadAndSetup(this.config);
if (!this.config.overrideTrackPageMetrics) {
this.router.events.pipe(
filter(event => event instanceof NavigationStart)
)
.subscribe((event: NavigationStart) => {
this.startTrackPage(event.url);
});
this.router.events.pipe(
filter(event => event instanceof NavigationEnd)
)
.subscribe((event: NavigationEnd) => {
this.stopTrackPage(event.url);
});
}
this.queue = AppInsights.queue;
this.context = AppInsights.context;
} catch (ex) {
console.warn('Angular application insights Error [downloadAndSetup]: ', ex);
}
} else {
if (!this.config.instrumentationKeySetlater) { // there is no this.config.instrumentationKey AND no this.config.instrumentationKeySetlater => Add log.
console.warn('An instrumentationKey value is required to initialize AppInsightsService');
}
}
} else {
console.warn('You need forRoot on ApplicationInsightsModule, with or instrumentationKeySetlater or instrumentationKey set at least');
}
}
Modified init to set after download and setup.
from angular-application-insights.
Should then be able to do something like this:
appInsights.queue.push(() => {
appInsights.context.addTelemetryInitializer((envelope: Microsoft.ApplicationInsights.IEnvelope) => {
const ti = envelope.data.baseData;
ti.properties = ti.properties || {};
ti.properties['foo'] = 'bar';
});
});
from angular-application-insights.
Fixed via e5040be thanks to @worldspawn 🎖
from angular-application-insights.
Related Issues (20)
- Angular 12 Support HOT 2
- Angular 13 support HOT 2
- Angular 14 support HOT 7
- Update of ApplicationInsights-JS used HOT 3
- Prevent Certain Data from Logging HOT 1
- Cannot find module '@angular/core' HOT 2
- upgrade to AI v2 HOT 8
- i wanted to make a heartbeat in my angular application HOT 1
- appInsightsService.queue set to undefined HOT 1
- Angular 8 (ivy) - ERROR in There is no format with import statements HOT 4
- Angular 8 support HOT 5
- Status Code: 400 100: Field 'ai.operation.name' on type 'ContextTagKeys' is too long. Expected: 1024 HOT 3
- Can't seem to update azure with any data? HOT 1
- Angular 9 support HOT 4
- Dependency tracking with ResultCode = 0 HOT 4
- Add missing property `enableAutoRouteTracking` to configuration HOT 1
- Generic type 'ModuleWithProviders<T>' requires 1 type argument(s) HOT 1
- warnings in Angular 10 upgrade - CommonJS or AMD dependencies can cause optimization bailouts HOT 2
- Move away from dependency on deprecated applicationinsights-js package HOT 2
- Angular 11 incompatible HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from angular-application-insights.