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

Get most popular URLs by request share #290

Open
trieloff opened this issue Oct 7, 2020 · 0 comments
Open

Get most popular URLs by request share #290

trieloff opened this issue Oct 7, 2020 · 0 comments
Labels
enhancement New feature or request

Comments

@trieloff
Copy link
Contributor

trieloff commented Oct 7, 2020

SELECT * 
FROM (
  SELECT reqs, 1 - (SUM(reqs) OVER(ORDER BY reqs)/total) AS rshare, req_http_X_URL, 
  FROM (
    SELECT 
      COUNT(time_start_usec) AS reqs, 
      req_http_X_URL, 
      sum(count(*)) OVER() AS total,
    FROM `helix-225321.helix_logging_….requests202010`   
    WHERE status_code IN ("200") AND
    time_start_usec > CAST(UNIX_MICROS(TIMESTAMP_SUB(CURRENT_TIMESTAMP(), INTERVAL 2 DAY)) AS STRING) AND
    time_start_usec < CAST(UNIX_MICROS(TIMESTAMP_SUB(CURRENT_TIMESTAMP(), INTERVAL 1 DAY)) AS STRING)
    GROUP BY req_http_X_URL 
    ORDER BY reqs DESC)
  ORDER BY reqs DESC)
WHERE rshare < 0.5 # AND
# req_http_X_URL LIKE "/en/publish%"
@trieloff trieloff added the enhancement New feature or request label Oct 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant