Untitled

mail@pastecode.io avatar
unknown
plain_text
2 months ago
1.1 kB
1
Indexable
Never
import requests

class YourClassName:
    def get_status_statistics(self, test_id: str):
        grafana_base_url = "https://g-e479d6ef8a.grafana-workspace.us-west-2.amazonaws.com/d/GXuswQq4z/performance-test-results?orgId=1&from=now-5m&to=now&var-internal_workflow_id={test_id}"
        formatted_grafana_url = grafana_base_url.format(test_id=test_id)
        
        short_url = requests.get(f'http://tinyurl.com/api-create.php?url={formatted_grafana_url}').text
        
        status_statistics = self.__result_db_handler.get_existing_tests_status_summary()
        
        statistics_message = (
            "Tests Queue Statistics:\n"
            f"Number of tests in QUEUE: {status_statistics['queue']}\n"
            f"Number of tests SCHEDULED: {status_statistics['scheduled']}\n"
            f"Number of tests STARTING: {status_statistics['starting']}\n"
            f"Number of tests IN_PROGRESS: {status_statistics['in_progress']}\n"
            f"URL to Grafana Dashboard: {short_url}"
        )
        
        return statistics_message
Leave a Comment