Skills

Skill Metrics

Every skill execution is recorded to the skill_metrics table. The GET /skills/:id/metrics endpoint exposes aggregated p50 and p95 latency, error rate, and top tool and user breakdowns over the last 30 days.

Endpoint

GET /skills/:id/metrics

Requires authentication. Returns a SkillMetricsSummary object.

Response type

typescript
interface SkillMetricsSummary {
  skillId: string
  totalCalls: number
  errorRate: number           // 0.0 – 1.0
  p50Ms: number               // median latency in ms
  p95Ms: number               // 95th percentile latency in ms
  topTools: Array<{
    toolName: string
    calls: number
  }>
  topUsers: Array<{
    uid: string
    calls: number
  }>
}

Example request

bash
curl -H "Authorization: Bearer $TOKEN" \
  https://your-astra-host/skills/advanced_research/metrics

Example response

json
{
  "skillId": "advanced_research",
  "totalCalls": 412,
  "errorRate": 0.024,
  "p50Ms": 1840,
  "p95Ms": 6210,
  "topTools": [
    { "toolName": "web_search", "calls": 387 },
    { "toolName": "fetch_page", "calls": 201 }
  ],
  "topUsers": [
    { "uid": "user_abc", "calls": 145 },
    { "uid": "user_xyz", "calls": 98 }
  ]
}

skill_metrics table

sql
CREATE TABLE skill_metrics (
  skill_id    TEXT NOT NULL,
  uid         TEXT NOT NULL,
  tool_name   TEXT,
  duration_ms INTEGER NOT NULL,
  error       TEXT,
  timestamp   TIMESTAMPTZ DEFAULT NOW()
);
Metrics cover the last 30 days. Older records are not included in p50/p95 calculations but are retained in the table. errorRate is the fraction of calls where error IS NOT NULL.