Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
alsk1992 avatar

Metrics

  • 12 installs
  • 610 repo stars
  • Updated June 26, 2026
  • alsk1992/cloddsbot

metrics is a Claude Code skill that collects and queries system, API, WebSocket, and trade telemetry with alerts, retention, and Prometheus and CSV export.

About

This skill collects system health, API, WebSocket, and trade-execution telemetry for the clodds bot. A developer uses it to track latency percentiles, fill rates, error rates, and custom metrics, then set threshold alerts and export to CSV or Prometheus. It stores metrics with configurable retention and can generate reports and a dashboard.

  • Track system, API, WebSocket, and trade-execution metrics
  • Custom metrics: counters, gauges, timers, histograms
  • Prometheus export, CSV export, alerts, and dashboards

Metrics by the numbers

  • 12 all-time installs (skills.sh)
  • Ranked #978 of 1,435 DevOps & CI/CD skills by installs in the Skillselion catalog
  • Data as of Aug 5, 2026 (Skillselion catalog sync)
At a glance

metrics capabilities & compatibility

Capabilities
telemetry · performance monitoring · metrics export
Works with
grafana
Use cases
data analysis
Runs
Runs locally
Pricing
Free
From the docs

What metrics says it does

Monitor system health, track performance metrics, and analyze telemetry data.
SKILL.md
enablePrometheus: true, prometheusPort: 9090,
SKILL.md
npx skills add https://github.com/alsk1992/cloddsbot --skill metrics

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs12
repo stars610
Last updatedJune 26, 2026
Repositoryalsk1992/cloddsbot

What it does

Collect and query system, API, and trade telemetry, set alerts, and export metrics to Prometheus or CSV.

Who is it for?

Instrumenting and querying performance and trade-execution telemetry

When should I use this skill?

You need latency, fill-rate, or error-rate metrics or a custom metric alert

What you get

Metrics are collected, queryable, alertable, and exportable to Prometheus or CSV.

By the numbers

  • 30d default retention
  • P50/P95/P99 latency tracked

Files

SKILL.mdMarkdownGitHub ↗

Metrics - Complete API Reference

Monitor system health, track performance metrics, and analyze telemetry data.

---

Chat Commands

System Metrics

/metrics                               Show current metrics
/metrics system                        CPU, memory, latency
/metrics api                           API performance stats
/metrics ws                            WebSocket health

Trading Metrics

/metrics trades                        Trade execution stats
/metrics fills                         Fill rate metrics
/metrics latency                       Order latency stats
/metrics errors                        Error rates

Custom Metrics

/metrics track <name> <value>          Track custom metric
/metrics query <name>                  Query metric history
/metrics alert <name> > 100            Set metric alert

Export & Reports

/metrics export csv                    Export to CSV
/metrics report daily                  Generate daily report
/metrics dashboard                     Open metrics dashboard

---

TypeScript API Reference

Create Metrics Service

import { createMetricsService } from 'clodds/metrics';

const metrics = createMetricsService({
  // Collection
  collectInterval: 5000,  // ms
  retention: '30d',

  // Storage
  storage: 'sqlite',
  dbPath: './metrics.db',

  // Export
  enablePrometheus: true,
  prometheusPort: 9090,
});

// Start collection
await metrics.start();

System Metrics

const system = await metrics.getSystemMetrics();

console.log('=== System Health ===');
console.log(`CPU Usage: ${system.cpuUsage}%`);
console.log(`Memory: ${system.memoryUsed}MB / ${system.memoryTotal}MB`);
console.log(`Uptime: ${system.uptimeHours}h`);
console.log(`Active connections: ${system.activeConnections}`);
console.log(`Event loop lag: ${system.eventLoopLag}ms`);

API Metrics

const api = await metrics.getApiMetrics();

console.log('=== API Performance ===');
console.log(`Total requests: ${api.totalRequests}`);
console.log(`Requests/sec: ${api.requestsPerSecond}`);
console.log(`Avg latency: ${api.avgLatency}ms`);
console.log(`P50 latency: ${api.p50Latency}ms`);
console.log(`P95 latency: ${api.p95Latency}ms`);
console.log(`P99 latency: ${api.p99Latency}ms`);
console.log(`Error rate: ${api.errorRate}%`);

console.log('\nBy Endpoint:');
for (const endpoint of api.byEndpoint) {
  console.log(`  ${endpoint.path}: ${endpoint.avgLatency}ms (${endpoint.calls} calls)`);
}

WebSocket Metrics

const ws = await metrics.getWebSocketMetrics();

console.log('=== WebSocket Health ===');
console.log(`Active connections: ${ws.activeConnections}`);
console.log(`Messages/sec: ${ws.messagesPerSecond}`);
console.log(`Avg message size: ${ws.avgMessageSize} bytes`);
console.log(`Reconnections: ${ws.reconnections}`);
console.log(`Dropped messages: ${ws.droppedMessages}`);

console.log('\nBy Feed:');
for (const feed of ws.byFeed) {
  console.log(`  ${feed.name}: ${feed.messagesPerSecond}/s, ${feed.latency}ms lag`);
}

Trade Execution Metrics

const trades = await metrics.getTradeMetrics();

console.log('=== Trade Execution ===');
console.log(`Total orders: ${trades.totalOrders}`);
console.log(`Fill rate: ${trades.fillRate}%`);
console.log(`Partial fills: ${trades.partialFillRate}%`);
console.log(`Rejections: ${trades.rejectionRate}%`);
console.log(`Avg fill time: ${trades.avgFillTime}ms`);
console.log(`Avg slippage: ${trades.avgSlippage}%`);

