Skip to content

Commit

Permalink
measure artifact download time
Browse files Browse the repository at this point in the history
  • Loading branch information
paulgessinger committed Dec 4, 2023
1 parent 2a2dfef commit 516ece1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/herald/github.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
github_api_call_count,
artifact_size,
artifact_size_rejected,
artifact_download_time,
)


Expand Down Expand Up @@ -194,6 +195,7 @@ def __init__(self) -> None:
path=config.ARTIFACT_CACHE_LOCATION, cache_size=config.ARTIFACT_CACHE_SIZE
)

@artifact_download_time.time()
def _download_artifact(self, token: str, repo: str, artifact_id: int) -> bytes:
logger.info("Downloading artifact %d from GitHub", artifact_id)
github_api_call_count.labels(type="artifact_info").inc()
Expand Down
6 changes: 6 additions & 0 deletions src/herald/metric.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,11 @@
"How often an artifact was rejected due to size",
)

artifact_download_time = Histogram(
"herald_artifact_download_time_seconds",
"Download time of artifacts",
buckets=[0.1, 0.2, 0.5, 1, 2, 5, 10, 15, 20, 25, 30, 60, 120],
)

cache_size_max.labels("file").set(config.CACHE_SIZE)
cache_size_max.labels("artifact").set(config.ARTIFACT_CACHE_SIZE)

0 comments on commit 516ece1

Please sign in to comment.