Skip to content

Commit

Permalink
Add task to fetch and store codespaces metrics
Browse files Browse the repository at this point in the history
  • Loading branch information
Jongmassey committed May 20, 2024
1 parent 2162b27 commit 56c710f
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions metrics/tasks/codespaces.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import sys

import structlog

import metrics.github.github as github
import metrics.github.metrics as metrics
from metrics.timescaledb import db, tables


log = structlog.get_logger()


def main():
log.info("Getting codespaces")
codespaces = github.codespaces(org="opensafely")
log.info(f"Got {len(codespaces)} codespaces")

codespaces_metrics = metrics.get_codespaces_metrics(codespaces)
log.info("Got metrics")

log.info("Writing data")
db.upsert(tables.GitHubCodespaces, codespaces_metrics)
log.info("Written data")


if __name__ == "__main__":
sys.exit(main())

0 comments on commit 56c710f

Please sign in to comment.