Skip to content

feat: gracefully deprecate BigQuery viewership endpoints#214

Merged
hjpotter92 merged 2 commits into
mainfrom
feat/deprecate-bigquery-viewership
Mar 23, 2026
Merged

feat: gracefully deprecate BigQuery viewership endpoints#214
hjpotter92 merged 2 commits into
mainfrom
feat/deprecate-bigquery-viewership

Conversation

@ecmulli
Copy link
Copy Markdown
Member

@ecmulli ecmulli commented Mar 20, 2026

Summary

  • Adds a noopBigQuery stub that implements the BigQuery interface with empty/nil returns, so viewership endpoints return HTTP 200 with empty/zero data instead of 501 errors when BigQuery is disabled
  • Adds DisableBigQuery option to views.ClientOptions to conditionally swap in the stub
  • Updates provisionDataAnalytics to always create views and usage clients (instead of returning nil when --disable-bigquery is set), passing the flag through to the views client

Behavior change

Endpoint Before (--disable-bigquery) After (--disable-bigquery)
GET /views/query/total/{playbackId} 501 "bigquery is unavailable" 200 {"playbackId":"...","viewCount":0}
GET /views/query 501 200 []
GET /views/query/creator 501 200 []
GET /views/{assetId}/total 501 200 (Prometheus-only count)
GET /views/now (ClickHouse) 501 200 (works normally)
GET /views/internal/timeSeries (ClickHouse) 501 200 (works normally)
Usage endpoints (ClickHouse) 501 200 (works normally)

Test plan

  • Deploy with --disable-bigquery and verify viewership endpoints return 200 with empty data
  • Verify ClickHouse-backed endpoints (/views/now, /usage/query/*) still return real data
  • Verify without --disable-bigquery flag, BigQuery viewership still works as before

Made with Cursor

When --disable-bigquery is set, viewership endpoints now return empty/zero
data (HTTP 200) instead of 501 errors. This allows consumers to keep
their integrations working while we phase out BigQuery-backed viewership.

- Add noopBigQuery implementing the BigQuery interface with empty returns
- Add DisableBigQuery option to views.ClientOptions
- Update provisionDataAnalytics to always create views/usage clients,
  passing the flag through instead of returning nil

Made-with: Cursor
@ecmulli ecmulli requested a review from a team as a code owner March 20, 2026 20:17
@ecmulli
Copy link
Copy Markdown
Member Author

ecmulli commented Mar 20, 2026

Testing Summary

Ran locally with --disable-bigquery=true (no BigQuery credentials provided). All BigQuery-backed viewership endpoints return HTTP 200 with empty/zero data instead of 501 errors.

Results

Endpoint HTTP Code Response Verdict
GET /views/query/total/{playbackId} 200 {"playbackId": "some-playback-id", "viewCount": 0} Empty/zero data as expected
GET /views/query 200 [] Empty array as expected
GET /views/query/creator 404 (empty) Expected — fake assetId doesn't exist in Livepeer API, so it 404s before BigQuery is ever called (same behavior with BQ enabled)

ClickHouse-backed endpoints (unaffected)

Usage endpoints (/usage/query/total, /usage/query) continue to return real data from ClickHouse as expected.

@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 20, 2026

Codecov Report

❌ Patch coverage is 0% with 13 lines in your changes missing coverage. Please review.
✅ Project coverage is 28.86598%. Comparing base (5ead5de) to head (87eb214).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
views/client.go 0.00000% 9 Missing ⚠️
views/bigquery.go 0.00000% 4 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@                 Coverage Diff                 @@
##                main        #214         +/-   ##
===================================================
- Coverage   29.55145%   28.86598%   -0.68547%     
===================================================
  Files              5           5                 
  Lines            379         388          +9     
===================================================
  Hits             112         112                 
- Misses           252         261          +9     
  Partials          15          15                 
Files with missing lines Coverage Δ
views/bigquery.go 48.81890% <0.00000%> (-1.58760%) ⬇️
views/client.go 19.20530% <0.00000%> (-0.65771%) ⬇️

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5ead5de...87eb214. Read the comment docs.

Files with missing lines Coverage Δ
views/bigquery.go 48.81890% <0.00000%> (-1.58760%) ⬇️
views/client.go 19.20530% <0.00000%> (-0.65771%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@hjpotter92 hjpotter92 merged commit 9eae5e6 into main Mar 23, 2026
6 of 9 checks passed
@hjpotter92 hjpotter92 deleted the feat/deprecate-bigquery-viewership branch March 23, 2026 05:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants