You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* enable preloading
* Deprecate node-hc in README
* remove node-hc
* Also mention NODE_OPTIONS
* Consolidate 2 different sections on preloading
* Also update version number in this PR
* Update version to 4.0.0
* Update version to 4.0.0
* Also note NODE_OPTIONS is in 6.12.0
* also remove launcher.js
Copy file name to clipboardExpand all lines: README.md
+13-47Lines changed: 13 additions & 47 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -40,7 +40,8 @@ Node Application Metrics provides the following built-in data collection sources
40
40
Redis | Redis commands issued by the application
41
41
Riak | Riak methods called by the application
42
42
Request tracking | A tree of application requests, events and optionally trace (disabled by default)
43
-
Function trace | Tracing of application function calls that occur during a request (disabled by default)
43
+
Function trace | Tracing of application function calls that occur during a request (disabled by default)
44
+
44
45
## Performance overhead
45
46
46
47
Our testing has shown that the performance overhead in terms of processing is minimal, adding less than 0.5 % to the CPU usage of your application. The additional memory required is around 20 MB to gather information about your system and application.
@@ -57,38 +58,6 @@ You can get Node Application Metrics from 3 different places:
57
58
* Github ([install from source](https://github.com/RuntimeTools/appmetrics/wiki/Install-direct-from-github-source) by cloning the git repository. Requires a compiler)
58
59
*[IBM SDK for Node.js](https://developer.ibm.com/node/sdk/) (packaged with the SDK, native libraries are prebuilt)
59
60
60
-
Using **npm** you can install Node Application Metrics either locally or globally.
61
-
62
-
**When installed locally** you can access monitoring data via both the API and the Health Center client by modifying your application to use appmetrics (see *[Modifying your application to use the local installation](#modifying-your-application-to-use-the-local-installation)*).
63
-
64
-
To perform a local install:
65
-
```sh
66
-
$ npm install appmetrics
67
-
```
68
-
A local install will put the module inside "*`./node_modules` of the current package root*" (see the [npm documentation][4] for more information); usually this is the current directory and in that case the module installation directory will be `./node_modules/appmetrics`.
69
-
70
-
**When installed globally** you can access monitoring data via the Health Center client (but not the API) by using the `node-hc` command-line utility (see *[The `node-hc` command](#the-node-hc-command)*).
71
-
72
-
To perform a global install:
73
-
```sh
74
-
$ npm install -g appmetrics
75
-
```
76
-
A global install will put the module inside a directory tied to your Node.js SDK.
It also adds the `node-hc` command to another directory tied to your Node.js SDK, one that was added to your executable search path by the Node.js SDK installer.
85
-
86
-
* On Windows, either:
87
-
*`<UserDirectory>\AppData\Roaming\npm`
88
-
* or: `<NodeInstallDirectory>`
89
-
* On other platforms:
90
-
*`<node_install_directory>/bin`
91
-
92
61
### Configuring Node Application Metrics
93
62
94
63
Node Application Metrics can be configured in two ways, by using the configuration file described below or via a call to configure(options).
@@ -112,16 +81,19 @@ The following options are specific to appmetrics:
112
81
113
82
## Running Node Application Metrics
114
83
115
-
### The `node-hc` command
116
-
If you [globally installed](#installation) this module with npm, you can use the `node-hc` command to run your application instead of the `node` command. This will run your application as it would normally under node (including any node options) but additionally load and start `appmetrics`.
84
+
### Preloading appmetrics
85
+
In previous versions appmetrics came with an executable, `node-hc`, which could be used instead of the `node` command to run your application and load and start appmetrics. This has been removed in version 4.0.0, instead you can use:
117
86
118
87
```sh
119
-
$ node-hc app.js
88
+
$ node --require appmetrics/start app.js
120
89
```
90
+
to preload and start appmetrics, or in Node.js from versions 8.0.0 and 6.12.0 onwards, use the NODE_OPTIONS environment variable:
121
91
122
-
The purpose of this mode of operation is to provide monitoring of the application without requiring any changes to the application code. The data is sent to the Health Center Eclipse IDE client.
### Modifying your application to use the local installation
96
+
### Modifying your application to use appmetrics
125
97
If you [locally install](#installation) this module with npm then you will additionally have access to the monitoring data via the `appmetrics` API (see *[API Documentation](#api-documentation)*).
126
98
127
99
To load `appmetrics` and get the monitoring API object, add the following to the start-up code for your application:
@@ -133,9 +105,7 @@ The call to `appmetrics.monitor()` starts the data collection agent, making the
133
105
134
106
You should start your application using the `node` command as usual (**not**`node-hc`).
135
107
136
-
You must call `require('appmetrics');`*before* the require statements for any npm modules you want to monitor. Appmetrics must be initialized first so that it can instrument modules for monitoring as they are loaded. If this is a problem due to the structure of your application you can require the module on the node command line with -r to make sure it is pre-loaded:
137
-
138
-
`> node -r appmetrics myapp.js`
108
+
You must call `require('appmetrics');`*before* the require statements for any npm modules you want to monitor. Appmetrics must be initialized first so that it can instrument modules for monitoring as they are loaded. If this is a problem due to the structure of your application you can require the module on the node command line by using -r or --require or by setting NODE_OPTIONS as described above to make sure it is pre-loaded.
139
109
140
110
Once you have loaded appmetrics you can then use the monitoring object to register callbacks and request information about the application:
141
111
```js
@@ -466,11 +436,6 @@ By default, a message similar to the following will be written to console output
### Error "Conflicting appmetrics module was already loaded by node-hc. Try running with node instead." when using `node-hc`
470
-
This error indicates you are using `node-hc` to run an application that uses the Node Application Metrics monitoring API (see *[Modifying your application to use the local installation](#modifying-your-application-to-use-the-local-installation)*). Resolve this by using `node` to run the application instead. **Alternatively**, you could remove (or disable temporarily) the use of the Node Application Metrics monitoring API in your application.
471
-
472
-
This error was added to prevent the scenario where 2 instances of the agent can be accidentally created and started in parallel -- the globally installed one created by `node-hc` and the locally installed one created by the `require('appmetrics');` call in an application modified to use the Node Application Metrics monitoring API.
473
-
474
439
### Error "The specified module could not be found ... appmetrics.node"
475
440
This error indicates there was a problem while loading the native part of the module or one of its dependent libraries. On Windows, `appmetrics.node` depends on a particular version of the C runtime library and if it cannot be found this error is the likely result.
476
441
@@ -510,9 +475,10 @@ The npm package for this project uses a semver-parsable X.0.Z version number for
510
475
Non-release versions of this project (for example on github.com/RuntimeTools/appmetrics) will use semver-parsable X.0.Z-dev.B version numbers, where X.0.Z is the last release with Z incremented and B is an integer. For further information on the development process go to the [appmetrics wiki][3]: [Developing](https://github.com/RuntimeTools/appmetrics/wiki/Developing).
511
476
512
477
## Version
513
-
3.1.3
478
+
4.0.0
514
479
515
480
## Release History
481
+
`4.0.0` - Remove node-hc and add support for preloading.
0 commit comments