# metrics-query

> Claude/Codex skill by [@betterstackhq](https://omgskills.com/library/betterstackhq/index.md) · 4 stars · Updated 2026-10-23

MUST load BEFORE writing any Better Stack metrics SQL query. Better Stack's pre-aggregated metrics dialect (Merge functions, template variables, storage layouts, the ways a query silently blends series) - without it queries fail or return wrong numbers. Also load when the user asks how metrics queries look.

## Install

```sh
git clone https://github.com/BetterStackHQ/claude-plugin /tmp/claude-plugin && ln -s /tmp/claude-plugin/skills/metrics-query ~/.claude/skills/metrics-query
```

## From README

Metrics Query Guide Metrics tables hold pre-aggregated ClickHouse state columns. Below are the facts ClickHouse knowledge does not give you; everything else is standard SQL. Where the query runs Better Stack runs SQL in two places, and the query text differs: Dashboard charts and chart alerts (addcharttodashboard, editchart, createchartalert): write the query as this skill shows it, with the template variables {{source}}, {{time}}, {{starttime}} and {{endtime}}. The dashboard resolves them. Chart queries always read the source's metrics collection. Ad-hoc queries (query, renderchart): there are no template variables. First call the help tool for the data type with the source ID (queryhelp for logs and spans, metricsqueryhelp for metrics, errorsqueryhelp for errors): it names the source's collections and the table to pass. Put the collection where {{source}} stands (e.g.

## Links

- HTML page: https://omgskills.com/library/betterstackhq/claude-plugin/skills/metrics-query/
- GitHub: https://github.com/BetterStackHQ/claude-plugin
- Author: [@betterstackhq](https://omgskills.com/library/betterstackhq/index.md)

## More from this repo

- [chart-alerts](https://omgskills.com/library/betterstackhq/claude-plugin/skills/chart-alerts/index.md) — Guide for creating and managing Better Stack chart alerts.
   - [@betterstackhq](https://omgskills.com/library/betterstackhq/index.md) · 4 stars
- [chart-generation](https://omgskills.com/library/betterstackhq/claude-plugin/skills/chart-generation/index.md) — Complete reference for chart types, units, and settings on Better Stack dashboards.
   - [@betterstackhq](https://omgskills.com/library/betterstackhq/index.md) · 4 stars
- [chart-styling](https://omgskills.com/library/betterstackhq/claude-plugin/skills/chart-styling/index.md) — Better Stack chart styling and advanced settings reference - series colors and order, number chart coloring thresholds,...
   - [@betterstackhq](https://omgskills.com/library/betterstackhq/index.md) · 4 stars
