Overview
Introduction to Lit Status monitoring system
Lit Status Monitoring System
Lit Status is an internal uptime and error monitoring system designed for tracking named functions and endpoints across different networks and products. Built with TypeScript, Bun, Prisma, and PostgreSQL.
Key Features
- Function Monitoring: Track uptime and errors for named functions across networks
- Historical Metrics: Store and query execution data with efficient indexing
- Network Organisation: Organise functions by network (mainnet, testnet, etc.) and product
- Response Time Tracking: Monitor performance with millisecond precision
- Scalable Architecture: Connection pooling and optimized database queries
- Built-in Metrics Export: Prometheus and JSON format metrics export
- OpenTelemetry Integration: Client-side distributed tracing, metrics, and structured logging
- TypeScript SDK: Type-safe client library for easy integration
- REST API: Complete HTTP API for custom implementations
Architecture
┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
│ Your App │ │ Lit Status │ │ PostgreSQL │
│ │───▶│ Server │───▶│ Database │
│ (Using SDK) │ │ (Express) │ │ (Prisma) │
└─────────────────┘ └─────────────────┘ └─────────────────┘
│ │
│ ┌─────────────────┐
└─────────────▶│ Monitoring │
│ Systems │
│(Prometheus/JSON)│
└─────────────────┘ Core Concepts
Monitored Functions
Functions are uniquely identified by three fields and stored in the MonitoredFunction Prisma model:
- Name: The function identifier (e.g., "sendTransaction")
- Network: The blockchain/network (e.g., "mainnet", "testnet")
- Product: The product/service (e.g., "lit-node", "vincent-registry")
Database Table Structure:
CREATE TABLE "MonitoredFunction" (
"id" TEXT NOT NULL,
"name" TEXT NOT NULL,
"network" TEXT NOT NULL,
"product" TEXT NOT NULL,
"description" TEXT,
"isActive" BOOLEAN NOT NULL DEFAULT true,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL,
CONSTRAINT "MonitoredFunction_pkey" PRIMARY KEY ("id"),
CONSTRAINT "MonitoredFunction_name_network_product_key" UNIQUE ("name", "network", "product")
);Execution Logs
Each function execution is logged in the FunctionLog Prisma model with:
- Success/Failure: Boolean status
- Response Time: Duration in milliseconds
- Error Message: Details when execution fails
- Timestamp: When the execution occurred
Database Table Structure:
CREATE TABLE "FunctionLog" (
"id" TEXT NOT NULL,
"functionId" TEXT NOT NULL,
"isSuccess" BOOLEAN NOT NULL,
"errorMessage" TEXT,
"responseTimeMs" INTEGER,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
CONSTRAINT "FunctionLog_pkey" PRIMARY KEY ("id"),
CONSTRAINT "FunctionLog_functionId_fkey" FOREIGN KEY ("functionId") REFERENCES "MonitoredFunction" ("id") ON DELETE RESTRICT ON UPDATE CASCADE
);Metrics
The system provides:
- Uptime Percentage: Success rate over time
- Average Response Time: Performance metrics
- Execution Counts: Total, successful, and failed executions
- Time-Series Data: Bucketed metrics for charting
Getting Started
Backend Setup & Administration
Quick Start
Set up the Lit Status server and database
Authentication
Configure API keys and permissions
Observability & Monitoring
Built-in metrics export and monitoring
Client & API Usage
Use Cases
- Uptime Monitoring: Track critical function availability
- Performance Analysis: Monitor response times and identify bottlenecks
- Error Tracking: Capture and analyse failure patterns
- SLA Reporting: Generate uptime reports for internal teams
- Observability: Integrate with existing monitoring infrastructure via server-side metrics export and client-side OpenTelemetry