How to use the @google-cloud/opentelemetry-cloud-trace-exporter.TraceExporter function in @google-cloud/opentelemetry-cloud-trace-exporter

To help you get started, we’ve selected a few @google-cloud/opentelemetry-cloud-trace-exporter examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github GoogleCloudPlatform / esp-v2 / tests / endpoints / bookstore / http_bookstore.js View on Github external
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.
github GoogleCloudPlatform / cloud-ops-sandbox / src / paymentservice / tracer.js View on Github external
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');
}
github GoogleCloudPlatform / cloud-ops-sandbox / src / currencyservice / server.js View on Github external
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';

@google-cloud/opentelemetry-cloud-trace-exporter

OpenTelemetry Google Cloud Trace Exporter allows the user to send collected traces to Google Cloud Trace.

Apache-2.0
Latest version published 3 months ago

Package Health Score

90 / 100
Full package analysis

Popular @google-cloud/opentelemetry-cloud-trace-exporter functions