Options
All
  • Public
  • Public/Protected
  • All
Menu

pandora-metrics

Index

Enumerations

Classes

Interfaces

Type aliases

Variables

Functions

Object literals

Type aliases

IndicatorType

IndicatorType: "singleton" | "multiton"

Variables

BigNumber

BigNumber: any = require("long")

COUNT_BASE

COUNT_BASE: any = new BigNumber(1).shiftLeft(38)

次数统计的累加基数,和rt相加得到实际更新到LongAdder的数 The base number of count that is added to total rt, to derive a number which will be added to {@link LongAdder}

COUNT_OFFSET

COUNT_OFFSET: 38 = 38

控制总次数的bit数, 理论统计上限为 2 ^ (64 -38 -1) = 33554432 This magic number divide a long into two parts, where the higher part is used to record the total number of method invocations, and the lower part is used to record the total method execution time. The max number of count per collecting interval will be 2 ^ (64 -38 -1) = 33554432

CURRENT_SPAN

CURRENT_SPAN: symbol = Symbol('CURRENT_SPAN')

DEFAULT_ALPHA

DEFAULT_ALPHA: number = 0.015

DEFAULT_BUCKET_COUNT

DEFAULT_BUCKET_COUNT: 10 = 10

DEFAULT_NUM_OF_BUCKET

DEFAULT_NUM_OF_BUCKET: 10 = 10

DEFAULT_SIZE

DEFAULT_SIZE: number = 1028

DiskFree

DiskFree: any = util.promisify(df)

ERROR_TRACE

ERROR_TRACE: 8 = 8

EventEmitter

EventEmitter: any = require('events')

FIFTEEN_MINUTES

FIFTEEN_MINUTES: 15 = 15

FIVE_MINUTES

FIVE_MINUTES: 5 = 5

ILLEGAL_CHARS

ILLEGAL_CHARS: RegExp = /[^a-zA-Z0-9-_./\\p{L}]/g

INTERVAL

INTERVAL: 5 = 5

KEY_SPLIT

KEY_SPLIT: "|" = "|"

KOA

KOA: any = require('koa')

M15_ALPHA

M15_ALPHA: number = 1 - Math.exp(-INTERVAL / SECONDS_PER_MINUTE / FIFTEEN_MINUTES)

M1_ALPHA

M1_ALPHA: number = 1 - Math.exp(-INTERVAL / SECONDS_PER_MINUTE / ONE_MINUTE)

M5_ALPHA

M5_ALPHA: number = 1 - Math.exp(-INTERVAL / SECONDS_PER_MINUTE / FIVE_MINUTES)

MAX_COUNTER_VALUE

MAX_COUNTER_VALUE: number = Math.pow(2, 32)

MAX_SUBCATEGORY_SIZE

MAX_SUBCATEGORY_SIZE: 20 = 20

NORMAL_TRACE

NORMAL_TRACE: 1 = 1

NetworkTraffic

