uptimeclarity:agent
UptimeClarity monitoring agent for Meteor 2.x and 3.x applications.
Instruments Meteor methods, publications, MongoDB queries, and event-loop lag, and ships batched telemetry to the UptimeClarity ingest API.
Install
meteor add uptimeclarity:agent
Quickstart
1// server/main.js 2import { Meteor } from 'meteor/meteor'; 3import { UptimeClarity } from 'meteor/uptimeclarity:agent'; 4 5Meteor.startup(() => { 6 UptimeClarity.start({ 7 apiKey: process.env.UPTIMECLARITY_API_KEY, 8 appName: 'my-app', 9 }); 10});
Generate an API key in the UptimeClarity dashboard at
https://uptimeclarity.com and expose it to the server as
UPTIMECLARITY_API_KEY (or any env var of your choice).
Configuration
| Option | Default | Description |
|---|---|---|
apiKey | (required) | UptimeClarity API key. |
appName | (required) | Identifier for this app in the dashboard. |
environment | NODE_ENV === 'production' ? 'production' : 'development' | Deployment label stamped on every event so dev and prod traffic can be filtered separately under a single API key. |
endpoint | https://api.uptimeclarity.com | Override for self-hosted / dev workers. |
sampleRate | 1.0 | Sampling rate (0.0–1.0). |
flushInterval | 10000 | Transport flush cadence in ms. |
trackMethods | true | Instrument Meteor.methods. |
trackPublications | true | Instrument Meteor.publish. |
trackMongo | true | Instrument Mongo.Collection operations. |
trackEventLoop | true | Sample event-loop lag every 5s; reports if >50ms. |
What it tracks
- Methods — duration of every
Meteor.methodcall, including async (Meteor 3.x) and sync handlers, plus errors. - Publications — time from subscription start to
ready()(or the returned promise resolving on Meteor 3.x). - MongoDB —
find,findOne,insert,update,remove,upsertper collection, with a structural query fingerprint (values redacted) and aslowflag for queries > 200 ms. - Event loop lag —
setImmediateround-trip sampled every 5 s; reports any lag > 50 ms.
Methods and publications already registered before UptimeClarity.start()
runs are wrapped retroactively, so import order does not matter.
Stopping the agent
1UptimeClarity.stop();
Flushes any buffered events and clears the event-loop sampler.
Compatibility
- Meteor 2.8+ and Meteor 3.x
- Server-only (the package is not exported to the client)
Development
This package lives inside the uptimeclarity.com monorepo. Unit tests live in
test/ and run under Vitest with mocked meteor/meteor and
meteor/mongo globals:
pnpm --filter uptimeclarity-meteor-agent-tests test
A live integration sandbox (real Meteor 3 app driving every hook) is provided
under packages/meteor-agent-testapp.
License
MIT — see LICENSE.