ApplicationInsightsTelemetryClient class
This is a wrapper class around the Application Insights node client. This is primarily designed to be used alongside the WaterfallDialog telemetry collection. It provides a pre-configured App Insights client, and wrappers around the major tracking functions, allowing it to conform to Botbuilder's generic BotTelemetryClient interface. To use it, create pass in an instrumentation key:
const myDialog = new WaterfallDialog('my_dialog', steps);
const appInsightsClient = new ApplicationInsightsTelemetryClient(my_instrumentation_key);
myDialog.telemetryClient = appInsightsClient;
Constructors
| Application |
Creates a new instance of the ApplicationInsightsTelemetryClient class. |
| Application |
Creates a new instance of the ApplicationInsightsTelemetryClient class. |
Properties
| configuration | Provides access to the Application Insights configuration that is running here.
Allows developers to adjust the options, for example:
|
| default |
Provides direct access to the telemetry client object, which might be necessary for some operations. |
Methods
| flush() | Flushes the in-memory buffer and any metrics being pre-aggregated. |
| track |
Sends information about an external dependency (outgoing call) in the application. |
| track |
Logs custom events with extensible named fields. |
| track |
Logs a system exception. |
| track |
Logs a dialog entry as an Application Insights page view. |
| track |
Sends a trace message. |
Constructor Details
ApplicationInsightsTelemetryClient(string)
Creates a new instance of the ApplicationInsightsTelemetryClient class.
new ApplicationInsightsTelemetryClient(connectionString: string)
Parameters
- connectionString
-
string
The ApplicationInsights connection string.
Remarks
The settings parameter is passed directly into appInsights.setup(). https://www.npmjs.com/package/applicationinsights#basic-usage
ApplicationInsightsTelemetryClient(string)
Creates a new instance of the ApplicationInsightsTelemetryClient class.
new ApplicationInsightsTelemetryClient(instrumentationKey: string)
Parameters
- instrumentationKey
-
string
The ApplicationInsights instrumentation key.
Remarks
The settings parameter is passed directly into appInsights.setup(). https://www.npmjs.com/package/applicationinsights#basic-usage
Property Details
configuration
Provides access to the Application Insights configuration that is running here.
Allows developers to adjust the options, for example:
appInsightsClient.configuration.setAutoCollectDependencies(false)
Configuration configuration
Property Value
Configuration
app insights configuration
defaultClient
Provides direct access to the telemetry client object, which might be necessary for some operations.
appInsights.TelemetryClient defaultClient
Property Value
app insights telemetry client
Method Details
flush()
Flushes the in-memory buffer and any metrics being pre-aggregated.
function flush()
trackDependency(TelemetryDependency)
Sends information about an external dependency (outgoing call) in the application.
function trackDependency(telemetry: TelemetryDependency)
Parameters
- telemetry
-
TelemetryDependency
The TelemetryDependency to track.
trackEvent(TelemetryEvent)
Logs custom events with extensible named fields.
function trackEvent(telemetry: TelemetryEvent)
Parameters
- telemetry
-
TelemetryEvent
The TelemetryEvent to track.
trackException(TelemetryException)
Logs a system exception.
function trackException(telemetry: TelemetryException)
Parameters
- telemetry
-
TelemetryException
The TelemetryException to track.
trackPageView(TelemetryPageView)
Logs a dialog entry as an Application Insights page view.
function trackPageView(telemetry: TelemetryPageView)
Parameters
- telemetry
-
TelemetryPageView
The TelemetryPageView to track.
trackTrace(TelemetryTrace)
Sends a trace message.
function trackTrace(telemetry: TelemetryTrace)
Parameters
- telemetry
-
TelemetryTrace
The TelemetryTrace to track.