Skip to main content

Subscription Monitoring

Monitor your Meteor DDP subscriptions with detailed performance metrics.

What Gets Tracked

For each subscription, SkySignal captures:

FieldDescription
subscriptionNameThe name of the publication
responseTimeTime to initial data delivery
documentsAddedNumber of documents sent
documentsChangedDocuments updated during subscription
documentsRemovedDocuments removed during subscription
dataTransferredApproximate bytes transferred
userIdThe subscribing user
timestampWhen the subscription started

Viewing Subscription Data

Subscriptions Dashboard

Navigate to your site's Pub/Sub tab to see:

  • Active Subscriptions - Currently active subscription count
  • Response Time Trends - Historical performance data
  • Top Subscriptions - Most frequently used publications
  • Data Transfer - Bandwidth usage by subscription

Subscription Details

Click on any subscription to view:

  • Average response time and percentiles
  • Document count statistics
  • Data transfer metrics
  • Sample subscription instances

Configuration

Enable/Disable Subscription Tracking

{
"skysignal": {
"apiKey": "sk_live_xxx",
"trackSubscriptions": true
}
}

Ignore Specific Subscriptions

Exclude subscriptions from tracking in your settings.json:

{
"skysignal": {
"apiKey": "sk_live_xxx",
"ignoreSubscriptions": [
"meteor.loginServiceConfiguration",
"^internal\\."
]
}
}

Understanding Metrics

Response Time

The time from subscription request to onReady() callback:

// In your client code
Meteor.subscribe('posts', function onReady() {
// SkySignal measures time until this callback fires
});

Document Metrics

  • Added - Initial documents sent when subscription starts
  • Changed - Updates pushed to the client
  • Removed - Documents removed from the subscription

Data Transfer

Estimated bytes transferred, calculated from:

  • EJSON-serialized document size
  • Number of documents sent

Performance Insights

Identifying Large Subscriptions

Watch for subscriptions with:

  • High documentsAdded counts (sending too much data initially)
  • Large dataTransferred values
  • Long response times

Common Issues

Subscription sends too many documents

// Bad: Publishes all posts
Meteor.publish('posts', function() {
return Posts.find(); // Could be thousands of documents!
});

// Good: Limit and paginate
Meteor.publish('posts', function(limit = 20) {
check(limit, Number);
return Posts.find({}, {
limit: Math.min(limit, 100),
sort: { createdAt: -1 }
});
});

Subscription is slow to become ready

Common causes:

  • Large initial dataset
  • Missing database indexes
  • Complex publication logic

Best Practices

1. Paginate Large Collections

Never send all documents at once:

Meteor.publish('posts.paginated', function(page = 1, limit = 20) {
check(page, Number);
check(limit, Number);

const skip = (page - 1) * limit;
return Posts.find({}, {
skip,
limit: Math.min(limit, 100),
sort: { createdAt: -1 }
});
});

2. Use Field Filtering

Only publish needed fields:

Meteor.publish('users.list', function() {
return Meteor.users.find({}, {
fields: {
username: 1,
'profile.avatar': 1,
// Don't send emails, settings, etc.
}
});
});

3. Index Your Queries

Ensure MongoDB indexes exist for your publication queries:

// In your collection file
Posts.createIndex({ createdAt: -1 });
Posts.createIndex({ authorId: 1, createdAt: -1 });

4. Consider Publication Merging

For complex UIs, consider using reywood:publish-composite:

Meteor.publishComposite('postWithAuthor', function(postId) {
return {
find() {
return Posts.find({ _id: postId });
},
children: [{
find(post) {
return Meteor.users.find({ _id: post.authorId }, {
fields: { username: 1, 'profile.avatar': 1 }
});
}
}]
};
});

Live Query Monitoring

SkySignal tracks Meteor's reactive query observers (live queries) as a separate concern from pub/sub. While subscriptions deal with the DDP layer between server and client, live queries are the underlying MongoDB observers that keep subscription data reactive on the server side.

Observer Types

The agent detects three observer types for each live query:

TypeDescription
Change StreamUses MongoDB Change Streams. Available on Meteor 3.5+ with a replica set. The most efficient approach for most workloads.
OplogTails the MongoDB oplog for real-time change detection. The standard driver for Meteor 3.0 through 3.4.
PollingFalls back to periodic re-querying when oplog/change stream support is unavailable (e.g., unsupported query operators). Least efficient.

How Detection Works

For Meteor 3.5+ apps using MongoDB Change Streams, the agent performs per-observer introspection. It checks each observer's internal driver via handle._multiplexer._observeDriver.constructor.name to determine whether it is backed by a change stream, oplog, or polling driver.

For apps on Meteor 3.0-3.4, the agent uses the presence of MONGO_OPLOG_URL as a heuristic to distinguish oplog from polling observers.

Reactive Efficiency

The Reactive Efficiency metric tells you what percentage of your observers are using efficient reactive strategies:

Reactive Efficiency = (changeStream + oplog) / total

A value of 1.0 means every observer is using change streams or oplog tailing. A lower value means some observers have fallen back to polling, which you should investigate -- usually it is caused by unsupported query operators or a missing replica set.

Configuration

Live query collection is enabled by default. To disable it, update your settings.json:

{
"skysignal": {
"apiKey": "sk_live_xxx",
"collectLiveQueries": false
}
}

Dashboard

The Live Queries tab in the site detail view shows:

  • Observer counts broken down by type (change stream, oplog, polling)
  • Driver statistics and observer lifecycle events
  • Reactive efficiency metric over time
  • Individual observer details with associated publication names

Troubleshooting

Subscriptions Not Tracked

  1. Verify trackSubscriptions: true
  2. Check if subscription is in ignoreSubscriptions
  3. Ensure the agent is configured and loaded before publications are defined

Inaccurate Document Counts

Document counts may not match exactly if:

  • Documents are added/removed during the subscription lifecycle
  • Multiple publications affect the same collection

Live Queries Not Appearing

  1. Verify collectLiveQueries is not set to false
  2. Confirm you are running Meteor 3.0 or later
  3. For change stream detection, ensure your MongoDB deployment is a replica set and you are on Meteor 3.5+

Next Steps