Created
October 15, 2025 07:42
-
-
Save GUIpsp/3133d558381c726984fa4e37801792e2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| SELECT | |
| JSONExtractString(labels, 'hostname') as hostname, | |
| argMax(JSONExtractString(labels, 'your_tag_name'), value) as tag_from_max, | |
| max(value) as max_value | |
| FROM signoz_metrics.distributed_samples_v2 | |
| WHERE | |
| metric_name = 'your_metric_name' | |
| AND timestamp_ms >= {{.start_time}} | |
| AND timestamp_ms <= {{.end_time}} | |
| GROUP BY JSONExtractString(labels, 'hostname') | |
| ORDER BY max_value DESC |
Author
GUIpsp
commented
Oct 15, 2025
Author
SELECT
JSONExtractString(labels, 'host.name') AS hostname,
argMax(JSONExtractString(labels, 'current_program_scene'), (unix_milli, value)) AS current_program_scene,
max(unix_milli) AS latest_timestamp,
argMax(value, (unix_milli, value)) AS value_at_latest
FROM signoz_metrics.distributed_samples_v4
INNER JOIN
(
SELECT DISTINCT
fingerprint,
labels
FROM signoz_metrics.distributed_time_series_v4
WHERE (metric_name = 'scene_info')
AND (unix_milli >= intDiv({{.start_timestamp_ms}}, 3600000) * 3600000)
AND (unix_milli < {{.end_timestamp_ms}})
) AS filtered_time_series USING (fingerprint)
WHERE (metric_name = 'scene_info')
AND (unix_milli >= {{.start_timestamp_ms}})
AND (unix_milli < {{.end_timestamp_ms}})
GROUP BY JSONExtractString(labels, 'host.name')
ORDER BY hostname ASC
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment