metrics-common
[![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/midwayjs/metrics-common/blob/master/LICENSE) [![GitHub tag](https://img.shields.io/github/tag/midwayjs/metrics-common.svg)]() [![Build Status](https://travis-ci.org/
Last updated 7 years ago by czy88840616 .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install metrics-common 
SYNC missed versions from official npm registry.

Metrics Common

GitHub license GitHub tag Build Status Test Coverage Package Quality Known Vulnerabilities PRs Welcome

Overview

Metrics 的原意是 指标,用于反馈应用的当前状况的数据值,所以 Metrics 最后的结果都是数字

在业界标准的 Metrics 类型中,有几种标准的类型。

  • Gauge 瞬时值
  • Counter 计数器
  • Meter 吞吐率度量器
  • Histogram 直方分布度量器

本包扩展出一堆基础 Metrics 指标的实现。

包括常见的 Gauge, Counter, Timer, Histogram, Meter,以及扩展出来的 BucketCounter, FastCompass 等。

Install

npm i metrics-common --save

Usage

import { MetricsServerManager } from 'metrics-common';

const manager = new MetricsServerManager();

const app = koa();

app.use(async (ctx) => {
  const counter = manager.getCounter('system', 'test.system.counter');
  const histogram = manager.getHistogram('system', 'test.system.histogram');
  const timer = manager.getTimer('system', 'test.system.timer');
  const meter = manager.getMeter('system', 'test.system.meter');
  const fastcompass = manager.getFastCompass('system', 'test.system.fastcompass');
  counter.inc();
});

Current Tags

  • 1.1.6                                ...           latest (7 years ago)

7 Versions

  • 1.1.6                                ...           7 years ago
  • 1.1.5                                ...           7 years ago
  • 1.1.4                                ...           7 years ago
  • 1.1.3                                ...           7 years ago
  • 1.1.2                                ...           7 years ago
  • 1.1.0                                ...           7 years ago
  • 1.0.0                                ...           7 years ago

Copyright 2013 - present © cnpmjs.org | Home |