Skip to content

Commit

Permalink
[chore] Use debug loglevel for github metrics script (#23633)
Browse files Browse the repository at this point in the history
### Details:
We can switch log level for GitHub metrics script only when the workflow
is restarted with debug logging
  • Loading branch information
ababushk authored Mar 22, 2024
1 parent 908dac9 commit 113975f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .github/scripts/collect_github_metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ def main():
repo = g.get_repo(repo_name)

run = repo.get_workflow_run(int(run_id))
logger.debug('Processing run ID %s - %s', run_id, run.name)
if run.status != 'completed':
logger.error('Run %s is not completed! Only completed runs should be in the database', run_id)
raise SystemExit(1)
Expand Down Expand Up @@ -144,6 +145,7 @@ def main():

for job in run.jobs():
job_id = job.id
logger.debug('Processing job %s', job.name)
queued_duration_seconds = 0
duration_seconds = 0

Expand Down Expand Up @@ -178,6 +180,7 @@ def main():
logger.debug('Job query: %s', job_data_query)
cur.execute(job_data_query)
for step in job.steps:
logger.debug('Processing step %s', step.name)
duration_seconds_timedelta = step.completed_at - step.started_at
duration_seconds = round(duration_seconds_timedelta.total_seconds())

Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/send_workflows_to_opentelemetry.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ jobs:
PGPASSWORD: ${{ secrets.METRICS_DATABASE_PASSWORD }}
PGDATABASE: ${{ secrets.METRICS_DATABASE_NAME }}
PGPORT: 5432
# LOGLEVEL: "${{ runner.debug == '1' && 'DEBUG' || 'INFO' }}"
LOGLEVEL: DEBUG
run: |
python3 .github/scripts/collect_github_metrics.py \
--run-id ${{ github.event.workflow_run.id }} \
Expand Down

0 comments on commit 113975f

Please # to comment.