How to use the @opentelemetry/core.HttpTraceContext function in @opentelemetry/core

To help you get started, we’ve selected a few @opentelemetry/core 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
"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`.
github open-telemetry / opentelemetry-js / packages / opentelemetry-tracing / src / config.ts View on Github external
export const DEFAULT_MAX_EVENTS_PER_SPAN = 128;
/** Default limit for Attributes per span */
export const DEFAULT_MAX_ATTRIBUTES_PER_SPAN = 32;
/** Default limit for Links per span */
export const DEFAULT_MAX_LINKS_PER_SPAN = 32;

/**
 * Default configuration. For fields with primitive values, any user-provided
 * value will override the corresponding default value. For fields with
 * non-primitive values (like `traceParams`), the user-provided value will be
 * used to extend the default value.
 */
export const DEFAULT_CONFIG = {
  defaultAttributes: {},
  binaryFormat: new BinaryTraceContext(),
  httpTextFormat: new HttpTraceContext(),
  logLevel: LogLevel.DEBUG,
  sampler: ALWAYS_SAMPLER,
  scopeManager: new NoopScopeManager(),
  traceParams: {
    numberOfAttributesPerSpan: DEFAULT_MAX_ATTRIBUTES_PER_SPAN,
    numberOfLinksPerSpan: DEFAULT_MAX_LINKS_PER_SPAN,
    numberOfEventsPerSpan: DEFAULT_MAX_EVENTS_PER_SPAN,
  },
};