Skip to content

Instantly share code, notes, and snippets.

@rohit1kumar
Last active October 1, 2025 18:22
Show Gist options
  • Select an option

  • Save rohit1kumar/f7473bd9af7ff35f3a35dd53ef078121 to your computer and use it in GitHub Desktop.

Select an option

Save rohit1kumar/f7473bd9af7ff35f3a35dd53ef078121 to your computer and use it in GitHub Desktop.
signoz setup
OTEL_LOG_LEVEL=debug OTEL_SERVICE_NAME=my_app OTEL_EXPORTER_OTLP_LOGS_ENDPOINT=http://ip:4318/v1/logs OTEL_RESOURCE_ATTRIBUTES="service.name=my_app,service.version=1.2.3" node -r ./tracing.js app.js
{
"dependencies": {
"@opentelemetry/auto-instrumentations-node": "^0.64.1",
"@opentelemetry/exporter-trace-otlp-http": "^0.205.0",
"@opentelemetry/sdk-node": "^0.205.0",
"pino": "^9.11.0",
"pino-opentelemetry-transport": "^1.1.0"
}
}
'use strict'
const process = require('process')
const opentelemetry = require('@opentelemetry/sdk-node')
const { getNodeAutoInstrumentations } = require('@opentelemetry/auto-instrumentations-node')
const { OTLPTraceExporter } = require('@opentelemetry/exporter-trace-otlp-http')
const exporterOptions = {
url: 'http://my-ip:4318/v1/traces',
}
const traceExporter = new OTLPTraceExporter(exporterOptions)
const sdk = new opentelemetry.NodeSDK({
traceExporter,
instrumentations: [getNodeAutoInstrumentations()],
})
sdk.start()
process.on('SIGTERM', () => {
sdk
.shutdown()
.then(() => console.log('Tracing terminated'))
.catch((error) => console.log('Error terminating tracing', error))
.finally(() => process.exit(0))
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment