UNPKG

ca-apm-probe

Version:

CA APM Node.js Agent monitors real-time health and performance of Node.js applications

48 lines (41 loc) 1.69 kB
#!/usr/bin/env node /** * Copyright (c) 2015 CA. All rights reserved. * * This software and all information contained therein is confidential and proprietary and * shall not be duplicated, used, disclosed or disseminated in any way except as authorized * by the applicable license agreement, without the express written permission of CA. All * authorized reproductions must be marked with this language. * * EXCEPT AS SET FORTH IN THE APPLICABLE LICENSE AGREEMENT, TO THE EXTENT * PERMITTED BY APPLICABLE LAW, CA PROVIDES THIS SOFTWARE WITHOUT WARRANTY * OF ANY KIND, INCLUDING WITHOUT LIMITATION, ANY IMPLIED WARRANTIES OF * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT WILL CA BE * LIABLE TO THE END USER OR ANY THIRD PARTY FOR ANY LOSS OR DAMAGE, DIRECT OR * INDIRECT, FROM THE USE OF THIS SOFTWARE, INCLUDING WITHOUT LIMITATION, LOST * PROFITS, BUSINESS INTERRUPTION, GOODWILL, OR LOST DATA, EVEN IF CA IS * EXPRESSLY ADVISED OF SUCH LOSS OR DAMAGE. */ const config = require('../lib/configdata').getConfigData(); if(config.react.enabled){ var caapmreactjs = require('./ca-apm-run-react'); }else{ // Reset argv to not include the runner (at argv[1]). process.argv = process.argv.slice(0, 1).concat(process.argv.slice(2)); var appScript = require('path').resolve(process.argv[1]); // load ca-apm-probe, instrumenting current node process require('../')({ appScriptName: appScript }); try{ require('@ca-apm/native-metrics'); } catch(e){ console.log("Native metric is not enabled as it also needs Python to be installed!"); } // Run as if app is the main module require('module')._load( appScript, null, // parent true // isMain ); }