edge-timer
TypeScript icon, indicating that this package has built-in type declarations

0.0.8 • Public • Published

edge-timer Package

Description

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.

Examples

Wrapped timer

import { wrappedTimer } from 'edge-timer';

const res = await wrappedTimer('google-fetch', () => 
  fetch('https://google.com')
)

Manual timer

import { EdgeTimer } from 'edge-timer';

const fetchTimer = new EdgeTimer('google-fetch')

// Perform any time-taking calls/IO...

await fetch('https://google.com')

fetchTimer.end()

Readme

Keywords

none

Package Sidebar

Install

npm i edge-timer

Weekly Downloads

16

Version

0.0.8

License

MIT

Unpacked Size

3.07 kB

Total Files

4

Last publish

Collaborators

  • arunesh90