Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
"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.
* @property {Object} swagger Swagger document object.
*/
/**
* Creates an Express.js application which implements a Bookstore
"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.
* @property {Object} swagger Swagger document object.
*/
/**
* Creates an Express.js application which implements a Bookstore
* API defined in `swagger.json`.
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');
}
// 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';
const shopProto = _loadProto(MAIN_PROTO_PATH).hipstershop;
const healthProto = _loadProto(HEALTH_PROTO_PATH).grpc.health.v1;