Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Return performance data as JSON #5336

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Return performance data as JSON #5336

wants to merge 2 commits into from

Conversation

quis
Copy link
Member

@quis quis commented Dec 23, 2024

Looks like this when running locally:

{
  "average_percentage_under_10_seconds": 0,
  "count_of_live_services_and_organisations": {
    "organisations": 1,
    "services": 48
  },
  "email_notifications": 15,
  "letter_notifications": 0,
  "live_service_count": 48,
  "notifications_by_type": [],
  "organisations_using_notify": [
    {
      "count_of_live_services": 47,
      "organisation_name": "Department for Social Affairs and Citizenship"
    },
    {
      "count_of_live_services": 1,
      "organisation_name": "No organisation"
    }
  ],
  "processing_time": [],
  "sms_notifications": 47,
  "total_notifications": 62
}

stats["average_percentage_under_10_seconds"] = mean(
[row["percentage_under_10_seconds"] for row in stats["processing_time"]] or [0]
)
stats["count_of_live_services_and_organisations"] = status_api_client.get_count_of_live_services_and_organisations()

if request.endpoint == "main.json":
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this not be:

Suggested change
if request.endpoint == "main.json":
if request.endpoint == "main.performance_json":

(nb: i haven't run this locally to test)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed now and added a rudimentary test that would have caught this

quis added 2 commits December 23, 2024 19:40
We don’t display this publicly on the page any more, so we don’t want to
expopse it publicly in the JSON output.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants