Skip to content

Commit 04ad996

Browse files
committed
Adding declarations for Application Insights
1 parent 557bb59 commit 04ad996

File tree

2 files changed

+454
-0
lines changed

2 files changed

+454
-0
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
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+
};

0 commit comments

Comments
 (0)