This package is to be used in workers to log timing events. For any async task/call you want to track, you can create an timer, which will log events to the console.
An attached edge-timer
tail worker will catch these log events, along with a millisecond precise timestamp, and uses that to calculate the actual time between the start and end, and then sends that off to a ingestion point of your choosing.
import { wrappedTimer } from 'edge-timer';
const res = await wrappedTimer('google-fetch', () =>
fetch('https://google.com')
)
import { EdgeTimer } from 'edge-timer';
const fetchTimer = new EdgeTimer('google-fetch')
// Perform any time-taking calls/IO...
await fetch('https://google.com')
fetchTimer.end()