- Add #domain, #protocol, #utils aliases to package.json imports map - Replace all relative imports (./, ../, ../..) in app/ and database/mongo_migrations/ with the corresponding #alias imports, eliminating relative path traversal across the codebase - Remove dead code: ConfigurationVersionModel.findByConfigurationIdentifier (unused, superseded by paginateVersions) and unused exception classes (NotFoundException, UnprocessableEntityException, DatabaseException) from app/exceptions/index.ts, keeping only BadRequestException - Fix pre-existing syntax error in configuration_version.ts (mismatched parenthesis) that broke tsc - Fix eqeqeq violation in configuration_service.ts and isNaN -> Number.isNaN in configuration_engine.ts / cwmp-1-0.ts / exchange_controller.ts - Fix no-shadow violation in cwmp-1-0.ts EventStruct constructor - Prettier formatting pass on touched files Validated: tsc --noEmit clean, eslint app/ clean, full test suite green.
29 lines
767 B
TypeScript
29 lines
767 B
TypeScript
import env from '#start/env'
|
|
|
|
let initialized = false
|
|
|
|
export function initTelemetry() {
|
|
if (initialized) return
|
|
initialized = true
|
|
|
|
const exporterUri = env.get('OTEL_EXPORTER_URI')
|
|
if (!exporterUri) return
|
|
|
|
// OpenTelemetry setup is optional - only initialize when available
|
|
import('@opentelemetry/sdk-node')
|
|
.then(({ NodeSDK }) => {
|
|
return import('@opentelemetry/auto-instrumentations-node').then(
|
|
({ getNodeAutoInstrumentations }) => {
|
|
const sdk = new NodeSDK({
|
|
serviceName: env.get('OTEL_SERVICE_NAME', 'papaye-v2'),
|
|
instrumentations: [getNodeAutoInstrumentations()],
|
|
})
|
|
sdk.start()
|
|
}
|
|
)
|
|
})
|
|
.catch(() => {
|
|
// OpenTelemetry not available, skip
|
|
})
|
|
}
|