mz-query-tracing
Skill by MaterializeInc
Debugs SQL execution time in a local Materialize instance using OpenTelemetry traces in Tempo. Aimed at developers who want to find which spans take the most time in a slow query.
Install mz-query-tracing
Built from the published package, never by AI.
git clone --depth 1 https://github.com/MaterializeInc/materialize /tmp/materialize && mkdir -p ~/.claude/skills && cp -r /tmp/materialize/.agents/skills/mz-query-tracing ~/.claude/skills/mz-query-tracingRun in your terminal. Claude Code loads skills from ~/.claude/skills automatically.
git clone --depth 1 https://github.com/MaterializeInc/materialize /tmp/materialize && mkdir -p ~/.gemini/antigravity-cli/skills && cp -r /tmp/materialize/.agents/skills/mz-query-tracing ~/.gemini/antigravity-cli/skills/mz-query-tracingAntigravity CLI loads skills from ~/.gemini/antigravity-cli/skills, or .agents/skills for one project.
Skills can run scripts on your machine. Some need an API key: check the README.
About
The mz-query-tracing skill helps an assistant find where time goes when a SQL statement runs in a local Materialize instance. It starts the local monitoring stack (Tempo, Grafana and Prometheus), then runs a statement through psql with emit_trace_id_notice enabled to capture the query's trace ID.
The skill fetches the trace from the Tempo HTTP API on port 3200 and runs a trace_tree.py script to analyze it, ranking spans by self-time. It also explains common spans, such as persist appends, catalog transactions, timestamp oracle calls and consensus operations. It is written for developers debugging slow queries or DDL in Materialize, and it recommends tracing optimized builds.
Written from the project's SKILL.md and checked against it.
What it can do
- Capture trace IDsRuns a SQL statement with trace ID notices enabled and extracts the trace ID for the query.
- Fetch traces from TempoQueries the Tempo HTTP API on port 3200 and retries until the trace is available.
- Analyze span self-timeUses trace_tree.py to show where time is spent in the trace tree.
- Set trace filtersSets the opentelemetry_filter system parameter at startup or at runtime as mz_system.
- Interpret common spansExplains spans such as group_commit_apply::append_fut, oracle::write_ts and coord::check_consistency.
- Compare buildsTraces the same query on two builds and compares self-time rankings side by side.
What you need
- Local Materialize repository with bin/environmentd and bin/mzcompose
- Tempo, Grafana and Prometheus monitoring stack
- psql client
- Python 3
- curl
Try asking
- Why is this query slow? Trace it and show where the time goes.
- Fetch the Tempo trace for trace ID fd2f69eb059e4823d8d48a87ccab8f6f and rank spans by self-time.
- Set opentelemetry_filter to debug and trace my CREATE TABLE statement.
Good to know
- Tempo keeps traces for only 15 minutes by default.
- Spans emitted before Tempo is ready are dropped.
- Debug builds can make self-times misleading, so trace --optimized builds.
- All network calls require dangerouslyDisableSandbox.
Security check
ANo download-and-run commands, hidden instructions or signs of sending keys out were found.
Checked automatically: .agents/skills/mz-query-tracing/SKILL.md. This looks for known risky patterns and is not a full audit. How grades work
Alternatives to mz-query-tracing
All alternatives →Runs a 7-stage workflow for auditing, cleaning up and reviewing GitHub repositories, plus competitor analysis. Written for developers who want a repo checked for secrets, junk files and documentation gaps.
Teaches an AI assistant to build, debug and explain Gradio web UIs and ML demos in Python. It covers the core API, components, event listeners, layouts and the MCP server option. Aimed at Python developers who work with Gradio.
Recommends menus, buttons, toolbars and disclosure controls for Apple platforms using Human Interface Guidelines conventions. Built for developers and designers making iOS, iPadOS, macOS or visionOS interfaces. Checks existing project design context before asking questions.
Creates production-ready FastAPI project structures with async patterns, dependency injection, and error handling. It is for developers starting new FastAPI applications or backend API projects.
Analyzes Android apps to find user workflows to expose as AppFunctions, so AI agents and system shortcuts can run them without opening the app UI. Generates Kotlin code and refines KDoc for Android developers.
Creates, edits, validates and runs Agent QA tests, suites and hooks through MCP or CLI. It keeps canonical IDs and schema contracts intact, for developers and QA teams using Agent QA.
Compare with openclaw-github-repo-commander, gradio or hig-components-menus
mz-query-tracing: common questions
Why does the first trace fetch return trace not found?
The source says spans may still be in flight and ingestion adds latency. It recommends a retry loop with a short wait.
Which build should I trace?
The source says to always trace --optimized builds, because debug builds add unoptimized code and debug checks that inflate self-times.
Where can I view traces visually?
The source says traces can be viewed in Grafana at http://localhost:3000 by searching for the trace ID in the Tempo datasource explore view.
How do I install mz-query-tracing?
Run the command above to copy the skill into ~/.claude/skills/. Claude Code picks it up automatically.
Is mz-query-tracing free?
The code is published under the NOASSERTION licence. The service it connects to may have its own pricing.
Is mz-query-tracing safe to use?
It scores 76 of 100. Grades: maintenance A, licence F, quality A. Security check: grade A, no risky patterns found in the files checked. Review the code before you install. How grades work.
What are alternatives to mz-query-tracing?
Similar skills: openclaw-github-repo-commander, gradio, hig-components-menus, fastapi-templates.
