Opentelemetry-js: TypeError: NodeTracerRegistry is not a constructor

Created on 14 Jan 2020  路  9Comments  路  Source: open-telemetry/opentelemetry-js

Please answer these questions before submitting a bug report.

What version of OpenTelemetry are you using?

0.3.2

What version of Node are you using?

12.x.x

What did you do?

Used NodeTracerRegistry instead of NodeTracer

What did you expect to see?

no error

What did you see instead?

  const registry = new NodeTracerRegistry({
                   ^

TypeError: NodeTracerRegistry is not a constructor

Additional context

Add any other context about the problem here.

bug

All 9 comments

I need to see more code here before I can be sure what has happened, but all of the plugins, examples, and tests are working so something with your tsconfig might be wrong.

This is not within the opentelemetry-js codebase btw, I am trying to use this IRL, here is tracer.js :

const { JaegerExporter } = require('@opentelemetry/exporter-jaeger');
const opentelemetry = require('@opentelemetry/core');
const { NodeTracerRegistry } = require('@opentelemetry/node');
const { SimpleSpanProcessor } = require('@opentelemetry/tracing');

const registry = new NodeTracerRegistry({
  logLevel: opentelemetry.LogLevel.ERROR,
  plugins: {
    http: {
      enabled: true,
      path: '@opentelemetry/plugin-http',
      ignoreIncomingPaths: [/\/healthz/],
    },
  },
  sampler: new opentelemetry.ProbabilitySampler(0.5),
});

const exporter = new JaegerExporter({serviceName: 'foo'});

registry.addSpanProcessor(new SimpleSpanProcessor(exporter));

opentelemetry.initGlobalTracerRegistry(registry);

module.exports = opentelemetry.getTracer();

@dyladan Are the named tracers supposed to work today in projects that use opentelemetry? or will it only be available in 0.3.3 ?

As per a colleague of mine:

NodeTracerRegistry is not defined
the require is not working
NodeTracer is the only export

Named tracer functionality is not yet released, it will be available with 0.3.3 release.

Doh! Thanks.

oh i'm sorry I didn't realize you were trying to use the npm version. yes it is not yet available

Is it possible to create release branches? e.g. branch 0.3.3, whereas master branch only has docs that are applicable today?

Please create a new discussion issue for that as it is a completely separate issue.

Was this page helpful?
0 / 5 - 0 ratings