-
Notifications
You must be signed in to change notification settings - Fork 6
Integrate with application insights #56
Conversation
Smarker
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM with comments
| .then(returnValue => { | ||
| const duration = new Date() - start; | ||
| const success = true; | ||
| client.trackEvent(eventName, { duration: duration, success: success }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if you wanted to add other properties to the event like siteType? Or metrics like the number of inserts performed? Would it be more flexible to add a third optional parameter to trackEvent for properties and a fourth optional parameter to it for metrics?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| appInsights.setup(appInsightsKey); | ||
| appInsights.start(); | ||
| client = appInsights.getClient(appInsightsKey); | ||
| console.log = trackTrace(/* INFO */ 1, consoleLog); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would enumerating the values 1, 2, 3 as INFO, ERROR, WARNING be more clear?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We make use of three application insights apis:
trackTracefor log statementstrackDependencyfor call to third-party servicestrackEventfor first-party scenarios