How to use the @opencensus/web-types.SpanKind function in @opencensus/web-types

To help you get started, we’ve selected a few @opencensus/web-types 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 census-instrumentation / opencensus-web / packages / opencensus-web-core / src / trace / model / span.ts View on Github external
/** Whether this span is a RootSpan */
  get isRootSpan(): boolean {
    return this.parentSpanId === '';
  }

  /** Trace id asscoiated with span. */
  traceId = '';

  /** Trace state associated with span */
  traceState: webTypes.TraceState = '';

  /** The display name of the span. */
  name = DEFAULT_SPAN_NAME;

  /** Kind of span. */
  kind: webTypes.SpanKind = webTypes.SpanKind.UNSPECIFIED;

  /** An object to log information to. Logs to the JS console by default. */
  logger: webTypes.Logger = console;

  /**
   * Status associated with this span. Defaults to OK status. Note that the
   * `code` is not an HTTP status, but is a specific trace status code. See:
   * https://github.com/census-instrumentation/opencensus-specs/blob/master/trace/HTTP.md#mapping-from-http-status-codes-to-trace-status-codes
   */
  status: webTypes.Status = { code: webTypes.CanonicalCode.OK };

  /** A set of attributes, each in the format [KEY]:[VALUE] */
  attributes: webTypes.Attributes = {};

  /** Text annotations with a set of attributes. */
  annotations: webTypes.Annotation[] = [];
github census-instrumentation / opencensus-web / packages / opencensus-web-core / src / trace / model / root-span.ts View on Github external
constructor(
    /** Trace associated with this root span. */
    private readonly tracer: webTypes.TracerBase,
    /** A trace options object to build the root span. */
    context?: webTypes.TraceOptions
  ) {
    super();

    if (context) {
      this.name = context.name;
      this.kind = context.kind || webTypes.SpanKind.UNSPECIFIED;

      const spanContext = context.spanContext;
      if (spanContext) {
        this.parentSpanId = spanContext.spanId || '';
        this.traceId = spanContext.traceId;
        this.traceState = spanContext.traceState || '';
      }
    } else {
      this.traceId = randomTraceId();
    }
  }

@opencensus/web-types

OpenCensus Web types is a slightly-patched copy of the `types.ts` files from `@opencensus/core` so that they can be easily imported in web-specific packages.

Apache-2.0
Latest version published 5 years ago

Package Health Score

59 / 100
Full package analysis