Skip to content

Instantly share code, notes, and snippets.

@yoadsn
Last active July 16, 2018 11:13
Show Gist options
  • Select an option

  • Save yoadsn/dffb38bd657fa8d768310e6f84c31942 to your computer and use it in GitHub Desktop.

Select an option

Save yoadsn/dffb38bd657fa8d768310e6f84c31942 to your computer and use it in GitHub Desktop.
App Insights Processors Simple Example
import * as appInsights from 'applicationinsights';
const avoidMongodbAdmin = (envelope, context) => {
if (envelope.data.baseType === 'RemoteDependencyData') {
const { type, target } = envelope.data.baseData;
// Do not monitor calls to the admin DB
if (type === 'mongodb' && target === 'admin') {
return false;
}
}
return true;
}
// Configures and starts the app insights server tracking
export default () => {
const appInsightsConfig = appInsights
.setup(process.env.AI_TELEMETRY_KEY);
appInsights.defaultClient.addTelemetryProcessor(avoidMongodbAdmin);
appInsightsConfig.start();
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment