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 17, 2024
1 parent 57480b9 commit 67a9fa5
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

from metrics.github.github import get_codespaces
from metrics.github.metrics import get_codespaces_metrics
from metrics.timescaledb import db, tables


log = structlog.get_logger()


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

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

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


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

0 comments on commit 67a9fa5

Please sign in to comment.