@3rdi/fastify-jaeger-middleware 中文文档教程
fastify-jaeger-middleware
Install
npm i @3rdi/fastify-jaeger-middleware --save
Usage
首先按照 https://github.com/jaegertracing/jaeger-client-node 中的指南创建一个 jaeger 跟踪器
var initTracer = require('jaeger-client').initTracer;
// See schema https://github.com/jaegertracing/jaeger-client-node/blob/master/src/configuration.js#L37
var config = {
serviceName: 'my-awesome-service',
reporter: {
// Provide the traces endpoint; this forces the client to connect directly to the Collector and send
// spans over HTTP
collectorEndpoint: 'http://jaeger-collector:14268/api/traces',
// Provide username and password if authentication is enabled in the Collector
// username: '',
// password: '',
},
};
var options = {
tags: {
'my-awesome-service.version': '1.1.2',
},
metrics: metrics,
logger: logger,
};
var tracer = initTracer(config, options);
然后注册中间件并使用跟踪器实例化它。
const jaegerMiddleware = require('@3rdi/fastify-jaeger-middleware');
fastify.register(jaegerMiddleware, { tracer: jaegerTracer });
这会给你一个像这样的 jaeger 报告。
License
在 麻省理工学院。
fastify-jaeger-middleware
Install
npm i @3rdi/fastify-jaeger-middleware --save
Usage
First create a jaeger tracer by following the guide from https://github.com/jaegertracing/jaeger-client-node
var initTracer = require('jaeger-client').initTracer;
// See schema https://github.com/jaegertracing/jaeger-client-node/blob/master/src/configuration.js#L37
var config = {
serviceName: 'my-awesome-service',
reporter: {
// Provide the traces endpoint; this forces the client to connect directly to the Collector and send
// spans over HTTP
collectorEndpoint: 'http://jaeger-collector:14268/api/traces',
// Provide username and password if authentication is enabled in the Collector
// username: '',
// password: '',
},
};
var options = {
tags: {
'my-awesome-service.version': '1.1.2',
},
metrics: metrics,
logger: logger,
};
var tracer = initTracer(config, options);
Then register the middleware and instantiate this with the tracer.
const jaegerMiddleware = require('@3rdi/fastify-jaeger-middleware');
fastify.register(jaegerMiddleware, { tracer: jaegerTracer });
This will give you a report in jaeger like this.
License
Licensed under MIT.
更多
你可能也喜欢
- @01ht/ht-elements-item 中文文档教程
- @0xcert/ethereum-asset-ledger 中文文档教程
- @134dd3v/prettier-plugin-solidity 中文文档教程
- @1hive/connect-thegraph-conviction-voting 中文文档教程
- @2003scape/rsc-bestiary 中文文档教程
- @211-connect/boundaries.io-sdk 中文文档教程
- @21kb/react-vibration-hook 中文文档教程
- @4a/sms 中文文档教程
- @59naga/array.from 中文文档教程
- @8om.io/ui-components 中文文档教程