census-instrumentation/opencensus-node

Zipkin exporter has different interface from expected at 0.1.0

thiagoazeredo-quintoandar opened this issue · 0 comments

Please answer these questions before submitting a bug report.

What version of OpenCensus are you using?

0.1.0

What version of Node are you using?

16.3

What did you do?

If possible, provide a recipe for reproducing the error.

import { Span, SpanContext, SpanKind, Tracer as OpenCensusTracerInterface } from '@opencensus/core'
import { ZipkinTraceExporter } from '@opencensus/exporter-zipkin'
import tracing from '@opencensus/nodejs'
import { B3Format } from '@opencensus/propagation-b3'
import nconf from '@/utils/nconf'

export type TracingContext = {
  'X-B3-SpanId': string
  'X-B3-ParentSpanId': string
  'X-B3-Sampled': string
  'X-B3-TraceId': string
  [key: string]: string | undefined
}
const b3 = new B3Format()

const exporter = new ZipkinTraceExporter({
  url: nconf.get('TRACING_HOST_URL'),
  serviceName:
    nconf.get('ZIPKIN_SERVICE_NAME') ||
    `${nconf.get('LABEL_APP')}.${nconf.get('POD_NAMESPACE') || 'dev'}`,
})

const { tracer } = tracing.start({
  bufferSize: 10, // send traces sooner
  bufferTimeout: 5000, // send traces sooner
  logLevel: 2, // warn logs
  samplingRate: 1, // disable sampling, we want all requests
  defaultAttributes: {
    'data.app.name': nconf.get('LABEL_APP'),
  },
  exporter,
  propagation: b3,
  plugins: {
    http: '@opencensus/instrumentation-http',
    http2: '@opencensus/instrumentation-http2',
    https: '@opencensus/instrumentation-https'
  },
})

export const Tracer = tracer

What did you expect to see?

It should work

What did you see instead?

Error: ZipkinExporter has a publish method that returns Promise but the expected interface is Promise<number | string | void>

Additional context

Add any other context about the problem here.