Skip to content

Commit c3705d2

Browse files
committed
bugfix: left join rag_queries_query on events. Sometimes the events
don't get registered due to firewall blocking. We still should display results
1 parent 5204fa8 commit c3705d2

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

server/src/operators/analytics_operator.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1857,11 +1857,11 @@ pub async fn get_topic_queries_query(
18571857
COUNT(rag_queries.id) as message_count,
18581858
AVG(rag_queries.top_score) as top_score,
18591859
AVG(rag_queries.hallucination_score) as hallucination_score,
1860-
AVG(JSONExtract(query_rating, 'rating', 'Nullable(Float64)')) as query_rating,
1860+
AVG(JSONExtract(rag_queries.query_rating, 'rating', 'Nullable(Float64)')) as query_rating,
18611861
groupArray(topic_events.event_name) as event_names
18621862
FROM topics
18631863
JOIN rag_queries ON topics.topic_id = rag_queries.topic_id
1864-
JOIN events as topic_events ON rag_queries.id = toUUID(topic_events.request_id)
1864+
LEFT JOIN events as topic_events ON rag_queries.id = toUUID(topic_events.request_id)
18651865
",
18661866
);
18671867

@@ -1990,13 +1990,12 @@ pub async fn get_topics_over_time_query(
19901990

19911991
let mut query_string = format!(
19921992
"SELECT
1993-
CAST(toStartOfInterval(created_at, INTERVAL {}) AS DateTime) AS time_stamp,
1993+
CAST(toStartOfInterval(created_at, INTERVAL {interval}) AS DateTime) AS time_stamp,
19941994
count(*) AS requests
19951995
FROM
19961996
topics
19971997
JOIN rag_queries ON topics.topic_id = rag_queries.topic_id
1998-
",
1999-
interval
1998+
"
20001999
);
20012000

20022001
if let Some(filter_params) = &filter {

0 commit comments

Comments
 (0)