npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@seliseblocks/blocks-lmt-node

v0.0.2

Published

High-performance logging and distributed tracing client with Azure Service Bus integration for Node.js.

Readme

SeliseBlocks LMT Client (Node.js)

Logging + distributed tracing for any Node.js service, exported to the SELISE cloud over Azure Service Bus — set up with one function call. Node.js port of the C# Blocks.LMT.Client.

  • LogsBlocksLogger, Serilog-style message templates, batched + auto-correlated to the active trace.
  • Traces — OpenTelemetry spans for incoming HTTP, outgoing 3rd-party HTTP, Express routes, and MongoDB commands (MongoDb::<command> spans), batched and exported.
  • Transport — Azure Service Bus topic lmt-<serviceId>, with automatic retry + failed-batch queueing.
  • Self-contained — owns all the OpenTelemetry wiring, so your app needs no @opentelemetry/* dependency of its own.

Requires Node ≥ 18.19 (OpenTelemetry 2.x SDK). Full guide: USAGE.md.

Install

npm install blocks-lmt-node

Quick start

// telemetry.js — require this at the VERY TOP of your entry file,
// BEFORE http / express / mongoose are loaded.
const path = require("path");
const { startTelemetry } = require("blocks-lmt-node");

module.exports = startTelemetry({ envPath: path.resolve(__dirname, ".env") });
// anywhere in your app
const lmt = require("./telemetry");

lmt.logger.logInformation("order {id} accepted total {amount}", "A-100", 42);

await lmt.runInSpan("price-calc", async (span) => {
  span.setAttribute("symbol", "BTC");
  return computePrice();
});

startTelemetry() reads config from a .env (or explicit options) and returns: { logger, runInSpan, getActiveTraceId, getActiveSpan, getTracer, instrumentMongoose, shutdown, lmtClient, ... }.

Configuration (.env)

lmt.service-id=YOUR_SERVICE_ID
lmt.connection-string=Endpoint=sb://<ns>.servicebus.windows.net/;SharedAccessKeyName=...;SharedAccessKey=...;EntityPath=lmt-YOUR_SERVICE_ID
lmt.x-blocks-key=YOUR_TENANT_KEY
# optional: lmt.log-batch-size=100  lmt.trace-batch-size=1000  lmt.flush-interval-seconds=5
#           lmt.max-retries=3  lmt.max-failed-batches=100  lmt.enable-logging=true  lmt.enable-tracing=true

Keep credentials in .env/secret manager only — never commit them.

What gets traced

| | Automatic? | Setup | |---|---|---| | Incoming HTTP, outgoing 3rd-party HTTP, Express routes | ✅ | none | | MongoDB queries (MongoDb::find, …) | ✅ per query | connect with { monitorCommands: true } + instrumentMongoose(connection) | | Your own business logic | — | wrap in runInSpan(name, fn) |

Logs in a trace's Log tab: a log shows under a trace only if emitted while the root span is active — i.e. log at handler level. Logs inside a runInSpan(...) child appear in the global Logs view but not the trace tab. See USAGE.md §7.

Logging

logger.logTrace / logDebug / logInformation / logWarning(template, ...args);
logger.logError / logCritical(template, errorOrArg, ...args);

Values appear in the message only where there's a {placeholder}; every arg is also stored as Arg0, Arg1, … Keep logs small (don't dump large objects).

Example services (for local testing)

Create a .env with your lmt.* keys, then:

npm run example:start    # logging service  (GET /health, GET /demo)
npm run example:test     # one-shot verification of the logging service
npm run example:trace    # tracing service  (GET /health, GET /trace) on port 3301
npm run example:trace:test

The /trace response includes the generated traceId for locating spans in the lmt-<serviceId> topic / SELISE cloud.

API

  • startTelemetry(options?) — the primary entry point (above). Options: envPath, autoInstrument, instrumentations, ignoreIncomingPaths, registerShutdownHooks, plus explicit LMT fields. See USAGE.md §8.
  • createLmtClient(options) (advanced) — returns { logger, traceProcessor, sender, shutdown } if you want to wire the OpenTelemetry provider yourself.
  • instrumentMongoose(connection) / instrumentMongoClient(client) — attach the MongoDb::<command> span tracer (needs monitorCommands: true).
  • BlocksLogger, LmtLogLevel (TraceCritical), LmtTraceProcessor — exported for advanced use.

Payload compatibility

Sent to topic lmt-<serviceId>:

  • Logs: { Type: "logs", ServiceName, Data: [...] }
  • Traces: { Type: "traces", ServiceName, Data: { [tenantId]: [...] } }

with application properties matching the C# client (serviceName, timestamp, source, type).

Graceful shutdown

startTelemetry() installs SIGINT/SIGTERM flush hooks by default (registerShutdownHooks: true). For an app that owns its own shutdown order, pass registerShutdownHooks: false and call await lmt.shutdown() yourself. See USAGE.md §7–8.

Publish

# bump "version" in package.json first
npm pack --dry-run   # preview the tarball
npm publish

Only src/, README.md, USAGE.md, LICENSE are published (see the files field) — no .env, scripts, or tests.