damccorm commented on code in PR #24073:
URL: https://github.com/apache/beam/pull/24073#discussion_r1058289696


##########
.test-infra/metrics/sync/github/sync_workflows.py:
##########
@@ -0,0 +1,162 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+'''
+This module queries GitHub to collect Beam-related workflows metrics and put 
them in
+PostgreSQL.
+This Script it's running every 2  minutes in a cloud function in 
apache-beam-testing project.
+This cloud function is triggered by a pubsub topic.
+You can found the cloud function in the next link 
+https://console.cloud.google.com/functions/details/us-central1/github_actions_workflows_dashboard_sync?env=gen1&project=apache-beam-testing
+Pub sub topic : 
https://console.cloud.google.com/cloudpubsub/topic/detail/github_actions_workflows_sync?project=apache-beam-testing
+Cron Job : 
https://console.cloud.google.com/cloudscheduler/jobs/edit/us-central1/github_actions_workflows_dashboard_sync?project=apache-beam-testing
+Writing the latest 10 jobs of every postcommit workflow in master branch in a 
beammetrics database
+'''
+
+import os
+import sys
+import time
+import re
+import requests
+import psycopg2
+
+from datetime import datetime
+from github import GithubIntegration 
+
+DB_HOST = os.environ['DB_HOST']
+DB_PORT = os.environ['DB_PORT']
+DB_NAME = os.environ['DB_NAME']
+DB_USER_NAME = os.environ['DB_USER']
+DB_PASSWORD = os.environ['DB_PASS']
+GH_WORKFLOWS_TABLE_NAME = "github_workflows"
+# Number of workflows that fetch github API
+GH_NUMBER_OF_WORKFLOWS = 100  
+GH_WORKFLOWS_NUMBER_EXECUTIONS = 10

Review Comment:
   I don't think you fully addressed this. I understand that we're only 
rendering 10 executions right now, but having more data available would allow 
us to change that very easily if we want to render more (we'd just have to 
change the grafana row).
   
   Increasing this number shouldn't affect our rate limit usage AFAIK because 
all 100 workflows could still be fetched in a single call.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to