How to use @opencensus/propagation-stackdriver - 4 common examples

To help you get started, we’ve selected a few @opencensus/propagation-stackdriver 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 googleapis / cloud-trace-nodejs / src / tracing.ts View on Github external
.get()
      .initialize()
      .catch(err => {
        this.logger.error(
          'StackdriverTracer#start: Disabling the Trace Agent for the',
          `following reason: ${err.message}`
        );
        this.disable();
      });
    cls.get().enable();

    const tracePolicy =
      this.config.overrides.tracePolicy ||
      new BuiltinTracePolicy(this.config.tracePolicyConfig);
    const propagation =
      this.config.overrides.propagation || new StackdriverFormat();

    const tracerComponents = {logger: this.logger, tracePolicy, propagation};

    this.traceAgent.enable(
      this.config.pluginLoaderConfig.tracerConfig,
      tracerComponents
    );
    pluginLoader
      .create(this.config.pluginLoaderConfig, tracerComponents)
      .activate();

    // Require http and https again, now that the plugin loader is activated.
    // This forces them to be patched.
    require('http');
    require('https');
github googleapis / nodejs-logging / src / middleware / context.ts View on Github external
export function getOrInjectContext(
  headerWrapper: HeaderWrapper
): context.SpanContext {
  let spanContext = context.extract(headerWrapper);
  if (spanContext) {
    return spanContext;
  }

  // We were the first actor to detect lack of context. Establish context.
  spanContext = context.generate();
  context.inject(headerWrapper, spanContext);
  return spanContext;
}
github googleapis / nodejs-logging / src / middleware / context.ts View on Github external
export function getOrInjectContext(
  headerWrapper: HeaderWrapper
): context.SpanContext {
  let spanContext = context.extract(headerWrapper);
  if (spanContext) {
    return spanContext;
  }

  // We were the first actor to detect lack of context. Establish context.
  spanContext = context.generate();
  context.inject(headerWrapper, spanContext);
  return spanContext;
}
github googleapis / nodejs-logging / src / middleware / context.ts View on Github external
export function getOrInjectContext(
  headerWrapper: HeaderWrapper
): context.SpanContext {
  let spanContext = context.extract(headerWrapper);
  if (spanContext) {
    return spanContext;
  }

  // We were the first actor to detect lack of context. Establish context.
  spanContext = context.generate();
  context.inject(headerWrapper, spanContext);
  return spanContext;
}

@opencensus/propagation-stackdriver

Opencensus propagation package for Stackdriver format.

Apache-2.0
Latest version published 3 years ago

Package Health Score

59 / 100
Full package analysis