i trying to use signoz self-hosted (docker) to log traces in my nestjs application, my code ahows no errors but i still do not see any logs , traces in the signoz ui
// tracer.ts
'use strict';
import { getNodeAutoInstrumentations } from '@opentelemetry/auto-instrumentations-node';
import { OTLPTraceExporter } from '@opentelemetry/exporter-trace-otlp-http';
import { Resource } from '@opentelemetry/resources';
import { formattedLogger } from './utils/formatedLogger';
import { SemanticResourceAttributes } from '@opentelemetry/semantic-conventions';
import { ConfigService } from '@nestjs/config';
import { NodeSDK } from '@opentelemetry/sdk-node';
const logger = formattedLogger('Signoz');
telemetry data to SigNoz
const exporterOptions = {
url: 'http://server-ip:4318/v1/traces',
};
const traceExporter = new OTLPTraceExporter(exporterOptions);
const sdk = new NodeSDK({
traceExporter,
instrumentations: [
getNodeAutoInstrumentations({
'@opentelemetry/instrumentation-nestjs-core': { enabled: true },
}),
],
resource: new Resource({
[SemanticResourceAttributes.SERVICE_NAME]: 'imcoder-backend',
}),
});
sdk.start();
// Gracefully shut down the SDK on process exit
process.on('SIGTERM', () => {
sdk
.shutdown()
.then(() => logger.log('Tracing terminated'))
.catch((error) => logger.error('Error terminating tracing: ' + error))
.finally(() => process.exit(0));
});
process.on('SIGINT', () => {
sdk
.shutdown()
.then(() => logger.log('Tracing terminated'))
.catch((error) => logger.error('Error terminating tracing:' + error))
.finally(() => process.exit(0));
});
export default sdk;
Then im calling tracer in my main file:
// main.ts
…
tracer.start()
…