catalyx-agent-node
v0.0.1
Published
π§ Node.js SDK for Catalyx.dev - the world's smartest AI performance engineer for your app.
Readme
catalyx-agent-node
π§ Node.js SDK for Catalyx.dev β the world's smartest AI performance engineer for your stack.
π What is Catalyx?
Catalyx.dev transforms traditional monitoring into context-aware, AI-powered performance engineering.
It connects deeply to your stack β from APIs to databases β to:
π Diagnose latency and performance bottlenecks
π§ Suggest contextual, actionable fixes
π¬ Enable a natural-language developer agent for questions like:
βWhy is the
/checkoutAPI slow?β βHow do I fix this query?β
Soon, Catalyx will also offer safe auto-fix PRs powered by LLMs and static analysis.
π¦ What is catalyx-agent-node?
catalyx-agent-node is the official Node.js agent SDK for integrating Catalyx telemetry into your apps.
It uses OpenTelemetry under the hood to:
- Auto-instrument APIs and DB calls
- Send anonymized, structured telemetry to the Catalyx Gateway (via OTLP exporter)
- Provide plug-and-play middleware for popular frameworks like Express, Fastify, NestJS
β¨ Features
- β±οΈ Request-level latency tracking (via OpenTelemetry)
- π€ Automatic batch trace export to the Catalyx backend
- π§© Plug-and-play middleware for Express (Fastify, NestJS coming soon)
- ποΈ Optional DB wrappers for
pg,mysql,mongodb, etc. - π Dynamic instrumentation loader β only instruments libraries you already use
- βοΈ Configurable service name, environment, and gateway
- π¦ Framework-agnostic + zero vendor lock-in
π§ OpenTelemetry in catalyx-agent-node
Catalyx wraps the OpenTelemetry Node SDK to make setup zero-config while keeping all the power.
| Concept | Role in Catalyx |
| -------------------- | ----------------------------------------------------------------------------------- |
| Provider | Uses NodeSDK to initialize TracerProvider & MeterProvider with sane defaults |
| Instrumentations | Auto-loaded dynamically for HTTP servers, DB clients, etc. No manual install needed |
| Processor | Uses BatchSpanProcessor for efficient trace batching |
| Exporter | Uses OTLPTraceExporter (HTTP/gRPC) to send to Catalyx Gateway |
| Collector | Catalyx Collector (self-hosted or cloud) receives OTLP data and enriches it |
Flow:
π Example setup (with Express+Postgres)
npm install catalyx-agent-nodeimport { startCatalyxTelemetry } from 'catalyx-agent-node';
import { catalyxMiddleware } from 'catalyx-agent-node/express';
import { catalyxWrapper } from 'catalyx-agent-node/postgres';
import {express} 'express';
import {pg} from 'pg';
await startCatalyxTelemetry({
service: process.env.CATALYX_SERVICE_NAME || 'my-api',
env: process.env.CATALYX_ENV || 'development',
gatewayUrl: process.env.CATALYX_GATEWAY_URL,
debug: true,
database: {
slowQueryThresholdMs: 50, // Low threshold for easy testing
enableN1Detection: true,
n1ThresholdCount: 3, // Detect after 3 similar queries
postgres: {
captureExplainPlans: true,
},
},
framework: {
slowRequestThresholdMs: 200, // Low threshold for easy testing
},
});
const pool = new pg.Pool();
const db = catalyxWrapper(pool);
const app = express();
const PORT = process.env.PORT || 3000;
app.use(catalyxMiddleware());π§ Telemetry Payload (Example)
The agent emits OpenTelemetry traces β Catalyx enriches them before analysis:
{
"service": "user-service",
"env": "production",
"language": "nodejs",
"framework": "express",
"route": "/checkout",
"method": "GET",
"status_code": 200,
"latency_ms": 1842,
"timestamp": "2025-08-06T10:22:13Z",
"db_queries": [
{
"query": "SELECT * FROM orders WHERE user_id = $1",
"duration_ms": 750,
"rows_returned": 500
}
]
}π§ Configuration Options
| Option | Type | Description |
| ------------ | --------- | --------------------------------- |
| service | string | Your microservice name |
| env | string | Environment (e.g., dev, prod) |
| gatewayUrl | string | Catalyx ingestion endpoint (OTLP) |
| debug | boolean | Enable verbose logging |
π§° Supported Adapters
| Framework | Status | Module |
| --------- | -------- | ----------------------- |
| Express | β
Ready | express/middleware.ts |
| Fastify | π οΈ Soon | fastify/plugin.ts |
| NestJS | π οΈ Soon | nestjs/interceptor.ts |
| Koa | π | |
| Hapi | π | |
π Supported DB Instrumentation
| DB Library | Status | Notes |
| ---------- | -------- | ------------------------------ |
| pg | β
Ready | Auto-wrapped using OTel hooks |
| Prisma | π οΈ Soon | Requires custom client tracing |
| MongoDB | π | Planned |
| MySQL | π | Planned |
π§ Why OpenTelemetry?
Catalyx uses OpenTelemetry as the universal trace collection layer, enabling:
- Unified cross-language telemetry
- Minimal vendor lock-in
- Easy extensibility
- Seamless integration with other tools
π§ͺ Example Use Case
Your /checkout route is slow.
Catalyx sees:
- HTTP latency is 1800ms
- 90% of time spent in a large
pgquery- Suggests index optimization on
orders.user_id
You ask the Copilot: "Why is checkout slow?"
It replies: "Query X takes 1.2s and returns 5k rows. Indexing this column would reduce that by ~85%."
