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

Update clickhouse query to /views/now #187

Merged
merged 1 commit into from
Mar 25, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions views/clickhouse.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,9 @@
func buildRealtimeViewsEventsQuery(spec QuerySpec) (string, []interface{}, error) {
query := squirrel.Select(
"count(distinct session_id) as view_count",
"count(distinct if(JSONExtractInt(event_data, 'errors') > 0, session_id, null)) / count(distinct session_id) as error_rate").
From("viewership_events").
"count(distinct if(errors > 0, session_id, null)) / count(distinct session_id) as error_rate").
From("viewership_current_counts").

Check warning on line 96 in views/clickhouse.go

View check run for this annotation

Codecov / codecov/patch

views/clickhouse.go#L95-L96

Added lines #L95 - L96 were not covered by tests
Where("user_id = ?", spec.Filter.UserID).
Where("server_timestamp > (toUnixTimestamp(now() - 30)) * 1000").
Limit(maxClickhouseResultRows + 1)
return toSqlWithFiltersAndBreakdown(query, spec)
}
Expand Down
Loading