Hey everyone ![]()
Logging and observability came up at the first maintainers call. It’s the top priority for @hexsprite, and it led the building blocks poll: 6 of its 7 voters picked it. Nothing is decided or planned (3.8 at the earliest): the goal is to agree on what we need before anyone builds it.
What we have today
- The instrumentation package, new in 3.6, opt-in (
meteor add instrumentation), server only. Nine read-only events for methods, publications and DDP connections, with a trace ID on methods and publications (also inInstrumentation.currentContext()). On errors you get a short safe summary (name, message,Meteor.Errorcode and reason), never the original error or its stack. Full disclosure: I wrote the first version (design thread). - The logging package:
Log.info,Log.warn,Log.error, one JSON line per call on stdout in production. You can’t plug your own logger into it, andLog.error(err)with a plainErrorprints neither its message nor its stack. - Method and publication errors skip
Log. When one throws, the undocumentedMeteor._debug(a thin wrapper overconsole.log) logs the stack as plain text. AMeteor.Errorthrown there isn’t logged on the server at all. - An open OpenTelemetry PR turns the instrumentation events into OpenTelemetry spans and metrics.
- APM agents have no public way to wrap a method or publication call, so they patch private parts of Meteor (for example through
montiapm:meteorx), and some catch errors by replacingMeteor._debug. The instrumentation events can’t do that: listeners run outside the method’s async context. And a Meteor update can break an agent (one of my PRs did, in 3.4.1).
What came up on the call
The direction, to check with you here:
- Meteor stays neutral: no logger or APM picked for you, just small hooks that plug into the one your app already uses, on top of the 3.6 instrumentation.
- The original error, with its full stack, reaches your logger along with its trace ID.
- APM agents stop needing packages that reach into Meteor internals (@harry97’s point).
- A first test, from @nachocodoner’s follow-up after the call: follow a failing async method and a Tracker exception, and see where the context gets lost. I’ll run it and post what I find here.
Two quick polls
- Meteor’s logging package (Log)
- console.log, read from my host’s logs
- An npm logger (pino, winston…)
- A Meteor APM agent
- A hosted error tracker
- A general APM or observability platform
- OpenTelemetry, sent to a backend I picked
- The instrumentation package, with my own listeners
- Nothing yet
- Something else (tell me below)
- The original error and its full stack in my logger
- A trace ID that follows the work (nested calls, timers, observers)
- One public hook for Meteor’s own errors
- Server logs for Meteor.Error thrown in methods and publications
- A way to plug my logger into Log
- Client errors: Tracker, Blaze helpers
- A public way for APM agents to wrap methods and publications
- Events for Mongo queries and observers
- Docs on setting up logging and monitoring in production
- Something else (tell me below)
Your turn: one real case
Tell me about a time you lost an error or its context: what happened, your Meteor version, and what you would have needed to find it. Like @hexsprite’s publication error: wrapper frames only in his tracker, no clue which publication threw, and a thread to find why. Three lines are plenty.
@zodern, @mvogt22 and @wreiske: you each build a monitoring agent for Meteor, so your take would help a lot. @hexsprite @harry97, add anything I missed from the call.
What happens next
On Thursday December 10, I’ll gather the replies into a short proposal in this thread, then open a GitHub issue from it. Decisions go to GitHub, like the rest.
Going to be fun building this ![]()