egg-plugin-server-timing
TypeScript icon, indicating that this package has built-in type declarations

0.0.2 • Public • Published

egg-plugin-server-timing

A Egg Plugin for Server Timing

Usage

Install

$ npm install egg-plugin-server-timing
# or
$ yarn add egg-plugin-server-timing

Config

// config/plugin.ts

export default {
  serverTiming: {
    enable: true,
    package: "egg-plugin-server-timing",
  },
};
// config/config.default.ts
config.serverTiming = {
  name: "Total", // The name of the total metric to be set.
  description: "Total Response Time", // The description of the total metric to be set.
  total: true, // Whether to set the total metric automatically.
  enabled: true, // Whether to enable the plugin.
  autoEnd: true, // Whether to set the metric automatically when the request ends.
  precision: +Infinity, // Number of digits after the decimal point of the statistical time
};

Timing

ctx.serverTimer.startTime("all");
await new Promise((resolve) => setTimeout(resolve, 100));
ctx.serverTimer.endTime("all");

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 0.0.2
    2
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 0.0.2
    2
  • 0.0.1
    1

Package Sidebar

Install

npm i egg-plugin-server-timing

Weekly Downloads

3

Version

0.0.2

License

MIT

Unpacked Size

18.2 kB

Total Files

16

Last publish

Collaborators

  • xiaoxice