Skip to content

Add table github_traffic_clone_daily and table github_traffic_clone_weekly - #505

Merged
ParthaI merged 6 commits into
turbot:add-table-github-traffic-clonefrom
sohanmaheshwar:main
Jul 18, 2025
Merged

Add table github_traffic_clone_daily and table github_traffic_clone_weekly#505
ParthaI merged 6 commits into
turbot:add-table-github-traffic-clonefrom
sohanmaheshwar:main

Conversation

@sohanmaheshwar

Copy link
Copy Markdown
Contributor

Example query

select
  timestamp,
  count,
  uniques
from
  github_traffic_clone_daily
where
  repository_full_name = 'turbot/steampipe

SQL query results here

+---------------------------+-------+---------+
| timestamp                 | count | uniques |
+---------------------------+-------+---------+
| 2025-07-07T02:00:00+02:00 | 100    | 90     |
+---------------------------+-------+---------+

and

Example query

select
  timestamp,
  count,
  uniques
from
  github_traffic_clone_weekly
where
  repository_full_name = 'turbot/steampipe

SQL query results here

+---------------------------+-------+---------+
| timestamp                | count | uniques |
+---------------------------+-------+---------+
| 2025-07-07T02:00:00+02:00 | 50    | 30     |
+---------------------------+-------+---------+

@misraved
misraved requested review from ParthaI and Copilot July 15, 2025 12:11

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds two new Steampipe tables to surface GitHub repository clone metrics on a daily and weekly basis, registers them in the plugin, and provides markdown documentation for both.

  • Introduce github_traffic_clone_daily and github_traffic_clone_weekly table definitions with listing logic.
  • Register both tables in plugin.go.
  • Add example usage and descriptions in corresponding docs under docs/tables.

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
github/table_github_traffic_clone_daily.go Define github_traffic_clone_daily table and list hydrate for daily clones.
github/table_github_traffic_clone_weekly.go Define github_traffic_clone_weekly table and list hydrate for weekly clones.
github/plugin.go Register the new daily and weekly clone tables.
docs/tables/github_traffic_clone_daily.md Add documentation for daily clone table (missing closing code fence).
docs/tables/github_traffic_clone_weekly.md Add documentation for weekly clone table (missing closing code fence).
Comments suppressed due to low confidence (5)

docs/tables/github_traffic_clone_daily.md:38

  • Add a closing ``` after the SQL example to properly terminate the code block.
  timestamp;

docs/tables/github_traffic_clone_weekly.md:38

  • Add a closing ``` after the SQL example to properly terminate the code block.
  timestamp;

github/table_github_traffic_clone_daily.go:13

  • Add unit and integration tests covering the daily clone traffic table logic to ensure correct listing and transformation of clone stats.
func tableGitHubTrafficCloneDaily() *plugin.Table {

github/table_github_traffic_clone_weekly.go:13

  • Add unit and integration tests covering the weekly clone traffic table logic to ensure correct listing and transformation of clone stats.
func tableGitHubTrafficCloneWeekly() *plugin.Table {

github/plugin.go:83

  • [nitpick] Align indentation of the new table registrations to match the existing entries for consistent formatting.
			"github_traffic_clone_daily":			  tableGitHubTrafficCloneDaily(),

@ParthaI ParthaI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @sohanmaheshwar, I’ve added a few review comments—please take a look when you get a chance.

Additionally, it would be beneficial to include more example queries for the github_traffic_clone_daily and github_traffic_clone_weekly tables. Here are a few suggestions that could add value for users:

  1. List daily clone statistics for all repositories

    Show the number of clones and unique cloners per repository per day.

  2. Find the repositories with the highest total clones in the past week

    Summarize weekly clone counts to highlight your most visited repositories.

  3. Show daily clone trends for a specific repository

    Track the number of clones and unique users per day to analyze traffic over time.

  4. Compare weekly clone counts across repositories

    Identify which repositories are gaining or losing attention week-over-week.

  5. Get the latest clone metrics for each repository

    Quickly view the most recent daily or weekly clone statistics per repository.

Thanks!

Comment thread docs/tables/github_traffic_clone_weekly.md
Comment thread docs/tables/github_traffic_clone_daily.md
Comment thread docs/tables/github_traffic_clone_daily.md Outdated
Comment thread github/plugin.go Outdated
Comment thread github/table_github_traffic_clone_daily.go
Comment thread github/table_github_traffic_clone_weekly.go
sohanmaheshwar and others added 2 commits July 16, 2025 13:49
Co-authored-by: Keep Focused <partha@turbot.com>
Co-authored-by: Keep Focused <partha@turbot.com>
@ParthaI

ParthaI commented Jul 17, 2025

Copy link
Copy Markdown
Contributor

Hi @sohanmaheshwar, all the changes in this PR look great — thanks for the updates! I noticed that one comment may have been missed: #505 (review).
Could you please take a look when you get a chance?

@sohanmaheshwar

Copy link
Copy Markdown
Contributor Author

Hey @ParthaI

Thanks for the review. I just pushed a PR which added a couple of the changes you requested:

  1. The indentation in plugin.go
  2. Adding examples for postgres and sqlite in the docs.

Regarding the comment about example queries:

Additionally, it would be beneficial to include more example queries for the github_traffic_clone_daily and github_traffic_clone_weekly tables. Here are a few suggestions that could add value for users:

1. **List daily clone statistics for all repositories**
   > Show the number of clones and unique cloners per repository per day.

2. **Find the repositories with the highest total clones in the past week**
   > Summarize weekly clone counts to highlight your most visited repositories.

3. **Show daily clone trends for a specific repository**
   > Track the number of clones and unique users per day to analyze traffic over time.

4. **Compare weekly clone counts across repositories**
   > Identify which repositories are gaining or losing attention week-over-week.

5. **Get the latest clone metrics for each repository**
   > Quickly view the most recent daily or weekly clone statistics per repository.

I've added the example query for 3.Show daily clone trends for a specific repository but as far as I can tell the others will need joins across the query. Looks like GitHub’s API (client.Repositories.ListTrafficClones) only allows per-repo queries and the Steampipe table does not implement internal looping over all repositories. I followed the same format as the daily and weekly traffic table as it's part of the same API: https://docs.github.com/en/rest/metrics/traffic?apiVersion=2022-11-28

Let me know if there's an alternate way to do this via SQL Join or a script that first queries github_my_repository and then iterates over all of them to find the clone numbers.

@ParthaI
ParthaI changed the base branch from main to add-table-github-traffic-clone July 18, 2025 04:51
@ParthaI
ParthaI merged commit b0321f7 into turbot:add-table-github-traffic-clone Jul 18, 2025
misraved pushed a commit that referenced this pull request Jul 18, 2025
…eekly (#505) (#506)

Co-authored-by: Sohan <1119120+sohanmaheshwar@users.noreply.github.com>
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.

3 participants