File tree Expand file tree Collapse file tree 2 files changed +454
-0
lines changed Expand file tree Collapse file tree 2 files changed +454
-0
lines changed Original file line number Diff line number Diff line change
1
+ ///<reference path='applicationinsights.d.ts' />
2
+ import appInsights = require( "applicationinsights" ) ;
3
+
4
+ // basic use
5
+ appInsights . setup ( "<instrumentation_key>" ) . start ( ) ;
6
+
7
+ // basic use with auto-collection configuration
8
+ appInsights . setup ( "<instrumentation_key>" )
9
+ . setAutoCollectRequests ( false )
10
+ . setAutoCollectPerformance ( false )
11
+ . setAutoCollectExceptions ( false )
12
+ // no telemetry will be sent until .start() is called
13
+ // this prevents any of the auto-collectors from initializing
14
+ . enableVerboseLogging ( )
15
+ . start ( ) ;
16
+
17
+ appInsights . client . trackEvent ( "custom event" , { customProperty : "custom property value" } ) ;
18
+ appInsights . client . trackException ( new Error ( "handled exceptions can be logged with this method" ) ) ;
19
+ appInsights . client . trackMetric ( "custom metric" , 3 ) ;
20
+ appInsights . client . trackTrace ( "trace message" ) ;
21
+
22
+ // assign common properties to all telemetry
23
+ appInsights . client . commonProperties = {
24
+ environment : "dev"
25
+ } ;
You can’t perform that action at this time.
0 commit comments