telemetry-query

Query Fredo's telemetry SQLite database for spans, metrics, and logs via sqlite3.

Updated May 18, 2026
One-click install
npx skills add https://github.com/FredoAi/fredo --skill telemetry-query-fredoai
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: telemetry-query
Source: https://github.com/FredoAi/fredo/tree/main/.opencode/skills/telemetry-query
Command: npx skills add https://github.com/FredoAi/fredo --skill telemetry-query-fredoai

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Diagnosing agent errors, latency issues, and tracing behavior in Fredo requires inspecting OpenTelemetry-style spans, metrics, and logs stored in fredo.db, which is tedious to query manually and risky without read-only safeguards. ## Core Features & Use Cases - Read-only SQL querying: A PowerShell wrapper locates fredo.db, enforces SELECT/PRAGMA-only queries, applies default LIMITs, and runs sqlite3 in readonly mode. - 16 ready-made query recipes: Cover error spans, latency percentiles, session traces, throughput, error rates, retention status, schema inspection, and trace-correlated logs across telemetry_spans, telemetry_metrics, and telemetry_logs tables. - Multiple output formats: JSON for programmatic use, markdown tables for GitHub issues, and plain tables for terminal inspection. - Use Case: An agent debugging a failing session runs the session trace recipe with the session UUID to see the full span hierarchy, then correlates ERROR-level logs by trace_id to pinpoint the failing adapter. ## Quick Start Ask the agent to query the telemetry database for all error spans from the last hour and show the results as a markdown table.

Frequently Asked Questions about telemetry-query

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I query OpenTelemetry spans stored in SQLite?▼

Run the telemetry-query.ps1 wrapper with a SELECT statement against the telemetry_spans table, choosing json, md, or table output. The script locates fredo.db automatically, appends a default LIMIT of 1000, and executes sqlite3 in readonly mode.

How to compute p50 p90 p99 latency from histogram buckets in SQL?▼

Use a CTE that sums histogram bucket counts per span name, computes cumulative counts ordered by bucket upper bound, and selects the first bucket where the cumulative percentage crosses 50, 90, and 99. The skill's Recipe 8 implements this against the telemetry_metrics table.

Where is the fredo.db telemetry database located?▼

The live database is at $env:APPDATA\com.fredo.app\fredo.db on Windows. The wrapper also searches LOCALAPPDATA, ~/.fredo, and performs a recursive scan of common directories, reporting all attempted paths if not found.

Can I run INSERT or UPDATE queries against the telemetry database?▼

No. The wrapper rejects any query containing CREATE, ALTER, DROP, INSERT, UPDATE, or DELETE keywords, and sqlite3 is invoked with the -readonly flag. Only SELECT, WITH (CTE), and specific PRAGMA statements are permitted.

Why does my telemetry query fail with 'no such table: telemetry_logs'?▼

The telemetry_logs table is created only after the Fredo application runs at least once with logging enabled. Launch Fredo to initialize the database schema, then retry the query.