botbuilder-applicationinsights
Version:
Application Insights extensions for Microsoft BotBuilder.
100 lines (99 loc) • 4.17 kB
TypeScript
/**
* @module botbuilder-applicationinsights
*/
/**
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License.
*/
import * as appInsights from 'applicationinsights';
import { BotTelemetryClient, BotPageViewTelemetryClient, TelemetryDependency, TelemetryEvent, TelemetryException, TelemetryTrace, TelemetryPageView } from 'botbuilder-core';
export declare const ApplicationInsightsWebserverMiddleware: any;
/**
* 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;
* ```
*/
export declare class ApplicationInsightsTelemetryClient implements BotTelemetryClient, BotPageViewTelemetryClient {
private client;
private config;
/**
* Creates a new instance of the
* [ApplicationInsightsTelemetryClient](xref:botbuilder-applicationinsights.ApplicationInsightsTelemetryClient)
* class.
*
* @param connectionString The ApplicationInsights connection string.
*
* @remarks The settings parameter is passed directly into appInsights.setup().
* https://www.npmjs.com/package/applicationinsights#basic-usage
*/
constructor(connectionString: string);
/**
* Creates a new instance of the
* [ApplicationInsightsTelemetryClient](xref:botbuilder-applicationinsights.ApplicationInsightsTelemetryClient)
* class.
*
* @param instrumentationKey The ApplicationInsights instrumentation key.
*
* @remarks The settings parameter is passed directly into appInsights.setup().
* https://www.npmjs.com/package/applicationinsights#basic-usage
*/
constructor(instrumentationKey: string);
private toJSON;
/*
* Provides access to the Application Insights configuration that is running here.
* Allows developers to adjust the options, for example:
* `appInsightsClient.configuration.setAutoCollectDependencies(false)`
*
* @returns app insights configuration
*/
readonly configuration: appInsights.Configuration;
/*
* Provides direct access to the telemetry client object, which might be necessary for some operations.
*
* @returns app insights telemetry client
*/
readonly defaultClient: appInsights.TelemetryClient;
/**
* Sends information about an external dependency (outgoing call) in the application.
*
* @param telemetry The [TelemetryDependency](xref:botbuilder-core.TelemetryDependency) to track.
*/
trackDependency(telemetry: TelemetryDependency): void;
/**
* Logs custom events with extensible named fields.
*
* @param telemetry The [TelemetryEvent](xref:botbuilder-core.TelemetryEvent) to track.
*/
trackEvent(telemetry: TelemetryEvent): void;
/**
* Logs a system exception.
*
* @param telemetry The [TelemetryException](xref:botbuilder-core.TelemetryException) to track.
*/
trackException(telemetry: TelemetryException): void;
/**
* Sends a trace message.
*
* @param telemetry The [TelemetryTrace](xref:botbuilder-core.TelemetryTrace) to track.
*/
trackTrace(telemetry: TelemetryTrace): void;
/**
* Logs a dialog entry as an Application Insights page view.
*
* @param telemetry The [TelemetryPageView](xref:botbuilder-core.TelemetryPageView) to track.
*/
trackPageView(telemetry: TelemetryPageView): void;
/**
* Flushes the in-memory buffer and any metrics being pre-aggregated.
*/
flush(): void;
}
//# sourceMappingURL=applicationInsightsTelemetryClient.d.ts.map