Skip to content

Artifact for API Recache Flow - #65

Draft
charparr wants to merge 5 commits into
mainfrom
artifact_for_api_recache
Draft

Artifact for API Recache Flow#65
charparr wants to merge 5 commits into
mainfrom
artifact_for_api_recache

Conversation

@charparr

Copy link
Copy Markdown
Member

This PR simply adds a post-flow-run Prefect Artifact object to the API re-cache flow. To view the artifact, run the flow as normally for a set of routes: more routes will take longer, but will be a more robust test and create a more interesting report. The report summarizes response codes for the different routes that are being cached. You shouldn't need to configure the re-ache flow in any special way. Just run the flow, but if you want a minimum viable test just cancel the flow after 15 minutes or so to see a report.

To view the report Artifact, go to the flow run in the Prefect Dashboard, and click the the "Artifact" tab, and then click the Artifact Item.

I've tried to highlight routes that get a 5xx response, so you get a report on every single URL that has a 5xx status.

A 404 or 200 is considered a "healthy" response. Our 404 usage is pretty solid IMO.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull Request Overview

This PR enhances the API recache flow by adding a post-run Prefect Artifact that provides a detailed analysis report of API route responses.

  • Added an extended docstring and summary reporting prints to inform users of the flow results.
  • Updated the flow execution to capture and log detailed statistics including total requests and artifact IDs.
  • Modified the serve function parameters to include an additional "Analytics" tag and a refined description.
Comments suppressed due to low confidence (1)

recache_api/recache.py:9

  • [nitpick] Enhance the docstring to include parameter and return descriptions to improve clarity and aid future maintenance.
    Recache API endpoints and generate performance analysis artifacts.

Comment thread recache_api/recache.py
and automatically generates a detailed analysis report as a Prefect artifact
visible in the dashboard.
"""
print("🔄 Starting Prefect Recaching Flow with automatic analysis...")

Copilot AI Jun 17, 2025

Copy link

Choose a reason for hiding this comment

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

Consider using Prefect's built-in logging methods instead of print statements for more flexible log management and integration with the Prefect dashboard.

Suggested change
print("🔄 Starting Prefect Recaching Flow with automatic analysis...")
logger = get_run_logger()
logger.info("🔄 Starting Prefect Recaching Flow with automatic analysis...")

Copilot uses AI. Check for mistakes.
@brucecrevensten
brucecrevensten marked this pull request as draft June 18, 2025 18:34
@brucecrevensten

Copy link
Copy Markdown
Member

This needs significant revision to reduce complexity and avoid unnecessary code, possibly a fresh start, will review further after launch.

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.

3 participants