Skip to content

Commit

Permalink
Send if runner is public
Browse files Browse the repository at this point in the history
  • Loading branch information
gerardsegarra committed Apr 26, 2024
1 parent 9dfb6ad commit 9ceba96
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 7 deletions.
20 changes: 16 additions & 4 deletions src/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,9 @@ def process_workflow_job():
return True


# TODO get repo
# Add GH_PAT_SECRET

@scheduler.task('interval', id='monitor_queued', seconds=15)
def monitor_queued_jobs():
"""Return the job that has been queued and not starting for long time."""
Expand All @@ -151,10 +154,19 @@ def monitor_queued_jobs():
jobs_data = query_nodes(list(node_ids))
details = extract_jobs_metrics_from_data(jobs_data, node_ids)

for job in details:
statsd.histogram('midokura.github_runners.jobs.seconds_in_queue.histogram',
job["seconds_in_queue"],
tags=["environment:dev", f"job:{job['job_name']}"])
for run in details:
job = jobs[run["job_id"]]
app.logger.info(f"Got job {job}")
statsd.histogram(
'midokura.github_runners.jobs.seconds_in_queue.histogram',
run["seconds_in_queue"],
tags=[
"environment:dev",
f"job:{run['job_name']}",
f"runner_name:{job.runner_name}",
f"public:{job.runner_public}"
]
)

app.logger.info(f"Jobs details {details}")

Expand Down
17 changes: 14 additions & 3 deletions src/queryql.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,25 @@ def query_nodes(node_id_list: List[str]):
query = gql(
"""
query getCheckRuns($node_id_list: [ID!]!) {
nodes(ids: $node_id_list) {
... on CheckRun {
id
nodes(ids: $node_id_list) {
... on CheckRun {
name
status
startedAt
completedAt
repository {
owner {
login
}
name
}
checkSuite {
workflowRun {
event
runNumber
}
}
}
}
}
"""
Expand Down

0 comments on commit 9ceba96

Please sign in to comment.