Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import {PrometheusStatsExporter} from '@opencensus/exporter-prometheus';
import {globalStats} from '@opencensus/core';
import {registerAllViews} from '@opencensus/instrumentation-http';
import {runMigrations} from './runMigrations';
const {sequelize} = require('@fbcnms/sequelize-models');
const logger = logging.getLogger(module);
const port = parseInt(process.env.PORT || 80);
// Configure metrics
const prometheusExporter = new PrometheusStatsExporter({
startServer: true,
logger,
});
globalStats.registerExporter(prometheusExporter);
registerAllViews(globalStats);
let jaegerExporter = null;
if (process.env.TELEMETRY_TRACE_EXPORTER == 'jaeger') {
if (
!process.env.JAEGER_AGENT_ENDPOINT &&
!process.env.JAEGER_COLLECTOR_ENDPOINT
) {
throw new Error(
'When using TELEMETRY_TRACE_EXPORTER = "jaeger", you ' +
'must set either JAEGER_AGENT_ENDPOINT or JAEGER_COLLECTOR_ENDPOINT',
);
}
// Configure opencensus for jaeger
const agentEndpoint = process.env.JAEGER_AGENT_ENDPOINT;
const [agentHost, agentPort] = agentEndpoint
? agentEndpoint.split(':')