How to use the botbuilder-applicationinsights.ApplicationInsightsTelemetryClient function in botbuilder-applicationinsights

To help you get started, we’ve selected a few botbuilder-applicationinsights examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github microsoft / BotBuilder-Samples / samples / javascript_nodejs / 20.qna-with-appinsights / index.js View on Github external
};

// Create two variables to indicate whether or not the bot should include messages' text and usernames when
// sending information to Application Insights.
// These settings are used in the MyApplicationInsightsMiddleware and also in MyAppInsightsQnAMaker.
const logMessage = true;
const logName = true;

// Map the contents of appInsightsConfig to a consumable format for MyAppInsightsMiddleware.
const appInsightsSettings = {
    logOriginalMessage: logMessage,
    logUserName: logName
};

// Create an Application Insights telemetry client.
const appInsightsClient = new ApplicationInsightsTelemetryClient(appInsightsConfig.instrumentationKey);

// Create adapter. See https://aka.ms/about-bot-adapter to learn more adapters.
const adapter = new BotFrameworkAdapter({
    appId: endpointConfig.appId || process.env.microsoftAppID,
    appPassword: endpointConfig.appPassword || process.env.microsoftAppPassword
});

// Register a MyAppInsightsMiddleware instance.
// This will send to Application Insights all incoming Message-type activities.
// It also stores in TurnContext.TurnState an `applicationinsights` TelemetryClient instance.
// This cached TelemetryClient is used by the custom class MyAppInsightsQnAMaker.
adapter.use(new MyAppInsightsMiddleware(appInsightsClient, appInsightsSettings));

// Catch-all for errors.
adapter.onTurnError = async (context, error) => {
    console.error(`\n [onTurnError]: ${ error }`);
github microsoft / BotBuilder-Samples / samples / javascript_nodejs / 21.luis-with-appinsights / index.js View on Github external
};

// Create two variables to indicate whether or not the bot should include messages' text and usernames when
// sending information to Application Insights.
// These settings are used in the MyApplicationInsightsMiddleware and also in MyAppInsightsLuisRecognizer.
const logMessage = true;
const logName = true;

// Map the contents of appInsightsConfig to a consumable format for MyAppInsightsMiddleware.
const appInsightsSettings = {
    logOriginalMessage: logMessage,
    logUserName: logName
};

// Create an Application Insights telemetry client.
const appInsightsClient = new ApplicationInsightsTelemetryClient(appInsightsConfig.instrumentationKey);

// Indicate that the base LuisRecognizer class should include the raw LUIS results.
const includeApiResults = true;

// Create adapter. See https://aka.ms/about-bot-adapter to learn more adapters.
const adapter = new BotFrameworkAdapter({
    appId: endpointConfig.appId || process.env.microsoftAppID,
    appPassword: endpointConfig.appPassword || process.env.microsoftAppPassword
});

// Register a MyAppInsightsMiddleware instance.
// This will send to Application Insights all incoming Message-type activities.
// It also stores in TurnContext.TurnState an `applicationinsights` TelemetryClient instance.
// This cached TelemetryClient is used by the custom class MyAppInsightsLuisRecognizer.
adapter.use(new MyAppInsightsMiddleware(appInsightsClient, appInsightsSettings));
github microsoft / botframework-solutions / templates / Virtual-Assistant-Template / typescript / samples / sample-skill / src / index.ts View on Github external
function getTelemetryClient(settings: Partial): BotTelemetryClient {
    if (settings !== undefined && settings.appInsights !== undefined && settings.appInsights.instrumentationKey !== undefined) {
        const instrumentationKey: string = settings.appInsights.instrumentationKey;

        return new ApplicationInsightsTelemetryClient(instrumentationKey);
    }

    return new NullTelemetryClient();
}
github microsoft / botframework-solutions / templates / Virtual-Assistant-Template / typescript / generator-botbuilder-assistant / generators / app / templates / sample-assistant / src / index.ts View on Github external
function getTelemetryClient(settings: Partial): BotTelemetryClient {
    if (settings !== undefined && settings.appInsights !== undefined && settings.appInsights.instrumentationKey !== undefined) {
        const instrumentationKey: string = settings.appInsights.instrumentationKey;

        return new ApplicationInsightsTelemetryClient(instrumentationKey);
    }

    return new NullTelemetryClient();
}
github microsoft / botframework-solutions / templates / Virtual-Assistant-Template / typescript / generator-botbuilder-assistant / generators / skill / templates / sample-skill / src / index.ts View on Github external
function getTelemetryClient(settings: Partial): BotTelemetryClient {
    if (settings !== undefined && settings.appInsights !== undefined && settings.appInsights.instrumentationKey !== undefined) {
        const instrumentationKey: string = settings.appInsights.instrumentationKey;

        return new ApplicationInsightsTelemetryClient(instrumentationKey);
    }

    return new NullTelemetryClient();
}
github microsoft / BotBuilder-Samples / samples / javascript_nodejs / 21.corebot-app-insights / index.js View on Github external
function getTelemetryClient(instrumentationKey) {
    if (instrumentationKey) {
        return new ApplicationInsightsTelemetryClient(instrumentationKey);
    }
    return new NullTelemetryClient();
}

botbuilder-applicationinsights

Application Insights extensions for Microsoft BotBuilder.

MIT
Latest version published 2 months ago

Package Health Score

88 / 100
Full package analysis