A NPM version of percolate:server-info, for Meteor 1.6-1.8
GPL-3.0 License
Once installed and configured, the package provides
/serverInfo/doc
where all exposed metrics are documented/serverInfo
, like the following one:facts-ui
package. So from the project directory, add both dependencies:meteor add facts
meteor yarn add meteor_server_info
import { ServerInfo } from "meteor_server_info";
Meteor.startup(function () {
const serverInfo = new ServerInfo(Meteor, WebApp, MongoInternals, Facts);
serverInfo.register();
});
To work on the package, you will probably not want to use it via NPM/Yarn. In that case:
package.json
import/server/
directory of your project,meteor yarn
yarn && yarn doc
. The documentation will be builtout/
directory.meteor yarn ts-compile
, lint with meteor yarn ts-lint
andmeteor yarn test-ci
To use your development version of the module, import it locally in your
application code. You will have access to serverInfo
from meteor shell
.
// Heed the "./" import.
import { ServerInfo } from "./meteor_server_info";
Meteor.startup(function () {
const serverInfo = new ServerInfo(Meteor, WebApp, MongoInternals, Facts);
serverInfo.register();
global.serverInfo = serverInfo;
});
That way, any time you recompile the module, you application will notice the JS changes and rebuild/restart itself.
The packages takes configuration from Meteor.settings
, in which it uses the
following server keys:
path
: the path on which the information is made available. Defaults to/serverInfo
, unlike the original version which defaulted to /info
.user
: the user account for the HTTP Basic authentication securing access.insecure
.pass
: the password for the user account. Defaults to secureme
.verbose
: enable console logging. Defaults to false
.eventLoopStrategy
: the strategy to use to instrument the event loop and/or"els"
: a set of event-loop metrics provided by the event-loop-stats"nr"
: inspired by NewRelic "CPU time per tick", an intuitive metricfalse
, the event loop metrics collection is disabled, to keep costs at anMeteorServerInfo
.The package previously included a "cheap" collector based on the PM2 / pebble/event-loop-lag logic, but this has been superseded by the ELS collector.
Metrics exposed by the module can easily be imported to Grafana using the http
plugin and a Telegraf import. Be sure to import data from all your Meteor server
instances, since metrics are reported per-server, not per-database.
Note that since the nr
collector disables the event loop poll phase wait
optimization, the idle ticks/second rate will be around 900 and go lower with
increased load. There is a tradeoff to be done: CPU cost vs accuracy.
The high cost of this strategy is a consequence of the limitations of the Node.JS event loop JavaScript API, requiring workarounds. For accurate metrics with lower metric acquisition cost, a binary agent is required, like the ELS collector, or commercial offerings: AppDynamics, Dynatrace, NewRelic and others offer this type of solution, the tradeoff in that case being CPU cost vs monthly SaaS cost.
As the original percolate:server-info package was licensed under the permissive MIT license, this derivative work has been relicensed under the General Public License version 3 or later (SPDX: GPL-3.0+).
doc/NodeCounters.md
detailing the rationale for the changes since 1.2.5.meteor run
mode on Meteor 1.8.1