application-research / estuary-hosted-infrastructure

The main repository for EHI
MIT License
3 stars 0 forks source link

Create data onboarding endpoint #15

Closed 10d9e closed 1 year ago

10d9e commented 1 year ago

In order to integrate with front end reporting tools/dashboarding, we need a RESTful view into our customer database. This should reflect the same information as our Onboarding sheet.

Specific requirements:

10d9e commented 1 year ago

cc: @jimmylee - for tracking. A few suggestions:

  1. Short term, Since this is BI and the source of truth is our Onboarding sheet,
    • Present a graph view directly through the sheets api, for example Image
    • Use the sheets api directly
      
      import requests

spreadsheet_id = "YOUR_SPREADSHEET_ID" range = "Sheet1!A1:C3" api_key = "YOUR_API_KEY"

api_url = f"https://sheets.googleapis.com/v4/spreadsheets/{spreadsheet_id}/values/{range}" headers = {"Authorization": f"Bearer {api_key}"}

response = requests.get(api_url, headers=headers)

if response.status_code == 200: data = response.json() print(data) else: print("Error:", response.status_code)


2. Create/use a database or use a customer management tool that @corinne-antonia et al work with to onboard data and product reports from

3. Create a solution that queries our infra directly, using AWX or some other backend API (cc: @Zorlin) to show the different namespaces, and the individual `delta` apis within each namespace. The REST application flow:

       - Query all namespaces from AWX
       - Query `delta` for stats in each namespace (ie. https://hackfs.delta.estuary.tech/open/stats/totals/info ) and add them a list
       - Return the list

example output:

{ "results":[ { "client_info":{ "name":"hackfs", "email":"email@domain.com", "contact":"Jane Doe" }, "stats":{ "total_content_consumed":4828, "total_e2e_deals":3073, "total_e2e_deals_in_bytes":148737588288, "total_import_deals":0, "total_import_deals_in_bytes":0, "total_miners":56, "total_piece_commitment_made":2735, "total_piece_committed":1000, "total_proposal_made":1011, "total_proposal_sent":3, "total_sealed_deal_in_bytes":44298575360, "total_storage_allocated":148737588288, "total_transfer_finished":662, "total_transfer_started":0 } }, { "client_info":{ "name":"radiant earth", "email":"email@domain.com", "contact":"Anna Doe" }, "stats":{ "total_content_consumed":4828, "total_e2e_deals":3073, "total_e2e_deals_in_bytes":148737588288, "total_import_deals":0, "total_import_deals_in_bytes":0, "total_miners":56, "total_piece_commitment_made":2735, "total_piece_committed":1000, "total_proposal_made":1011, "total_proposal_sent":3, "total_sealed_deal_in_bytes":44298575360, "total_storage_allocated":148737588288, "total_transfer_finished":662, "total_transfer_started":0 } } ] }

10d9e commented 1 year ago

Update - we just need the namespace or username @Zorlin cc: @jimmylee

jimmylee commented 1 year ago

Thanks for putting this together, however I just need a way to query the usernames/namespaces and I can generate everything else myself.

Zorlin commented 1 year ago

Here it is @jimmylee @jlogelin

https://cpistats.estuary.tech/report.json