Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
plugins: {
express: {
enabled: true,
path: '@opentelemetry/plugin-express',
ignoreLayersType: [
"middleware",
"request_handler",
],
},
http: {
enabled: true,
path: '@opentelemetry/plugin-http',
}
}
});
const exporter = new TraceExporter();
provider.addSpanProcessor(new BatchSpanProcessor(exporter));
provider.register();
// Registration. Use W3C trace context propagation with `traceparent` header.
opentelemetry.trace.setGlobalTracerProvider(provider);
opentelemetry.propagation.setGlobalPropagator(new HttpTraceContext());
// Load express afterwords.
var express = require('express');
var bodyParser = require('body-parser');
var swaggerTools = require('swagger-tools');
/**
* @typedef {Object} InitializationOptions
* @property {Boolean} log Log incoming requests.
module.exports = () => {
const provider = new NodeTracerProvider({
// Use grpc plugin to receive trace contexts from client (checkout)
plugins: {
grpc: {
enabled: true,
path: '@opentelemetry/plugin-grpc',
}
}
});
provider.addSpanProcessor(new BatchSpanProcessor(new TraceExporter()));
// Initialize the OpenTelemetry APIs to use the NodeTracerProvider bindings
provider.register();
return opentelemetry.trace.getTracer('payment');
}
const {NodeTracerProvider} = require('@opentelemetry/node');
const {BatchSpanProcessor} = require('@opentelemetry/tracing');
const {TraceExporter} = require('@google-cloud/opentelemetry-cloud-trace-exporter');
// OpenTelemetry tracing with exporter to Google Cloud Trace
const provider = new NodeTracerProvider({
// Use grpc plugin to receive trace contexts from client
plugins: {
grpc: {
enabled: true,
path: '@opentelemetry/plugin-grpc',
}
}
});
// Cloud Trace Exporter handles credentials.
const exporter = new TraceExporter();
provider.addSpanProcessor(new BatchSpanProcessor(exporter));
provider.register();
const tracer = opentelemetry.trace.getTracer('currency');
const path = require('path');
const grpc = require('grpc');
const request = require('request');
const xml2js = require('xml2js');
const pino = require('pino');
const protoLoader = require('@grpc/proto-loader');
const MAIN_PROTO_PATH = path.join(__dirname, './proto/demo.proto');
const HEALTH_PROTO_PATH = path.join(__dirname, './proto/grpc/health/v1/health.proto');
const PORT = 7000;
const DATA_URL = 'http://www.ecb.europa.eu/stats/eurofxref/eurofxref-daily.xml';