diff --git a/getting-started/README.md b/getting-started/README.md index e5129c46941..ae6bb5a15b5 100644 --- a/getting-started/README.md +++ b/getting-started/README.md @@ -74,13 +74,13 @@ Create a file named `tracing.js` and add the following code: 'use strict'; const opentelemetry = require("@opentelemetry/core"); -const { NodeTracer } = require("@opentelemetry/node"); +const { NodeTracerRegistry } = require("@opentelemetry/node"); -const tracer = new NodeTracer({ +const tracerRegistry = new NodeTracerRegistry({ logLevel: opentelemetry.LogLevel.ERROR }); -opentelemetry.initGlobalTracer(tracer); +opentelemetry.initGlobalTracerRegistry(tracerRegistry); ``` If you run your application now with `node -r ./tracing.js app.js`, your application will create and propagate traces over HTTP. If an already instrumented service that supports [Trace Context](https://www.w3.org/TR/trace-context/) headers calls your application using HTTP, and you call another application using HTTP, the Trace Context headers will be correctly propagated. @@ -110,18 +110,18 @@ After these dependencies are installed, we will need to initialize and register 'use strict'; const opentelemetry = require("@opentelemetry/core"); -const { NodeTracer } = require("@opentelemetry/node"); +const { NodeTracerRegistry } = require("@opentelemetry/node"); const { SimpleSpanProcessor } = require("@opentelemetry/tracing"); const { ZipkinExporter } = require("@opentelemetry/exporter-zipkin"); -const tracer = new NodeTracer({ +const tracerRegistry = new NodeTracerRegistry({ logLevel: opentelemetry.LogLevel.ERROR }); -opentelemetry.initGlobalTracer(tracer); +opentelemetry.initGlobalTracerRegistry(tracerRegistry); -tracer.addSpanProcessor( +tracerRegistry.addSpanProcessor( new SimpleSpanProcessor( new ZipkinExporter({ serviceName: "getting-started", diff --git a/getting-started/traced-example/tracing.js b/getting-started/traced-example/tracing.js index 6a4007f3073..4f265d05393 100644 --- a/getting-started/traced-example/tracing.js +++ b/getting-started/traced-example/tracing.js @@ -1,13 +1,13 @@ "use strict"; const opentelemetry = require("@opentelemetry/core"); -const { NodeTracer } = require("@opentelemetry/node"); +const { NodeTracerRegistry } = require("@opentelemetry/node"); const { SimpleSpanProcessor } = require("@opentelemetry/tracing"); const { ZipkinExporter } = require("@opentelemetry/exporter-zipkin"); -const tracer = new NodeTracer({ logLevel: opentelemetry.LogLevel.ERROR }); -opentelemetry.initGlobalTracer(tracer); +const tracerRegistry = new NodeTracerRegistry({ logLevel: opentelemetry.LogLevel.ERROR }); +opentelemetry.initGlobalTracerRegistry(tracerRegistry); tracer.addSpanProcessor( new SimpleSpanProcessor( diff --git a/getting-started/ts-example/tracing.ts b/getting-started/ts-example/tracing.ts index 056217fb769..ddaac1a760e 100644 --- a/getting-started/ts-example/tracing.ts +++ b/getting-started/ts-example/tracing.ts @@ -1,16 +1,15 @@ import * as opentelemetry from "@opentelemetry/core"; -import { NodeTracer } from "@opentelemetry/node"; - +import { NodeTracerRegistry } from "@opentelemetry/node"; import { SimpleSpanProcessor } from "@opentelemetry/tracing"; import { ZipkinExporter } from "@opentelemetry/exporter-zipkin"; -const tracer: NodeTracer = new NodeTracer({ +const tracerRegistry: NodeTracerRegistry = new NodeTracerRegistry({ logLevel: opentelemetry.LogLevel.ERROR }); -opentelemetry.initGlobalTracer(tracer); +opentelemetry.initGlobalTracerRegistry(tracerRegistry); -tracer.addSpanProcessor( +tracerRegistry.addSpanProcessor( new SimpleSpanProcessor( new ZipkinExporter({ serviceName: "getting-started"