appmetrics
Advanced tools
Comparing version 1.1.2 to 1.2.0
@@ -41,4 +41,4 @@ /******************************************************************************* | ||
'win32-x64']; | ||
var AGENTCORE_VERSION = "3.0.10"; | ||
var APPMETRICS_VERSION = "1.1.2"; | ||
var AGENTCORE_VERSION = "3.1.0"; | ||
var APPMETRICS_VERSION = "1.2.0"; | ||
@@ -45,0 +45,0 @@ var LOG_FILE = path.join(INSTALL_DIR, 'install.log'); |
69
index.js
@@ -16,18 +16,36 @@ /******************************************************************************* | ||
*******************************************************************************/ | ||
var path = require("path") | ||
if(require.main != null){ | ||
var main_filename = require.main.filename; | ||
} else { | ||
var main_filename = ""; | ||
} | ||
var module_dir = path.dirname(module.filename) | ||
var os = require("os") | ||
//var serializer = require('./lib/serializer.js'); | ||
var aspect = require('./lib/aspect.js'); | ||
var request = require('./lib/request.js'); | ||
var fs = require('fs'); | ||
var agent = require("./appmetrics") | ||
var headlessZip = require("./headless_zip.js") | ||
var agent = require("./appmetrics") | ||
// Set the plugin search path | ||
agent.spath(path.join(module_dir, "plugins")) | ||
agent.start(); | ||
var hcAPI = require("./appmetrics-api.js"); | ||
var jsonProfilingMode = false; | ||
var propertyMappings = {'mqttPort':'com.ibm.diagnostics.healthcenter.mqtt.broker.port', | ||
'mqttHost':'com.ibm.diagnostics.healthcenter.mqtt.broker.host', | ||
'applicationID':'com.ibm.diagnostics.healthcenter.mqtt.application.id', | ||
'mqtt':'com.ibm.diagnostics.healthcenter.mqtt', | ||
'profiling':'com.ibm.diagnostics.healthcenter.data.profiling'}; | ||
var headlessPropertyMappings = { | ||
'appmetrics.file.collection':'com.ibm.diagnostics.healthcenter.headless', | ||
'appmetrics.file.max.size':'com.ibm.diagnostics.healthcenter.headless.files.max.size', | ||
'appmetrics.file.run.duration':'com.ibm.diagnostics.healthcenter.headless.run.duration', | ||
'appmetrics.file.delay.start':'com.ibm.diagnostics.healthcenter.headless.delay.start', | ||
'appmetrics.file.run.pause.duration':'com.ibm.diagnostics.healthcenter.headless.run.pause.duration', | ||
'appmetrics.file.run.number.of.runs':'com.ibm.diagnostics.healthcenter.headless.run.number.of.runs', | ||
'appmetrics.file.files.to.keep':'com.ibm.diagnostics.healthcenter.headless.files.to.keep', | ||
'appmetrics.file.output.directory':'com.ibm.diagnostics.healthcenter.headless.output.directory'}; | ||
@@ -226,2 +244,3 @@ /* | ||
} | ||
agent.setHeadlessZipFunction(headlessZip.headlessZip); | ||
} | ||
@@ -244,4 +263,6 @@ | ||
module.exports.monitor = function() { | ||
if (typeof(this.api) == 'undefined') { | ||
this.api = hcAPI.getAPI(agent, module.exports); | ||
this.start(); | ||
this.api = hcAPI.getAPI(agent, module.exports); | ||
} | ||
@@ -257,2 +278,12 @@ return this.api; | ||
options.strongTracer ? options.strongTracer.tracer : null; | ||
for (var key in options) { | ||
if(propertyMappings[key]) { | ||
agent.setOption(propertyMappings[key], options[key]); | ||
} else { | ||
agent.setOption(key, options[key]); | ||
} | ||
} | ||
// If user has not specified application ID, use main filename | ||
main_filename = options.applicationID ? options.applicationID : main_filename; | ||
}; | ||
@@ -272,1 +303,29 @@ | ||
} | ||
module.exports.start = function start () { | ||
agent.setOption(propertyMappings['applicationID'], main_filename); | ||
for(var property in headlessPropertyMappings) { | ||
var prop = agent.getOption(property); | ||
if(prop) { | ||
agent.setOption(headlessPropertyMappings[property], prop); | ||
} | ||
} | ||
var headlessOutputDir = agent.getOption('com.ibm.diagnostics.healthcenter.headless.output.directory'); | ||
if(headlessOutputDir) { | ||
headlessZip.setHeadlessOutputDir(headlessOutputDir); | ||
} | ||
var headlessFilesToKeep = agent.getOption('com.ibm.diagnostics.healthcenter.headless.files.to.keep'); | ||
if(headlessFilesToKeep && !isNaN(headlessFilesToKeep) && headlessFilesToKeep > 0) { | ||
headlessZip.setFilesToKeep(headlessFilesToKeep); | ||
} | ||
var am = this; | ||
agent.start(); | ||
process.on('exit', function () { | ||
var headlessMode = agent.getOption('com.ibm.diagnostics.healthcenter.headless'); | ||
am.stop(); | ||
if(headlessMode == 'on') { | ||
headlessZip.tryZipOnExit(); | ||
} | ||
}); | ||
} | ||
{ | ||
"name": "graceful-fs", | ||
"description": "A drop-in replacement for fs, making various improvements.", | ||
"version": "4.1.9", | ||
"version": "4.1.11", | ||
"repository": { | ||
@@ -47,3 +47,3 @@ "type": "git", | ||
], | ||
"gitHead": "0798db3711e33de92de5a93979278bb89d629143", | ||
"gitHead": "65cf80d1fd3413b823c16c626c1e7c326452bee5", | ||
"bugs": { | ||
@@ -53,6 +53,6 @@ "url": "https://github.com/isaacs/node-graceful-fs/issues" | ||
"homepage": "https://github.com/isaacs/node-graceful-fs#readme", | ||
"_id": "graceful-fs@4.1.9", | ||
"_shasum": "baacba37d19d11f9d146d3578bc99958c3787e29", | ||
"_id": "graceful-fs@4.1.11", | ||
"_shasum": "0e8bdfe4d1ddb8854d64e04ea7c00e2a026e5658", | ||
"_from": "graceful-fs@>=4.1.2 <5.0.0", | ||
"_npmVersion": "3.10.7", | ||
"_npmVersion": "3.10.9", | ||
"_nodeVersion": "6.5.0", | ||
@@ -64,4 +64,4 @@ "_npmUser": { | ||
"dist": { | ||
"shasum": "baacba37d19d11f9d146d3578bc99958c3787e29", | ||
"tarball": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.9.tgz" | ||
"shasum": "0e8bdfe4d1ddb8854d64e04ea7c00e2a026e5658", | ||
"tarball": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.11.tgz" | ||
}, | ||
@@ -75,7 +75,7 @@ "maintainers": [ | ||
"_npmOperationalInternal": { | ||
"host": "packages-12-west.internal.npmjs.com", | ||
"tmp": "tmp/graceful-fs-4.1.9.tgz_1475103672016_0.7011275647673756" | ||
"host": "packages-18-east.internal.npmjs.com", | ||
"tmp": "tmp/graceful-fs-4.1.11.tgz_1479843029430_0.2122855328489095" | ||
}, | ||
"_resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.9.tgz", | ||
"_resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.11.tgz", | ||
"readme": "ERROR: No README data found!" | ||
} |
@@ -6,2 +6,5 @@ var fs = require('./fs.js') | ||
var cwd = null | ||
var platform = process.env.GRACEFUL_FS_PLATFORM || process.platform | ||
process.cwd = function() { | ||
@@ -84,11 +87,28 @@ if (!cwd) | ||
// to fail with an EACCES or EPERM if the directory contains newly | ||
// created files. Try again on failure, for up to 1 second. | ||
if (process.platform === "win32") { | ||
// created files. Try again on failure, for up to 60 seconds. | ||
// Set the timeout this long because some Windows Anti-Virus, such as Parity | ||
// bit9, may lock files for up to a minute, causing npm package install | ||
// failures. Also, take care to yield the scheduler. Windows scheduling gives | ||
// CPU to a busy looping process, which can cause the program causing the lock | ||
// contention to be starved of CPU by node, so the contention doesn't resolve. | ||
if (platform === "win32") { | ||
fs.rename = (function (fs$rename) { return function (from, to, cb) { | ||
var start = Date.now() | ||
var backoff = 0; | ||
fs$rename(from, to, function CB (er) { | ||
if (er | ||
&& (er.code === "EACCES" || er.code === "EPERM") | ||
&& Date.now() - start < 1000) { | ||
return fs$rename(from, to, CB) | ||
&& Date.now() - start < 60000) { | ||
setTimeout(function() { | ||
fs.stat(to, function (stater, st) { | ||
if (stater && stater.code === "ENOENT") | ||
fs$rename(from, to, CB); | ||
else | ||
cb(er) | ||
}) | ||
}, backoff) | ||
if (backoff < 100) | ||
backoff += 10; | ||
return; | ||
} | ||
@@ -95,0 +115,0 @@ if (cb) cb(er) |
{ | ||
"name": "appmetrics", | ||
"version": "1.1.2", | ||
"version": "1.2.0", | ||
"description": "Node Application Metrics", | ||
@@ -10,3 +10,4 @@ "bin": { | ||
"nan": "2.x", | ||
"tar": "2.x" | ||
"tar": "2.x", | ||
"jszip": "2.5.x" | ||
}, | ||
@@ -21,3 +22,3 @@ "bundleDependencies": [ | ||
"scripts": { | ||
"test": "tap --reporter tap tests/api_tests.js", | ||
"test": "tap --reporter tap --timeout=120 tests/api_tests.js tests/headless_test.js", | ||
"install": "node extract_all_binaries.js" | ||
@@ -24,0 +25,0 @@ }, |
@@ -108,4 +108,7 @@ # Node Application Metrics | ||
### Configuring Node Application Metrics | ||
Node Application Metrics comes with a configuration file inside the [module installation directory](#install) (`.../node_modules/appmetrics/appmetrics.properties`). This is used to configure connection options, logging and data source options. | ||
Node Application Metrics can be configured in two ways, by using the configuration file described below or via a call to configure(options). | ||
Node Application Metrics comes with a configuration file inside the [module installation directory](#install) (`.../node_modules/appmetrics/appmetrics.properties`). This can be used to configure connection options, logging and data source options. | ||
Node Application Metrics will attempt to load `appmetrics.properties` from one of the following locations (in order): | ||
@@ -166,3 +169,3 @@ | ||
### Connecting to the client | ||
Connecting to the Health Center client requires the additional installation of a MQTT broker. The Node Application Metrics agent sends data to the MQTT broker specified in the `appmetrics.properties` file. Installation and configuration documentation for the Health Center client is available from the [Health Center documentation in IBM Knowledge Center][2]. | ||
Connecting to the Health Center client requires the additional installation of a MQTT broker. The Node Application Metrics agent sends data to the MQTT broker specified in the `appmetrics.properties` file or set via a call to configure(options). Installation and configuration documentation for the Health Center client is available from the [Health Center documentation in IBM Knowledge Center][2]. | ||
@@ -175,3 +178,15 @@ Note that both the API and the Health Center client can be used at the same time and will receive the same data. Use of the API requires a local install and application modification (see *[Modifying your application to use the local installation](#run-local)*). | ||
## API Documentation | ||
### appmetrics.configure(options) | ||
Sets various properties on the appmetrics monitoring agent. If the agent has already been started, this function does nothing. | ||
* `options`(Object) key value pairs of properties and values to be set on the monitoring agent. | ||
Property name | Property value | Effect | ||
:--------------------|:-------------------------|:----------------------------- | ||
`applicationID` | `string` | Specifies a unique identifier for the mqtt connection | ||
`mqtt` | `[off|on]` | Specifies whether the monitoring agent sends data to the mqtt broker. The default value is on | ||
`mqttHost` | `host name` | Specifies the host name of the mqtt broker | ||
`mqttPort` | `port number` | Specifies the port number of the mqtt broker | ||
`profiling` | `[off|on]` | Specifies whether method profiling data will be captured. The default value is off | ||
### appmetrics.start() | ||
@@ -468,5 +483,6 @@ Starts the appmetrics monitoring agent. If the agent is already running this function does nothing. | ||
## Version | ||
1.1.2 | ||
1.2.0 | ||
## Release History | ||
`1.2.0` - Add file data collection capability and option configuration via api. | ||
`1.1.2` - Update agent core to 3.0.10, support Node.js v7. | ||
@@ -473,0 +489,0 @@ `1.1.1` - Fix node-gyp rebuild failure and don't force MQTT broker to on |
@@ -18,2 +18,3 @@ /******************************************************************************* | ||
var app = require('./test_app'); | ||
app.start(); | ||
var monitor = app.appmetrics.monitor(); | ||
@@ -20,0 +21,0 @@ app.appmetrics.enable("profiling"); |
@@ -49,3 +49,2 @@ /******************************************************************************* | ||
appmetrics = require('../'); | ||
appmetrics.start(); | ||
@@ -56,2 +55,6 @@ // Make agent visible for other script files. | ||
module.exports.start = function start() { | ||
appmetrics.start(); | ||
} | ||
//Write a string to memory on timer | ||
@@ -58,0 +61,0 @@ var test = null; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Native code
Supply chain riskContains native code (e.g., compiled binaries or shared libraries). Including native code can obscure malicious behavior.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Native code
Supply chain riskContains native code (e.g., compiled binaries or shared libraries). Including native code can obscure malicious behavior.
Found 1 instance in 1 package
9119408
288
16766
508
3
72
+ Addedjszip@2.5.x
+ Addedjszip@2.5.0(transitive)
+ Addedpako@0.2.9(transitive)