NetworkTraffic: string[] = ['TCP_ACTIVE_OPENS', // active opening connections'TCP_PASSIVE_OPENS', // passive opening connections'TCP_ATTEMPT_FAILS', // number of failed connection attempts'TCP_ESTAB_RESETS', // number of resets that have occurred at established'TCP_CURR_RESETS', // TCP_CURR_RESETS'TCP_IN_SEGS', // incoming segments'TCP_OUT_SEGS', // outgoing segments'TCP_RETRAN_SEGS', // number of retran segements'TCP_IN_ERRS', // incoming segments with errs, e_g_ checksum error'TCP_OUT_RSTS', // outgoing segments with resets]

ONE_MINUTE

ONE_MINUTE: 1 = 1

RESCALE_THRESHOLD

RESCALE_THRESHOLD: number = 60 * 60 * 1000

RT_BITWISE_AND_BASE

RT_BITWISE_AND_BASE: any = new BigNumber(1).shiftLeft(38).sub(1)

总数和此数进行二进制与得到总rt统计 The base number is used to do BITWISE AND operation with the value of {@link LongAdder} to derive the total number of execution time

Router

Router: any = require('koa-router')

SECONDS_PER_MINUTE

SECONDS_PER_MINUTE: 60 = 60

SEPARATOR

SEPARATOR: "." = "."

SKIP_RATE

SKIP_RATE: symbol = Symbol('SKIP_RATE')

SLOW_TRACE

SLOW_TRACE: 2 = 2

SystemMemory

SystemMemory: string[] = ['MEM.TOTAL', // MemTotal'MEM.USED', // MemTotal - (MemFree + Buffers + Cached)'MEM.FREE', // MemFree'MEM.BUFFERS', // Buffers'MEM.CACHED', // Cached'MEM.SWAP.TOTAL', // SwapTotal'MEM.SWAP.USED', // SwapTotal - SwapFree'MEM.SWAP.FREE' // SwapFree]

TICK_INTERVAL

TICK_INTERVAL: 5000 = 5000

TIMEOUT_TRACE

TIMEOUT_TRACE: 6 = 6

TRACEID

TRACEID: "traceId" = "traceId"

TRACER_TIMEOUT

TRACER_TIMEOUT: number = 30 * 1000

assert

assert: any = require('assert')

asyncWrap

asyncWrap: any = (<any>process).binding('async_wrap')

bodyParser

bodyParser: any = require('koa-bodyparser')

cls

cls: any = require('./cls')

debug

debug: any = require('debug')('pandora:metrics:service')

Fork from othiym23/shimmer, support generator function and async function 待原包更新支持 Generator 和 async 方法后,回归原包

defaultCapacity

defaultCapacity: 100 = 100

exec

exec: any = promisify(require('child_process').exec)

fieldNames

fieldNames: string[] = ['net.in.bytes', 'net.in.packets', 'net.in.errs', 'net.in.dropped','net.in.fifo.errs', 'net.in.frame.errs', 'net.in.compressed', 'net.in.multicast','net.out.bytes', 'net.out.packets', 'net.out.errs', 'net.out.dropped','net.out.fifo.errs', 'net.out.collisions', 'net.out.carrier.errs', 'net.out.compressed']

fs

fs: any = require('fs')

logger

logger: any = debug

metricsClient

metricsClient: MessengerClient = null

metricsServer

metricsServer: MessengerServer = null

mixin

mixin: any = require('mixin')

os

os: any = require('os')

promisify

promisify: any

util

util: any = require('util')

uuid

uuid: any = require('uuid')

v8

v8: any = require('v8')

Functions

binarySearch

  • binarySearch(a: Array<number>, key: number): number
  • Searches the specified array of doubles for the specified value using the binary search algorithm. The array must be sorted (as by the {@link #sort(double[])} method) prior to making this call. If it is not sorted, the results are undefined. If the array contains multiple elements with the specified value, there is no guarantee which one will be found. This method considers all NaN values to be equivalent and equal.

    Parameters

    • a: Array<number>

      the array to be searched

    • key: number

      the value to be searched for

    Returns number

    index of the search key, if it is contained in the array; otherwise, (-(insertion point) - 1). The insertion point is defined as the point at which the key would be inserted into the array: the index of the first element greater than the key, or a.length if all elements in the array are less than the specified key. Note that this guarantees that the return value will be >= 0 if and only if the key is found.

convertObjectToTags

  • convertObjectToTags(object: any): any[]

defineProperty

  • defineProperty(obj: any, name: any, value: any): void

extractInt

  • extractInt(str: any): number

ff

  • ff(value: any): any

getClient

  • getClient(): MessengerClient

getDiscoveryKey

  • getDiscoveryKey(name: any): string

getEmptyFields

  • getEmptyFields(): any[]

getRandom64

  • getRandom64(): string

getServer

  • getServer(): MessengerServer

getUsage

  • getUsage(current: number, last: number, currentInfo: any, lastInfo: any): number

initClient

  • initClient(): void

initMessenger

  • initMessenger(): void

isAsyncFunction

  • isAsyncFunction(funktion: any): boolean

isFunction

  • isFunction(funktion: any): boolean

isGeneratorFunction

  • isGeneratorFunction(funktion: any): boolean

isObjectLike

  • isObjectLike(value: any): boolean

massUnwrap

  • massUnwrap(nodules: any, names: any): void

massWrap

  • massWrap(nodules: any, names: any, wrapper: any): void

nodeEqual

  • nodeEqual(source: any, target: any): boolean

parseCpuInfo

  • parseCpuInfo(line: any): any

printCounter

  • printCounter(name: any, counter: any): void

printGauge

  • printGauge(name: any, gague: any): Promise<void>

printHistogram

  • printHistogram(name: any, histogram: any): void

printMeter

  • printMeter(name: any, meter: any): void

printMetricName

  • printMetricName(name: any): void

printTimer

  • printTimer(name: any, timer: any): void

printWithBanner

  • printWithBanner(name: any): void

removeIllegalOpentsdbChars

  • removeIllegalOpentsdbChars(input: any): any
  • When output to metrics.log, all the illegal chars will be replaced by '_'

    Parameters

    • input: any

      the input string

    Returns any

    a string with all the illegal chars replaced by '_'

runScript

  • runScript(pl: any): Promise<Object>

shimmer

  • shimmer(options: any): void

startsWith

  • startsWith(str: any, target: any, position?: number): boolean

unwrap

  • unwrap(nodule: any, name: any): any

wrap

  • wrap(nodule: any, name: any, wrapper: any): any

Object literals

Constants

Constants: object

NOT_AVAILABLE

NOT_AVAILABLE: number = -10001

A special number to represent an invalid data 一个特殊的数字来代表一个无效的结果

CpuInfo

CpuInfo: object

guestTIme

guestTIme: number = 0

guest: running a normal guest, since 2.6.24

idleTime

idleTime: number = 0

idle: twiddling thumbs

iowaitTime

iowaitTime: number = 0

iowait: In a word, iowait stands for waiting for I/O to complete. But there are several problems:

  1. Cpu will not wait for I/O to complete, iowait is the time that a task is waiting for I/O to complete. When cpu goes into idle state for outstanding task io, another task will be scheduled on this CPU.
  2. In a multi-core CPU, the task waiting for I/O to complete is not running on any CPU, so the iowait of each CPU is difficult to calculate.
  3. The value of iowait field in /proc/stat will decrease in certain conditions. So, the iowait is not reliable by reading from /proc/stat.

irqTime

irqTime: number = 0

irq: servicing interrupts

niceTime

niceTime: number = 0

nice: niced processes executing in user mode

softirqTime

softirqTime: number = 0

softirq: servicing softirqs

stealTime

stealTime: number = 0

steal: involuntary wait, since 2.6.11

systemTime

systemTime: number = 0

system: processes executing in kernel mode

totalTime

totalTime: number = 0

Total time

userTime

userTime: number = 0

user: normal processes executing in user mode

MessageConstants

MessageConstants: object

LOGGER

LOGGER: string = "LOGGER"

TRACE

TRACE: string = "TRACE"

TRACENODE

TRACENODE: string = "TRACENODE"

MetricType

MetricType: object

COUNTER

COUNTER: string = "COUNTER"

FASTCOMPASS

FASTCOMPASS: string = "FASTCOMPASS"

GAUGE

GAUGE: string = "GAUGE"

HISTOGRAM

HISTOGRAM: string = "HISTOGRAM"

METER

METER: string = "METER"

METRICSET

METRICSET: string = "METRICSET"

TIMER

TIMER: string = "TIMER"

MetricsConstants

MetricsConstants: object

CLIENT_TIME_OUT

CLIENT_TIME_OUT: number = 3000

EVT_METRIC_CREATE

EVT_METRIC_CREATE: string = "METRIC_CREATE"

EVT_METRIC_UPDATE

EVT_METRIC_UPDATE: string = "METRIC_UPDATE"

GLOBAL_METRICS_KEY

GLOBAL_METRICS_KEY: string = "GLOBAL_METRICS_CLIENT"

MESSENGER_DOWNLINK_KEY

MESSENGER_DOWNLINK_KEY: string = "MESSENGER_DOWNLINK"

MESSENGER_PREFIX

MESSENGER_PREFIX: string = "ENDPOINT"

MESSENGER_SPLIT

MESSENGER_SPLIT: string = "_"

MESSENGER_UPLINK_KEY

MESSENGER_UPLINK_KEY: string = "MESSENGER_UPLINK"

METRICS_CLI_IPC_NAME

METRICS_CLI_IPC_NAME: string = "PANDORA_METRIC_CLI"

METRICS_DEFAULT_APP

METRICS_DEFAULT_APP: string = "DEFAULT_APP"

METRICS_PANDORA_KEY

METRICS_PANDORA_KEY: string = "PANDORA_METRIC"

SERVER_DISCOVER_KEY_PREFIX

SERVER_DISCOVER_KEY_PREFIX: string = "METRIC_DISCOVER_KEY"

SOCKET_FILE_NAME

SOCKET_FILE_NAME: string = "pandora_metric"

NetworkTrafficText

NetworkTrafficText: object

TCP_ACTIVE_OPENS

TCP_ACTIVE_OPENS: string = "tcp.active.opens"

TCP_ATTEMPT_FAILS

TCP_ATTEMPT_FAILS: string = "tcp.attempt.fails"

TCP_CURR_RESETS

TCP_CURR_RESETS: string = "tcp.curr.resets"

TCP_ESTAB_RESETS

TCP_ESTAB_RESETS: string = "tcp.estab.resets"

TCP_IN_ERRS

TCP_IN_ERRS: string = "tcp.in.errs"

TCP_IN_SEGS

TCP_IN_SEGS: string = "tcp.in.segs"

TCP_OUT_RSTS

TCP_OUT_RSTS: string = "tcp.out.rsts"

TCP_OUT_SEGS

TCP_OUT_SEGS: string = "tcp.out.segs"

TCP_PASSIVE_OPENS

TCP_PASSIVE_OPENS: string = "tcp.passive.opens"

TCP_RETRAN_SEGS

TCP_RETRAN_SEGS: string = "tcp.retran.segs"

STR_MAP

STR_MAP: object

APP

APP: IndicatorScope = IndicatorScope.APP

PROCESS

PROCESS: IndicatorScope = IndicatorScope.PROCESS

SYSTEM

SYSTEM: IndicatorScope = IndicatorScope.SYSTEM

app

app: IndicatorScope = IndicatorScope.APP

process

process: IndicatorScope = IndicatorScope.PROCESS

system

system: IndicatorScope = IndicatorScope.SYSTEM