Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't visualize timeseries from time, category, metric when too many categories #705

Open
Slach opened this issue Jan 10, 2025 · 0 comments
Assignees
Labels
p1 Priority 1
Milestone

Comments

@Slach
Copy link
Collaborator

Slach commented Jan 10, 2025

Use
http://localhost:3000/d/clickhouse-queries-analysis/clickhouse-queries-analysis?orgId=1&from=now-24h&to=now&timezone=utc&var-datasource=P7E099F39B84EA795&var-hostname=$__all&var-query_kind=$__all&var-user=$__all&var-exception_code=$__all&var-query_hash=$__all&var-metric=count%28%29&editPanel=25
for reproduced example (ask me about query_log.native.gz for data samples)

Look errors Too many points to visualize properly.

image

query

with 
   (intDiv(toUInt32(event_time), $interval)) as query_finish,
   (intDiv(toUInt32(query_start_time), $interval)) as query_start,
   arrayMap( i -> ( query_start + i ) * $interval * 1000, range(query_finish - query_start + 1) ) as timestamps
SELECT 
    arrayJoin(timestamps) as t,
    normalized_query_hash,
    ${metric:raw} as m
FROM merge(system,'^query_log')
WHERE 
    event_date BETWEEN toDate($__from / 1000) - INTERVAL 1 DAY AND toDate($__to / 1000) + INTERVAL 1 DAY
    AND event_time BETWEEN toDateTime($__from / 1000) - INTERVAL 20 MINUTE AND  toDateTime($__to / 1000) + INTERVAL 20 MINUTE
    AND type!=1
    $conditionalTest(AND hostName() in ($hostname),$hostname)
    $conditionalTest(AND query_kind in ($query_kind),$query_kind)
    $conditionalTest(AND exception_code in ($exception_code),$exception_code)
    $conditionalTest(AND initial_user in ($user),$user)
    AND normalized_query_hash in [$query_hash]
    AND t BETWEEN $__from  AND $__to
GROUP BY normalized_query_hash, t
ORDER BY count(t) OVER(PARTITION BY normalized_query_hash) DESC, sum(m) OVER(PARTITION BY normalized_query_hash) DESC
LIMIT 200 BY t

query is correct, but during serialize into timeSeries looks like we still do it wrong, even after fixes for #644

@Slach Slach added this to the 3.4.0 milestone Jan 10, 2025
@Slach Slach added the p1 Priority 1 label Jan 10, 2025
Slach added a commit that referenced this issue Jan 10, 2025
Signed-off-by: Eugene Klimov <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
p1 Priority 1
Projects
None yet
Development

No branches or pull requests

2 participants