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");

Dependencies (0)

    Dev Dependencies (7)

    Package Sidebar

    Install

    npm i egg-plugin-server-timing

    Weekly Downloads

    0

    Version

    0.0.2

    License

    MIT

    Unpacked Size

    18.2 kB

    Total Files

    16

    Last publish

    Collaborators

    • xiaoxice