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

feat: add server timing to responses #164

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

Conversation

SgtPooki
Copy link
Member

@SgtPooki SgtPooki commented Dec 13, 2024

Title

feat: add server timing to responses

Description

This PR adds server timing headers to responses by wrapping all responses returned by fetch in a Response object that includes the server timing headers.

The headers are generated by wrapping async functions with a serverTiming utility function that records the time taken to execute the function, and then adding those headers to an array on the VerifiedFetch class.

Notes & open questions

  • We need to work out exactly what events we need to time
  • I'd also like to clean up the serverTiming utility function usage so that it's easier to add new timings without having to handle the error and success cases manually for each one.

Example of current server timings for http://bafybeie4vcqkutumw7s26ob2bwqwqi44m6lrssjmiirlhrzhs2akdqmkw4.ipfs.helia-sw-gateway.localhost/:

image

Example of current server timings for http://blog-ipfs-tech.ipns.helia-sw-gateway.localhost/:

image

Change checklist

  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation if necessary (this includes comments as well)
  • I have added tests that prove my fix is effective or that my feature works

@SgtPooki SgtPooki linked an issue Dec 13, 2024 that may be closed by this pull request
@SgtPooki SgtPooki marked this pull request as ready for review December 13, 2024 18:43
@SgtPooki SgtPooki requested a review from a team as a code owner December 13, 2024 18:43
@SgtPooki
Copy link
Member Author

SgtPooki commented Dec 13, 2024

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.

feat: add server timings to responses
1 participant