nept-metrics-core
v1.0.0
Published
Core metrics client for NEPT services backed by ClickHouse
Downloads
109
Maintainers
Readme
nept-metrics-core
A dedicated, type-safe Node.js module for handling NEPT metrics, backed by ClickHouse.
Features
- Type-Safe: Built with TypeScript and Zod for robust data validation.
- ClickHouse Integration: Direct ingestion and querying using
@clickhouse/client. - Distributed: Designed to be used across multiple microservices.
Installation
npm install nept-metrics-coreUsage
import { NeptMetrics } from "nept-metrics-core";
// Initialize client
const metrics = new NeptMetrics(
"http://localhost:8123",
"default",
"password",
"nept_metrics",
);
// Ingest a log
await metrics.ingestLog({
id: crypto.randomUUID(),
timestamp: new Date().toISOString(),
level: "info",
message: "User logged in",
source: "auth-service",
projectId: "project-123",
});
// Query metrics
const requestVolume = await metrics.getRequestVolume(
"project-123",
new Date("2023-01-01"),
new Date(),
);Data Models
- Logs
- Request Metrics (Volume)
- Latency Metrics
- Bandwidth Metrics
- Asset Distribution
