You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Heya, I'm having the same issue as #3503 but can't wrap my head around a fix...
here is the setup:
tracer.ts
import{getNodeAutoInstrumentations}from'@opentelemetry/auto-instrumentations-node'import{OTLPTraceExporter}from'@opentelemetry/exporter-trace-otlp-http'import{dockerCGroupV1Detector}from'@opentelemetry/resource-detector-docker'import{Resource}from'@opentelemetry/resources'import{NodeSDK}from'@opentelemetry/sdk-node'import{BatchSpanProcessor}from'@opentelemetry/sdk-trace-base'import{SemanticResourceAttributes}from'@opentelemetry/semantic-conventions'constexporter=newOTLPTraceExporter({url: 'http://localhost:4318/v1/traces'})constsdk=newNodeSDK({spanProcessor: newBatchSpanProcessor(exporter),resource: newResource({[SemanticResourceAttributes.SERVICE_NAME]: `Rest-API`// update this to a more relevant name for you!}),resourceDetectors: [dockerCGroupV1Detector],instrumentations: [getNodeAutoInstrumentations()]})sdk.start()// gracefully shut down the SDK on process exitprocess.on('SIGTERM',()=>{sdk.shutdown().then(()=>console.log('SDK shut down successfully'),(err)=>console.log('Error shutting down SDK',err)).finally(()=>process.exit(0))})exportdefaultsdk
main.ts
importtracerfrom'./tracer'import{ValidationPipe,VersioningType}from'@nestjs/common'import{ConfigService}from'@nestjs/config'import{NestFactory}from'@nestjs/core'import{NestExpressApplication}from'@nestjs/platform-express'import{DocumentBuilder,SwaggerModule}from'@nestjs/swagger'import{AppUtils}from'core-nestjs'importhelmetfrom'helmet'import{CustomLoggerService}from'logger'import{AppModule}from'./app.module'asyncfunctionbootstrap(){// tracingtracer.start()constapp=awaitNestFactory.create<NestExpressApplication>(AppModule,{bufferLogs: true})/** * Register the logger */constlogger=awaitapp.resolve(CustomLoggerService)logger.setService('Rest-API')logger.setType('app')app.useLogger(logger)/** * App cleanup */AppUtils.killAppWithGrace(app)/** * To load ENV variables we use the ConfigService provided by NestJS * https://docs.nestjs.com/techniques/configuration#using-in-the-maints */constconfigService=app.get(ConfigService)constport=configService.get('PORT')/** * TODO restrict domain access */app.enableCors()app.enableVersioning({type: VersioningType.URI})/** * Enable validation */app.useGlobalPipes(newValidationPipe({transform: true,whitelist: true}))// Middlewareapp.use(helmet())/** * Configure swagger */constconfig=newDocumentBuilder().setTitle('Rest-API').setDescription('### *http api used for authentication, resource creation and update*\n\nMost of the requests return a `202 accepted` response,\n\nthe actual result is provided by connecting and listening to events from the gateway.').setVersion('0.0').addSecurity('token',{in: 'header',type: 'apiKey',name: 'Authorization'}).addSecurityRequirements('token').build()constdocument=SwaggerModule.createDocument(app,config)SwaggerModule.setup('api',app,document,{swaggerOptions: {persistAuthorization: true}})awaitapp.listen(port)}bootstrap()
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Heya, I'm having the same issue as #3503 but can't wrap my head around a fix...
here is the setup:
tracer.ts
main.ts
and the packages version:
Beta Was this translation helpful? Give feedback.
All reactions