lacolaco / contributors-img

Home Page:https://contrib.rocks

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Reimplement recent usage view

lacolaco opened this issue · comments

Objective

  • Show who uses the app.
    • To give additional information for decision making.

Requirement

What the view has to show:

  • Which repository is using the app actually.
    • Need to ignore try-out usages.

How to collect real usage?

  • What is the real usage?
    • Used at README.md in GitHub
    • Not onetime try-out (frequent usage)
  • How I can get it?
    • Collect HTTP requests
    • Pick up requests from GitHub.
    • Group these by their repository
    • If a repository sent requests multiple times, mark it as "recent usage"
  • What does "recent" mean
    • Expire "recent usage" marks in 1 month after the last request.

Solution

  • Collect request log on the endpoint
    • Cloud Run app -> Cloud Logging -> Big Query
  • Query logs and get recent usage repositories periodically
    • Big Query -> Cloud Run -> Cloud Firestore
  • Respond data from API
    • Cloud Firestore -> Cloud Run -> webapp

TODO

  • Send usage logs from Cloud Run to Cloud Logging
  • Connect Cloud Logging and Big Query (log routing)
  • Add an (internal) endpoint to query usage with BQ API
  • Add an endpoint for webapp to give recent usage data.