@assetize/kanban-observability
v1.3.0
Published
Assetize observability SDK for frontend and backend log ingestion.
Readme
@assetize/kanban-observability
Frontend SDK to send browser/runtime errors to Assetize observability ingest.
Install
npm i @assetize/kanban-observabilityUsage
import { installKanbanObservability } from "@assetize/kanban-observability";
const client = installKanbanObservability({
endpoint:
"https://be.kanban.develop.assetize.today/observability/ingest/frontend",
apiKey: "<YOUR_INGEST_KEY>",
environment: import.meta.env.MODE || "production",
release: import.meta.env.VITE_APP_VERSION || "unknown",
appVersion: import.meta.env.VITE_APP_VERSION || "unknown",
captureFrontendErrors: true,
captureFrontendConsole: true,
captureBackendApiCalls: true,
captureBackendApiErrors: true,
frontendErrorSampleRate: 1,
frontendConsoleSampleRate: 1,
apiTargets: ["https://be.kanban.develop.assetize.today"],
});
// Optional manual capture
client.captureException(new Error("Manual check"));Backend (Node/Express)
import express from "express";
import { installKanbanObservabilityNode } from "@assetize/kanban-observability/node";
const app = express();
app.use(express.json());
const observability = installKanbanObservabilityNode({
// You can pass either API base URL or full ingest frontend URL.
endpoint: "https://be.kanban.develop.assetize.today",
apiKey: process.env.OBSERVABILITY_INGEST_KEY!,
environment: process.env.NODE_ENV || "production",
captureBackendApiCalls: true,
captureBackendApiErrors: true,
});
// Request logging middleware
app.use(observability.requestMiddleware());
app.get("/health", (_req, res) => {
res.json({ ok: true });
});
// Error logging middleware (register after routes)
app.use(observability.errorMiddleware());Note: 4xx/5xx HTTP responses are recorded in Backend API errors automatically, even when the route returns an error response without throwing an exception.
The node client sends to:
POST /observability/ingest/backend-api-callPOST /observability/ingest/backend-api-error
Manual usage (for interceptor/filter integrations):
await observability.captureApiCall({ method: "POST", path: "/jobs/run", statusCode: 200, durationMs: 34 });
await observability.captureApiError({ method: "POST", path: "/jobs/run", statusCode: 500, errorType: "Error", message: "failed" });Build
npm run buildprepublishOnly runs the build automatically before publish.
