How to use the opentracing.Tags.SPAN_KIND function in opentracing

To help you get started, we’ve selected a few opentracing 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 RisingStack / opentracing-auto / src / instrumentation / mysql.spec.js View on Github external
it('should start and finish span', async () => {
      const query = 'SELECT 1 AS result'
      const result = await db.raw(query)

      expect(result[0]).to.be.eql([{ result: 1 }])

      expect(cls.startChildSpan).to.be.calledWith(tracer, `${instrumentation.OPERATION_NAME}_query`, {
        tags: {
          [Tags.SPAN_KIND]: Tags.SPAN_KIND_RPC_CLIENT,
          [Tags.DB_TYPE]: instrumentation.DB_TYPE,
          [Tags.DB_STATEMENT]: query
        }
      })

      // FIXME: only with ../instrument.js tests together
      // expect(mockChildSpan.finish).to.have.callCount(1)
    })
github zalando / tailor / lib / fragment.js View on Github external
? this.attributes.fallbackUrl
            : this.attributes.url;

        const spanOptions = parentSpan ? { childOf: parentSpan } : {};
        const span = tracer.startSpan('fetch_fragment', spanOptions);

        const {
            id,
            primary,
            async: isAsync,
            public: isPublic,
            timeout
        } = this.attributes;

        span.addTags({
            [Tags.SPAN_KIND]: Tags.SPAN_KIND_RPC_CLIENT,
            [Tags.HTTP_URL]: url,
            fallback: isFallback,
            public: isPublic,
            async: isAsync,
            id: id || 'unnamed',
            primary,
            timeout
        });

        this.requestFragment(url, this.attributes, request, span).then(
            res => this.onResponse(res, isFallback, span),
            err => {
                if (!isFallback) {
                    if (this.attributes.fallbackUrl) {
                        this.emit('fallback', err);
                        this.fetch(request, true, span);
github RisingStack / opentracing-auto / src / instrumentation / mongodbCore.js View on Github external
const spans = tracers.map((tracer) => cls.startChildSpan(tracer, operationName, {
        tags: {
          [Tags.SPAN_KIND]: Tags.SPAN_KIND_RPC_CLIENT,
          [Tags.DB_TYPE]: DB_TYPE,
          [Tags.DB_STATEMENT]: statement,
          [Tags.DB_INSTANCE]: ns
        }
      }))
github fapspirit / axios-opentracing / src / index.ts View on Github external
return function axiosOpentracingRequestInterceptor(config: IAxiosRequestConfig) {
     const modifiedConfig = config as IAxiosOpentracingRequestConfig;

     try {
       const span = Tracer.startSpan(`${config.method}: ${config.baseURL}${config.url}`, {
         childOf: rootSpan
       });

       span.setTag(Tags.HTTP_METHOD, config.method);
       span.setTag(Tags.HTTP_URL, config.url);
       span.setTag(Tags.SPAN_KIND, Tags.SPAN_KIND_RPC_CLIENT);
       Tracer.inject(span, FORMAT_HTTP_HEADERS, config.headers);

       modifiedConfig.span = span;
     } catch (e) {}

     return modifiedConfig;
   };
 }