Last active
July 16, 2018 11:13
-
-
Save yoadsn/dffb38bd657fa8d768310e6f84c31942 to your computer and use it in GitHub Desktop.
App Insights Processors Simple Example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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