uptimeclarity:agent

v1.1.1Published 13 hours ago

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

OptionDefaultDescription
apiKey(required)UptimeClarity API key.
appName(required)Identifier for this app in the dashboard.
environmentNODE_ENV === 'production' ? 'production' : 'development'Deployment label stamped on every event so dev and prod traffic can be filtered separately under a single API key.
endpointhttps://api.uptimeclarity.comOverride for self-hosted / dev workers.
sampleRate1.0Sampling rate (0.0–1.0).
flushInterval10000Transport flush cadence in ms.
trackMethodstrueInstrument Meteor.methods.
trackPublicationstrueInstrument Meteor.publish.
trackMongotrueInstrument Mongo.Collection operations.
trackEventLooptrueSample event-loop lag every 5s; reports if >50ms.

What it tracks

  • Methods — duration of every Meteor.method call, 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).
  • MongoDBfind, findOne, insert, update, remove, upsert per collection, with a structural query fingerprint (values redacted) and a slow flag for queries > 200 ms.
  • Event loop lagsetImmediate round-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.