Options
All
  • Public
  • Public/Protected
  • All
Menu

pandora-hook

Index

Type aliases

bufferTransformer

bufferTransformer: function

Type declaration

    • (buffer: any, req?: IncomingMessage): any | string
    • Parameters

      • buffer: any
      • Optional req: IncomingMessage

      Returns any | string

requestFilter

requestFilter: function

Type declaration

    • (req: any): boolean
    • Parameters

      • req: any

      Returns boolean

Variables

CLEANER

CLEANER: RegExp = /^\(?(?:([`'"]?)(.*?)\1\.)?([`'"]?)(.*?)\3\)?$/

COLLECTION_OPS

COLLECTION_OPS: string[] = ['aggregate','bulkWrite','count','createIndex','deleteMany','deleteOne','distinct','drop','dropAllIndexes','dropIndex','ensureIndex','findAndModify','findAndRemove','findOne','findOneAndDelete','findOneAndReplace','findOneAndUpdate','geoHaystackSearch','geoNear','group','indexes','indexExists','indexInformation','insert','insertMany','insertOne','isCapped','mapReduce','options','parallelCollectionScan','reIndex','remove','rename','replaceOne','save','stats','update','updateMany','updateOne']

COMMENT_PATTERN

COMMENT_PATTERN: RegExp = /\/\\*.*?\\*\//g

CURSOR_OPS

CURSOR_OPS: string[] = ['nextObject','next','toArray','count','explain']

DB_OPS

DB_OPS: string[] = ['addUser','authenticate','collection','collectionNames','collections','command','createCollection','createIndex','cursorInfo','dereference','dropCollection','dropDatabase','dropIndex','ensureIndex','eval','executeDbAdminCommand','indexInformation','logout','open','reIndex','removeUser','renameCollection','stats','_executeInsertCommand','_executeQueryCommand']

DEFAULT_HOST

DEFAULT_HOST: "localhost" = "localhost"

DEFAULT_PORT

DEFAULT_PORT: 80 = 80

GRID_OPS

GRID_OPS: string[] = ['put','get','delete']

HEADER_SPAN_ID

HEADER_SPAN_ID: "x-span-id" = "x-span-id"

HEADER_TRACE_ID

HEADER_TRACE_ID: "x-trace-id" = "x-trace-id"

HOST_UNKNOWN

HOST_UNKNOWN: "UnknownHost" = "UnknownHost"

INSTANCE_UNKNOWN

INSTANCE_UNKNOWN: "unknown" = "unknown"

OPERATIONS

OPERATIONS: StatementMatcher[] = [new StatementMatcher('select',/^[^\S]*?select\b[\s\S]+?\bfrom[\s\n\r\[\(]+([^\]\s\n\r,)(;]*)/gim),new StatementMatcher('update', /^[^\S]*?update[^\S]+?([^\s\n\r,;]+)/gim),new StatementMatcher('insert',/^[^\S]*?insert(?:[^\S]+ignore)?[^\S]+into[^\S]+([^\s\n\r(,;]+)/gim),new StatementMatcher('delete', /^[^\S]*?delete[^\S]+?from[^\S]+([^\s\n\r,(;]+)/gim)]

OPERATION_UNKNOWN

OPERATION_UNKNOWN: "other" = "other"

TABLE_UNKNOWN

TABLE_UNKNOWN: "UnknownTable" = "UnknownTable"

clsBluebird

clsBluebird: any = require('cls-bluebird')

debug

debug: any = require('debug')('PandoraHook:Log4js')

http

http: any = require('http')

https

https: any = require('https')

Functions

extractDatabaseChangeFromUse

  • extractDatabaseChangeFromUse(sql: any): string

extractPath

  • extractPath(requestUrl: any): any
  • 提取 path 信息,去掉尾部反斜杠

    Parameters

    • requestUrl: any

    Returns any

hasOwn

  • hasOwn(obj: any, key: any): any

isLocalhost

  • isLocalhost(host: any): boolean

listenerCount

  • listenerCount(emitter: any, evnt: any): any

nodeVersion

  • nodeVersion(rule: any): any

normalizeInfo

  • normalizeInfo(info: any, options?: object): any
  • 规范实例信息,主要是根据参数过滤以及处理空值

    Parameters

    • info: any

      实例信息

    • Default value options: object = {recordDatabaseName: true,recordInstance: true}

      参数配置 @property {boolean} recordDatabaseName - 是否记录数据库名称 @property {boolean} recordInstance - 是否记录数据库实例信息

      • recordDatabaseName: boolean
      • recordInstance: boolean

    Returns any

parseSql

  • parseSql(sql: any): any

Object literals

LOCALHOST_NAMES

LOCALHOST_NAMES: object

0.0.0.0

0.0.0.0: boolean = true

0:0:0:0:0:0:0:0

0:0:0:0:0:0:0:0: boolean = true

0:0:0:0:0:0:0:1

0:0:0:0:0:0:0:1: boolean = true

127.0.0.1

127.0.0.1: boolean = true

::

::: boolean = true

::1

::1: boolean = true

localhost

localhost: boolean = true

MetricsStat

MetricsStat: object

HTTP_ERROR_CODE

HTTP_ERROR_CODE: number = 400

HTTP_GROUP

HTTP_GROUP: string = "http"

HTTP_ILLEGAL_PATH

HTTP_ILLEGAL_PATH: string = "illegal_path"

HTTP_PATH

HTTP_PATH: string = "path"

HTTP_REQUEST

HTTP_REQUEST: string = "middleware.http.request"

HTTP

HTTP_REQUEST_PATH

HTTP_REQUEST_PATH: string = "middleware.http.request.path"