Back to Using Logs guides
Metrics SQL queries
Better Stack Team
Updated on November 21, 2023
Metrics SQL queries
List all available metrics and their type:
List metrics
SELECT
name as name,
CASE
WHEN gauge.value IS NOT NULL THEN 'gauge'
WHEN counter.value IS NOT NULL THEN 'counter'
WHEN histogram IS NOT NULL THEN 'histogram'
WHEN summary IS NOT NULL THEN 'summary'
ELSE 'unknown'
END as metric_type,
-- any(tags) as tags
FROM {{source}}
GROUP BY name, metric_type
Got an article suggestion?
Let us know
Make your mark
Join the writer's program
Are you a developer and love writing and sharing your knowledge with the world? Join our guest writing program and get paid for writing amazing technical guides. We'll get them to the right readers that will appreciate them.
Write for usWriter of the month

Marin Bezhanov
Marin is a software engineer and architect with a broad range of experience working...
Build on top of Better Stack
Write a script, app or project on top of Better Stack and share it with the world. Make a public repository and share it with us at our email.
[email protected]or submit a pull request and help us build better products for everyone.
See the full list of amazing projects on github