console.log('\nBy Platform:');
for (const platform of trades.byPlatform) {
  console.log(`  ${platform.name}:`);
  console.log(`    Fill rate: ${platform.fillRate}%`);
  console.log(`    Avg latency: ${platform.avgLatency}ms`);
}

Latency Breakdown

const latency = await metrics.getLatencyBreakdown();

console.log('=== Latency Breakdown ===');
console.log(`Total order latency: ${latency.total}ms`);
console.log(`  Signal processing: ${latency.signalProcessing}ms`);
console.log(`  Order construction: ${latency.orderConstruction}ms`);
console.log(`  Network round-trip: ${latency.networkRoundTrip}ms`);
console.log(`  Exchange processing: ${latency.exchangeProcessing}ms`);
console.log(`  Confirmation: ${latency.confirmation}ms`);

Error Metrics

const errors = await metrics.getErrorMetrics();

console.log('=== Error Rates ===');
console.log(`Total errors: ${errors.totalErrors}`);
console.log(`Error rate: ${errors.errorRate}%`);
console.log(`Errors/hour: ${errors.errorsPerHour}`);

console.log('\nBy Type:');
for (const type of errors.byType) {
  console.log(`  ${type.name}: ${type.count} (${type.percentage}%)`);
}

console.log('\nBy Platform:');
for (const platform of errors.byPlatform) {
  console.log(`  ${platform.name}: ${platform.errorRate}%`);
}

Custom Metrics

// Track custom metric
metrics.track('edge_detected', 1, {
  market: 'trump-2028',
  edgeSize: 0.05,
});

// Increment counter
metrics.increment('trades_executed');

// Set gauge
metrics.gauge('active_positions', 5);

// Record timing
const timer = metrics.startTimer('order_execution');
// ... execute order ...
timer.end();

// Histogram
metrics.histogram('slippage', 0.003, {
  platform: 'polymarket',
});

Query Metrics

const query = await metrics.query({
  metric: 'edge_detected',
  period: '7d',
  aggregation: 'sum',
  groupBy: 'market',
});

console.log('Edge Detection by Market:');
for (const row of query.results) {
  console.log(`  ${row.market}: ${row.value} detections`);
}

Metric Alerts

// Set alert threshold
metrics.setAlert({
  metric: 'error_rate',
  condition: '>',
  threshold: 5,  // > 5% error rate
  window: '5m',
  action: 'notify',
});

metrics.setAlert({
  metric: 'latency_p99',
  condition: '>',
  threshold: 1000,  // > 1000ms
  window: '1m',
  action: 'escalate',
});

// Alert handlers
metrics.on('alert', (alert) => {
  console.log(`🚨 Alert: ${alert.metric} ${alert.condition} ${alert.threshold}`);
  console.log(`  Current value: ${alert.currentValue}`);
});

Export Metrics

// Export to CSV
await metrics.export({
  format: 'csv',
  metrics: ['api_latency', 'trade_fill_rate', 'error_rate'],
  period: '30d',
  outputPath: './metrics-export.csv',
});

// Export to Prometheus
const prometheusFormat = metrics.toPrometheus();

// Export to JSON
const jsonMetrics = await metrics.toJSON({
  period: '24h',
});

Generate Reports

const report = await metrics.generateReport({
  type: 'daily',
  include: ['summary', 'api', 'trades', 'errors'],
});

console.log('=== Daily Metrics Report ===');
console.log(`Date: ${report.date}`);
console.log(`\nSummary:`);
console.log(`  Uptime: ${report.summary.uptime}%`);
console.log(`  Total requests: ${report.summary.totalRequests}`);
console.log(`  Total trades: ${report.summary.totalTrades}`);
console.log(`  Error rate: ${report.summary.errorRate}%`);
console.log(`\nHighlights:`);
for (const highlight of report.highlights) {
  console.log(`  - ${highlight}`);
}

Real-time Streaming

// Stream metrics in real-time
const stream = metrics.stream(['cpu', 'memory', 'latency']);

stream.on('data', (data) => {
  console.log(`CPU: ${data.cpu}%, Memory: ${data.memory}MB, Latency: ${data.latency}ms`);
});

// Stop streaming
stream.stop();

---

Metric Types

TypeDescriptionExample
CounterMonotonic increasingtrades_total
GaugePoint-in-time valueactive_positions
HistogramDistributionlatency_ms
TimerDuration measurementorder_execution_time

---

Built-in Metrics

CategoryMetrics
Systemcpu_usage, memory_used, uptime, connections
APIrequest_count, latency_p50/p95/p99, error_rate
WebSocketmessages_per_sec, lag, reconnections
Tradesorders_total, fill_rate, slippage, execution_time
Errorserror_count, error_rate_by_type

---

Best Practices

1. Monitor latency percentiles — P99 matters more than average 2. Set alerts proactively — Catch issues before users notice 3. Track custom metrics — Business-specific KPIs 4. Review daily reports — Spot trends early 5. Export for analysis — Use external tools for deep dives

Related skills

FAQ

Can metrics be exported?

Yes, to CSV and to Prometheus on a configurable port.

What custom metric types are supported?

Counters, gauges, timers, and histograms via track, increment, gauge, and histogram.

DevOps & CI/CDmonitoring

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.