{"_id":"@blued-core-oversea/node-prometheus-sdk-web","_rev":"1-6e766f43fc605fd8265268e5fe84e815","name":"@blued-core-oversea/node-prometheus-sdk-web","dist-tags":{"latest":"1.0.1"},"versions":{"1.0.0":{"name":"@blued-core-oversea/node-prometheus-sdk-web","version":"1.0.0","description":"```bash npm i @blued-core-oversea/node-prometheus-sdk ``` ### API 列表&说明 - **_recordHTTP(data: HTTPPrometheus)_**   - 描述：接口相关数据上报【指标数据单位：毫秒「ms」】   - Metrics类型（1）：CounterVec     - Name：prometheus_push_gateway_requests_total     - Args：【\"project\", \"host\", \"c","main":"dist/index.js","scripts":{"build":"rm -rf dist && tsc","watch":"tsc -w","test":"nodemon dist/test_clusterclient"},"keywords":[],"author":"","license":"ISC","dependencies":{},"devDependencies":{"@commitlint/cli":"^7.5.2","@commitlint/config-conventional":"^7.5.0","@types/chai":"^4.1.7","@types/mocha":"^5.2.7","@types/node":"^11.13.4","@typescript-eslint/eslint-plugin":"^1.6.0","chai":"^4.2.0","commitizen":"^3.0.7","eslint":"^5.16.0","eslint-config-blued-typescript":"^1.0.1","eslint-plugin-import":"^2.16.0","mocha":"^6.1.4","ts-node":"^8.0.3","typescript":"^3.4.3"},"publishConfig":{"access":"public"},"gitHead":"2812e2b0a820f1c7a9a0470fbc065aa282aaabf1","_id":"@blued-core-oversea/node-prometheus-sdk-web@1.0.0","_nodeVersion":"12.18.3","_npmVersion":"6.14.6","dist":{"integrity":"sha512-h1w+BWSloayrBgHdj79JL+sr3J0SotFu66SCfNR1ymYIXL8/bj55vZhgF6XcL/Ka0zqLk1RoD1IWulKZTx/ALw==","shasum":"bfb364189dd0aa96ecfa2ce0a5409011fe4dd861","tarball":"https://registry.npmjs.org/@blued-core-oversea/node-prometheus-sdk-web/-/node-prometheus-sdk-web-1.0.0.tgz","fileCount":11,"unpackedSize":21007,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDKeBQx/ajsrAGkz6RJSwSxTSYxG68anqRA5zJNXJZ2oAIhANwLIXMZEyIVPGN/raIodVgD4fQEh+wkTttzWspRNX44"}]},"_npmUser":{"name":"bluediapp","email":"iappdeveloper@blued.com"},"directories":{},"maintainers":[{"name":"bluediapp","email":"iappdeveloper@blued.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/node-prometheus-sdk-web_1.0.0_1717481943876_0.20860452056575918"},"_hasShrinkwrap":false},"1.0.1":{"name":"@blued-core-oversea/node-prometheus-sdk-web","version":"1.0.1","description":"```bash npm i @blued-core-oversea/node-prometheus-sdk ``` ### API 列表&说明 - **_recordHTTP(data: HTTPPrometheus)_**   - 描述：接口相关数据上报【指标数据单位：毫秒「ms」】   - Metrics类型（1）：CounterVec     - Name：prometheus_push_gateway_requests_total     - Args：【\"project\", \"host\", \"c","main":"dist/index.js","scripts":{"build":"rm -rf dist && tsc","watch":"tsc -w","test":"nodemon dist/test_clusterclient"},"keywords":[],"author":"","license":"ISC","dependencies":{"dgram":"^1.0.1"},"devDependencies":{"@commitlint/cli":"^7.5.2","@commitlint/config-conventional":"^7.5.0","@types/chai":"^4.1.7","@types/mocha":"^5.2.7","@types/node":"^11.13.4","@typescript-eslint/eslint-plugin":"^1.6.0","chai":"^4.2.0","commitizen":"^3.0.7","eslint":"^5.16.0","eslint-config-blued-typescript":"^1.0.1","eslint-plugin-import":"^2.16.0","mocha":"^6.1.4","ts-node":"^8.0.3","typescript":"^3.4.3"},"publishConfig":{"access":"public"},"gitHead":"726af190ed44472450ad9c34af6f91835bb73d2d","_id":"@blued-core-oversea/node-prometheus-sdk-web@1.0.1","_nodeVersion":"12.18.3","_npmVersion":"6.14.6","dist":{"integrity":"sha512-X6x5Yz/wqaTMI6cst889nwc6PDKPz5/ANBmssvuMJ0X6pUI+mFbQaHwMKoXwQu39f0iQScdMS2U1tv2xttAU5w==","shasum":"4313f6aa04def538dd45df6be69052573d9f0cec","tarball":"https://registry.npmjs.org/@blued-core-oversea/node-prometheus-sdk-web/-/node-prometheus-sdk-web-1.0.1.tgz","fileCount":11,"unpackedSize":21032,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDoHVKNX1RC1ICBIqbw8ql3T2Sv+7BPck2liQ9Cv0ZgcgIgFwGD2+OEJtoUi4p2jQAfvNinyHXljADkCJyEn4YLyAw="}]},"_npmUser":{"name":"bluediapp","email":"iappdeveloper@blued.com"},"directories":{},"maintainers":[{"name":"bluediapp","email":"iappdeveloper@blued.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/node-prometheus-sdk-web_1.0.1_1717482250028_0.7460056092648095"},"_hasShrinkwrap":false}},"time":{"created":"2024-06-04T06:19:03.777Z","1.0.0":"2024-06-04T06:19:04.041Z","modified":"2024-06-04T06:24:10.332Z","1.0.1":"2024-06-04T06:24:10.165Z"},"maintainers":[{"name":"bluediapp","email":"iappdeveloper@blued.com"}],"description":"```bash npm i @blued-core-oversea/node-prometheus-sdk ``` ### API 列表&说明 - **_recordHTTP(data: HTTPPrometheus)_**   - 描述：接口相关数据上报【指标数据单位：毫秒「ms」】   - Metrics类型（1）：CounterVec     - Name：prometheus_push_gateway_requests_total     - Args：【\"project\", \"host\", \"c","keywords":[],"license":"ISC","readme":"### 下载\n```bash\nnpm i @blued-core-oversea/node-prometheus-sdk\n```\n### API 列表&说明\n- **_recordHTTP(data: HTTPPrometheus)_**\n  - 描述：接口相关数据上报【指标数据单位：毫秒「ms」】\n  - Metrics类型（1）：CounterVec\n    - Name：prometheus_push_gateway_requests_total\n    - Args：【\"project\", \"host\", \"code\", \"method\", \"url\"】\n  - Metrics类型（2）：HistogramVec\n    - Name：prometheus_push_gateway_request_duration_seconds\n    - Args：【\"project\", \"host\", \"code\", \"method\", \"url\"】            \n- **_recordPCountErr(data: PCountErrPrometheus)_**\n  - 描述：自定义错误相关信息上报\n  - Metrics类型：CounterVec \n    - Name：prometheus_push_gateway_error_total\n    - Args：【\"project\", \"host\", \"code\"】\n- **_recordPCount(data: PCountPrometheus)_**\n  - 描述：自定义 counter 指标上报\n  - Metrics类型：CounterVec\n    - Name：prometheus_push_gateway_user_defined_count\n    - Args：【\"project\", \"host\", \"code\"】\n- **_recordPCountWithIncVal(data: PCountWithIncValPrometheus)_**\n  - 注意：H5 暂时不支持该 API\n  - 描述：自定义 counter 指标上报(带有自定义递增的数量)\n  - Metrics类型：CounterVec\n    - Name：prometheus_push_gateway_user_defined_count_with_inc_val\n    - Args：【\"project\", \"host\", \"code\"】\n- **_recordPLatencyHTTP(data: PLatencyPrometheus)_**\n  - 描述：第三方接口调用延迟上报【指标数据单位：毫秒「ms」】\n  - Metrics类型：HistogramVec\n    - Name：prometheus_push_gateway_http_operation_duration\n    - Args：【\"project\", \"host\", \"code\"】\n- **_recordPGauge(data: PGaugePrometheus)_**\n  - 描述：自定义 gauge 指标上报\n  - Metrics类型：GaugeVec\n    - Name：prometheus_push_gateway_user_defined_gauge\n    - Args：【\"project\", \"host\", \"code\"】\n- **_recordPLatency(data: PLatencyPrometheus)_**\n  - 描述：自定义延迟上报【指标数据单位：毫秒「ms」】\n  - Metrics类型：HistogramVec\n    - Name：prometheus_push_gateway_operation_duration\n    - Args：【\"project\", \"host\", \"code\"】\n\n\n### 使用方式\n```typescript\nimport { PrometheusSDK } from '@blued-core-oversea/node-prometheus-sdk-web'\n\nconst promeSDK = new PrometheusSDK('live_http', {\n  host: '127.0.0.1:30001',\n})\n\nconst main = () => {\n  // http 接口相关统计\n  promeSDK.recordHTTP({\n    status: 200,\n    method: 'POST',\n    url: '/live/index',\n    val: 150,\n  })\n\n  // 自定义错误相关信息统计\n  promeSDK.recordPCountErr({\n    code: 'redis_query_err',\n  })\n\n  // 自定义延迟统计\n  promeSDK.recordPLatency({\n    code: 'redis_query',\n    val: 300,\n  })\n\n  // 第三方接口调用统计\n  promeSDK.recordPLatencyHTTP({\n    code: '/user/10',\n    val: 240,\n  })\n\n  // 自定义 counter 指标上报\n  promeSDK.recordPGauge({\n    code: 'test_gauge',\n    val: 120,\n  })\n\n  // 自定义 gauge 指标上报\n  promeSDK.recordPCount({\n    code: 'test_counter',\n  })\n\n  console.log('------------main func over')\n}\n\nmain()\nconsole.log('------------over')\n```","readmeFilename":"README.md"}