This content originally appeared on DEV Community and was authored by Anuwong Mongkudkornburee
Once my team have to track the application behavior after it had been deployed to production for a few months. We are looking for an easy way to add the tracing things on top of production-ready application. so we developed this package. nestjs-jaeger-tracing.
To use this module, you just import TracingModule
to your AppModule and initiate with forRoot()
to add app level interceptor to deserialize microservice payload. Then add serializer which will inject tracing id to payload, like this.
import { TracingModule } from '@dollarsign/nestjs-jaeger-tracing';
import { Module } from '@nestjs/common';
import { ClientsModule, Transport } from '@nestjs/microservices';
@Module({
imports: [
TracingModule.forRoot({
exporterConfig: {
serviceName: 'core-service', // service name that will be shown in jaeger dashboard
},
isSimpleSpanProcessor: true, // true for development.
}),
ClientsModule.register([
{
name: 'MATH_SERVICE',
transport: Transport.TCP,
options: {
port: 3001,
...TracingModule.getParserOptions(), // this method will return serializer that inject tracing id to microservice payload.
},
},
]),
],
})
export class AppModule {}
Now, your application will be sent data to jaeger agent so you can trace your application in Jaeger Dashboard. hurayyyy!
It has so much work to do more, so feel free to use and contribute for your works.
This content originally appeared on DEV Community and was authored by Anuwong Mongkudkornburee
Anuwong Mongkudkornburee | Sciencx (2021-04-30T16:41:49+00:00) NestJS Jaeger(and others) Tracing Module for microservices. You’ll loved it! ❤️. Retrieved from https://www.scien.cx/2021/04/30/nestjs-jaegerand-others-tracing-module-for-microservices-youll-loved-it-%e2%9d%a4%ef%b8%8f/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.