diff --git a/benchmark/tracer.js b/benchmark/tracer.js index f90ea2465e..ab636e924e 100644 --- a/benchmark/tracer.js +++ b/benchmark/tracer.js @@ -1,15 +1,16 @@ 'use strict'; const benchmark = require('./benchmark'); -const opentelemetry = require('../packages/opentelemetry-core'); +const opentelemetry = require('../packages/opentelemetry-api'); +const { NoopLogger } = require('../packages/opentelemetry-core'); const { BasicTracerProvider, BatchSpanProcessor, InMemorySpanExporter, SimpleSpanProcessor } = require('../packages/opentelemetry-tracing'); -const logger = new opentelemetry.NoopLogger(); +const logger = new NoopLogger(); const setups = [ { name: 'NoopTracerProvider', - provider: opentelemetry.getTracerProvider() + provider: new opentelemetry.NoopTracerProvider() }, { name: 'BasicTracerProvider', diff --git a/examples/basic-tracer-node/index.js b/examples/basic-tracer-node/index.js index e16b95b898..7603453761 100644 --- a/examples/basic-tracer-node/index.js +++ b/examples/basic-tracer-node/index.js @@ -1,7 +1,7 @@ 'use strict'; -const opentelemetry = require('@opentelemetry/core'); -const { BasicTracerRegistry, SimpleSpanProcessor } = require('@opentelemetry/tracing'); +const opentelemetry = require('@opentelemetry/api'); +const { BasicTracerProvider, SimpleSpanProcessor } = require('@opentelemetry/tracing'); const { JaegerExporter } = require('@opentelemetry/exporter-jaeger'); const { ZipkinExporter } = require('@opentelemetry/exporter-zipkin'); const { CollectorExporter } = require('@opentelemetry/exporter-collector'); @@ -22,14 +22,14 @@ if (EXPORTER.toLowerCase().startsWith('z')) { exporter = new CollectorExporter(options); } -const registry = new BasicTracerRegistry(); +const provider = new BasicTracerProvider(); // Configure span processor to send spans to the provided exporter -registry.addSpanProcessor(new SimpleSpanProcessor(exporter)); +provider.addSpanProcessor(new SimpleSpanProcessor(exporter)); -// Initialize the OpenTelemetry APIs to use the BasicTracerRegistry bindings -opentelemetry.initGlobalTracerRegistry(registry); -const tracer = opentelemetry.getTracer('example-basic-tracer-node'); +// Initialize the OpenTelemetry APIs to use the BasicTracerProvider bindings +opentelemetry.trace.initGlobalTracerProvider(provider); +const tracer = opentelemetry.trace.getTracer('example-basic-tracer-node'); // Create a span. A span must be closed. const parentSpan = tracer.startSpan('main'); diff --git a/examples/basic-tracer-node/multi_exporter.js b/examples/basic-tracer-node/multi_exporter.js index aa8478dfa2..7d2734dd98 100644 --- a/examples/basic-tracer-node/multi_exporter.js +++ b/examples/basic-tracer-node/multi_exporter.js @@ -1,12 +1,12 @@ 'use strict'; -const opentelemetry = require('@opentelemetry/core'); -const { BasicTracerRegistry, BatchSpanProcessor, SimpleSpanProcessor } = require('@opentelemetry/tracing'); +const opentelemetry = require('@opentelemetry/api'); +const { BasicTracerProvider, BatchSpanProcessor, SimpleSpanProcessor } = require('@opentelemetry/tracing'); const { JaegerExporter } = require('@opentelemetry/exporter-jaeger'); const { ZipkinExporter } = require('@opentelemetry/exporter-zipkin'); const { CollectorExporter } = require('@opentelemetry/exporter-collector'); -const registry = new BasicTracerRegistry(); +const provider = new BasicTracerProvider(); const zipkinExporter = new ZipkinExporter({ serviceName: 'basic-service' }); const jaegerExporter = new JaegerExporter({ @@ -16,21 +16,21 @@ const collectorExporter = new CollectorExporter({ serviceName: 'basic-service' } // It is recommended to use this BatchSpanProcessor for better performance // and optimization, especially in production. -registry.addSpanProcessor(new BatchSpanProcessor(zipkinExporter, { +provider.addSpanProcessor(new BatchSpanProcessor(zipkinExporter, { // This is added for example, default size is 100. bufferSize: 10, })); -const tracer = opentelemetry.getTracer('default'); +const tracer = opentelemetry.trace.getTracer('default'); tracer.addSpanProcessor(new BatchSpanProcessor(jaegerExporter), { bufferSize: 10, }); -registry.addSpanProcessor(new SimpleSpanProcessor(collectorExporter)); +provider.addSpanProcessor(new SimpleSpanProcessor(collectorExporter)); -// Initialize the OpenTelemetry APIs to use the BasicTracerRegistry bindings -opentelemetry.initGlobalTracerRegistry(registry); +// Initialize the OpenTelemetry APIs to use the BasicTracerProvider bindings +opentelemetry.trace.initGlobalTracerProvider(provider); // Create a span. A span must be closed. const parentSpan = tracer.startSpan('main'); diff --git a/examples/basic-tracer-node/package.json b/examples/basic-tracer-node/package.json index 4968965c42..f4ab4c985e 100644 --- a/examples/basic-tracer-node/package.json +++ b/examples/basic-tracer-node/package.json @@ -30,7 +30,7 @@ "url": "https://github.com/open-telemetry/opentelemetry-js/issues" }, "dependencies": { - "@opentelemetry/core": "^0.3.3", + "@opentelemetry/api": "^0.3.3", "@opentelemetry/exporter-collector": "^0.3.3", "@opentelemetry/exporter-jaeger": "^0.3.3", "@opentelemetry/exporter-zipkin": "^0.3.3", diff --git a/examples/dns/package.json b/examples/dns/package.json index 3f6a5db637..414da87d33 100644 --- a/examples/dns/package.json +++ b/examples/dns/package.json @@ -26,7 +26,7 @@ "url": "https://github.com/open-telemetry/opentelemetry-js/issues" }, "dependencies": { - "@opentelemetry/core": "^0.3.3", + "@opentelemetry/api": "^0.3.3", "@opentelemetry/exporter-jaeger": "^0.3.3", "@opentelemetry/exporter-zipkin": "^0.3.3", "@opentelemetry/node": "^0.3.3", diff --git a/examples/dns/tracer.js b/examples/dns/tracer.js index 7a918ec33d..f27118c6d6 100644 --- a/examples/dns/tracer.js +++ b/examples/dns/tracer.js @@ -1,7 +1,7 @@ 'use strict'; -const opentelemetry = require('@opentelemetry/core'); -const { NodeTracerRegistry } = require('@opentelemetry/node'); +const opentelemetry = require('@opentelemetry/api'); +const { NodeTracerProvider } = require('@opentelemetry/node'); const { SimpleSpanProcessor } = require('@opentelemetry/tracing'); const { JaegerExporter } = require('@opentelemetry/exporter-jaeger'); const { ZipkinExporter } = require('@opentelemetry/exporter-zipkin'); @@ -9,7 +9,7 @@ const { ZipkinExporter } = require('@opentelemetry/exporter-zipkin'); const EXPORTER = process.env.EXPORTER || ''; module.exports = (serviceName) => { - const registry = new NodeTracerRegistry({ + const provider = new NodeTracerProvider({ plugins: { dns: { enabled: true, @@ -31,10 +31,10 @@ module.exports = (serviceName) => { }); } - registry.addSpanProcessor(new SimpleSpanProcessor(exporter)); + provider.addSpanProcessor(new SimpleSpanProcessor(exporter)); - // Initialize the OpenTelemetry APIs to use the BasicTracerRegistry bindings - opentelemetry.initGlobalTracerRegistry(registry); + // Initialize the OpenTelemetry APIs to use the BasicTracerProvider bindings + opentelemetry.trace.initGlobalTracerProvider(provider); - return opentelemetry.getTracer(); + return opentelemetry.trace.getTracer('dns-example'); }; diff --git a/examples/grpc/package.json b/examples/grpc/package.json index ce52106694..a70b8e6412 100644 --- a/examples/grpc/package.json +++ b/examples/grpc/package.json @@ -28,7 +28,7 @@ "url": "https://github.com/open-telemetry/opentelemetry-js/issues" }, "dependencies": { - "@opentelemetry/core": "^0.3.3", + "@opentelemetry/api": "^0.3.3", "@opentelemetry/exporter-jaeger": "^0.3.3", "@opentelemetry/exporter-zipkin": "^0.3.3", "@opentelemetry/node": "^0.3.3", diff --git a/examples/grpc/tracer.js b/examples/grpc/tracer.js index ad881334c9..3e5fed3e85 100644 --- a/examples/grpc/tracer.js +++ b/examples/grpc/tracer.js @@ -1,7 +1,7 @@ 'use strict'; -const opentelemetry = require('@opentelemetry/core'); -const { NodeTracerRegistry } = require('@opentelemetry/node'); +const opentelemetry = require('@opentelemetry/api'); +const { NodeTracerProvider } = require('@opentelemetry/node'); const { SimpleSpanProcessor } = require('@opentelemetry/tracing'); const { JaegerExporter } = require('@opentelemetry/exporter-jaeger'); const { ZipkinExporter } = require('@opentelemetry/exporter-zipkin'); @@ -9,7 +9,7 @@ const { ZipkinExporter } = require('@opentelemetry/exporter-zipkin'); const EXPORTER = process.env.EXPORTER || ''; module.exports = (serviceName) => { - const registry = new NodeTracerRegistry({ + const provider = new NodeTracerProvider({ plugins: { grpc: { enabled: true, @@ -29,10 +29,10 @@ module.exports = (serviceName) => { }); } - registry.addSpanProcessor(new SimpleSpanProcessor(exporter)); + provider.addSpanProcessor(new SimpleSpanProcessor(exporter)); - // Initialize the OpenTelemetry APIs to use the BasicTracerRegistry bindings - opentelemetry.initGlobalTracerRegistry(registry); + // Initialize the OpenTelemetry APIs to use the BasicTracerProvider bindings + opentelemetry.trace.initGlobalTracerProvider(provider); - return opentelemetry.getTracer(); + return opentelemetry.trace.getTracer('grpc-example'); }; diff --git a/examples/grpc_dynamic_codegen/capitalize_server.js b/examples/grpc_dynamic_codegen/capitalize_server.js index 3755e4ea56..88f6edfcec 100644 --- a/examples/grpc_dynamic_codegen/capitalize_server.js +++ b/examples/grpc_dynamic_codegen/capitalize_server.js @@ -2,7 +2,7 @@ // eslint-disable-next-line import/order const tracer = require('./tracer')('example-grpc-capitalize-server'); -const { SpanKind } = require('@opentelemetry/types'); +const { SpanKind } = require('@opentelemetry/api'); const path = require('path'); const grpc = require('grpc'); const protoLoader = require('@grpc/proto-loader'); diff --git a/examples/grpc_dynamic_codegen/package.json b/examples/grpc_dynamic_codegen/package.json index 8d91d64ee2..56bc2600ee 100644 --- a/examples/grpc_dynamic_codegen/package.json +++ b/examples/grpc_dynamic_codegen/package.json @@ -28,13 +28,13 @@ }, "dependencies": { "@grpc/proto-loader": "^0.4.0", - "@opentelemetry/core": "^0.3.3", + "@opentelemetry/api": "^0.3.3", "@opentelemetry/exporter-jaeger": "^0.3.3", "@opentelemetry/exporter-zipkin": "^0.3.3", "@opentelemetry/node": "^0.3.3", "@opentelemetry/plugin-grpc": "^0.3.3", "@opentelemetry/tracing": "^0.3.3", - "@opentelemetry/types": "^0.3.3", + "@opentelemetry/api": "^0.3.3", "grpc": "^1.23.3", "node-pre-gyp": "0.12.0" }, diff --git a/examples/grpc_dynamic_codegen/tracer.js b/examples/grpc_dynamic_codegen/tracer.js index 23d6e25f01..b46ac73f09 100644 --- a/examples/grpc_dynamic_codegen/tracer.js +++ b/examples/grpc_dynamic_codegen/tracer.js @@ -1,7 +1,7 @@ 'use strict'; -const opentelemetry = require('@opentelemetry/core'); -const { NodeTracerRegistry } = require('@opentelemetry/node'); +const opentelemetry = require('@opentelemetry/api'); +const { NodeTracerProvider } = require('@opentelemetry/node'); const { SimpleSpanProcessor } = require('@opentelemetry/tracing'); const { JaegerExporter } = require('@opentelemetry/exporter-jaeger'); const { ZipkinExporter } = require('@opentelemetry/exporter-zipkin'); @@ -9,7 +9,7 @@ const { ZipkinExporter } = require('@opentelemetry/exporter-zipkin'); const EXPORTER = process.env.EXPORTER || ''; module.exports = (serviceName) => { - const registry = new NodeTracerRegistry({ + const provider = new NodeTracerProvider({ plugins: { grpc: { enabled: true, @@ -32,10 +32,10 @@ module.exports = (serviceName) => { // It is recommended to use this `BatchSpanProcessor` for better performance // and optimization, especially in production. - registry.addSpanProcessor(new SimpleSpanProcessor(exporter)); + provider.addSpanProcessor(new SimpleSpanProcessor(exporter)); - // Initialize the OpenTelemetry APIs to use the BasicTracerRegistry bindings - opentelemetry.initGlobalTracerRegistry(registry); + // Initialize the OpenTelemetry APIs to use the BasicTracerProvider bindings + opentelemetry.trace.initGlobalTracerProvider(provider); - return opentelemetry.getTracer(); + return opentelemetry.trace.getTracer('grpc-dynamic-codegen-example'); }; diff --git a/examples/http/package.json b/examples/http/package.json index 98503047c4..5b19eb8cce 100644 --- a/examples/http/package.json +++ b/examples/http/package.json @@ -28,7 +28,7 @@ "url": "https://github.com/open-telemetry/opentelemetry-js/issues" }, "dependencies": { - "@opentelemetry/core": "^0.3.3", + "@opentelemetry/api": "^0.3.3", "@opentelemetry/exporter-jaeger": "^0.3.3", "@opentelemetry/exporter-zipkin": "^0.3.3", "@opentelemetry/node": "^0.3.3", diff --git a/examples/http/tracer.js b/examples/http/tracer.js index 29a21f4f0d..45669afca9 100644 --- a/examples/http/tracer.js +++ b/examples/http/tracer.js @@ -1,7 +1,7 @@ 'use strict'; -const opentelemetry = require('@opentelemetry/core'); -const { NodeTracerRegistry } = require('@opentelemetry/node'); +const opentelemetry = require('@opentelemetry/api'); +const { NodeTracerProvider } = require('@opentelemetry/node'); const { SimpleSpanProcessor } = require('@opentelemetry/tracing'); const { JaegerExporter } = require('@opentelemetry/exporter-jaeger'); const { ZipkinExporter } = require('@opentelemetry/exporter-zipkin'); @@ -9,7 +9,7 @@ const { ZipkinExporter } = require('@opentelemetry/exporter-zipkin'); const EXPORTER = process.env.EXPORTER || ''; module.exports = (serviceName) => { - const registry = new NodeTracerRegistry(); + const provider = new NodeTracerProvider(); let exporter; if (EXPORTER.toLowerCase().startsWith('z')) { @@ -22,10 +22,10 @@ module.exports = (serviceName) => { }); } - registry.addSpanProcessor(new SimpleSpanProcessor(exporter)); + provider.addSpanProcessor(new SimpleSpanProcessor(exporter)); - // Initialize the OpenTelemetry APIs to use the BasicTracerRegistry bindings - opentelemetry.initGlobalTracerRegistry(registry); + // Initialize the OpenTelemetry APIs to use the BasicTracerProvider bindings + opentelemetry.trace.initGlobalTracerProvider(provider); - return opentelemetry.getTracer(); + return opentelemetry.trace.getTracer('http-example'); }; diff --git a/examples/https/package.json b/examples/https/package.json index cb46108550..de63e74f2f 100644 --- a/examples/https/package.json +++ b/examples/https/package.json @@ -29,7 +29,7 @@ "url": "https://github.com/open-telemetry/opentelemetry-js/issues" }, "dependencies": { - "@opentelemetry/core": "^0.3.3", + "@opentelemetry/api": "^0.3.3", "@opentelemetry/exporter-jaeger": "^0.3.3", "@opentelemetry/exporter-zipkin": "^0.3.3", "@opentelemetry/node": "^0.3.3", diff --git a/examples/https/tracer.js b/examples/https/tracer.js index eaec28f376..3ae1d6f074 100644 --- a/examples/https/tracer.js +++ b/examples/https/tracer.js @@ -1,7 +1,7 @@ 'use strict'; -const opentelemetry = require('@opentelemetry/core'); -const { NodeTracerRegistry } = require('@opentelemetry/node'); +const opentelemetry = require('@opentelemetry/api'); +const { NodeTracerProvider } = require('@opentelemetry/node'); const { SimpleSpanProcessor } = require('@opentelemetry/tracing'); const { JaegerExporter } = require('@opentelemetry/exporter-jaeger'); const { ZipkinExporter } = require('@opentelemetry/exporter-zipkin'); @@ -11,7 +11,7 @@ process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0'; module.exports = (serviceName) => { let exporter; - const registry = new NodeTracerRegistry(); + const provider = new NodeTracerProvider(); if (EXPORTER.toLowerCase().startsWith('z')) { exporter = new ZipkinExporter({ @@ -23,10 +23,10 @@ module.exports = (serviceName) => { }); } - registry.addSpanProcessor(new SimpleSpanProcessor(exporter)); + provider.addSpanProcessor(new SimpleSpanProcessor(exporter)); - // Initialize the OpenTelemetry APIs to use the BasicTracerRegistry bindings - opentelemetry.initGlobalTracerRegistry(registry); + // Initialize the OpenTelemetry APIs to use the BasicTracerProvider bindings + opentelemetry.trace.initGlobalTracerProvider(provider); - return opentelemetry.getTracer(); + return opentelemetry.trace.getTracer('https-example'); }; diff --git a/examples/ioredis/package.json b/examples/ioredis/package.json index b356bfd047..f1ed93f53e 100644 --- a/examples/ioredis/package.json +++ b/examples/ioredis/package.json @@ -28,7 +28,7 @@ "url": "https://github.com/open-telemetry/opentelemetry-js/issues" }, "dependencies": { - "@opentelemetry/core": "^0.3.3", + "@opentelemetry/api": "^0.3.3", "@opentelemetry/exporter-jaeger": "^0.3.3", "@opentelemetry/node": "^0.3.3", "@opentelemetry/plugin-ioredis": "^0.3.3", diff --git a/examples/ioredis/tracer.js b/examples/ioredis/tracer.js index f806749c7a..822a2fce44 100644 --- a/examples/ioredis/tracer.js +++ b/examples/ioredis/tracer.js @@ -1,17 +1,17 @@ 'use strict'; -const opentelemetry = require('@opentelemetry/core'); -const { NodeTracerRegistry } = require('@opentelemetry/node'); +const opentelemetry = require('@opentelemetry/api'); +const { NodeTracerProvider } = require('@opentelemetry/node'); const { SimpleSpanProcessor } = require('@opentelemetry/tracing'); const { JaegerExporter } = require('@opentelemetry/exporter-jaeger'); -const tracerRegistry = new NodeTracerRegistry(); +const provider = new NodeTracerProvider(); const exporter = new JaegerExporter({ serviceName: 'ioredis-example' }); -tracerRegistry.addSpanProcessor(new SimpleSpanProcessor(exporter)); +provider.addSpanProcessor(new SimpleSpanProcessor(exporter)); // Initialize the OpenTelemetry APIs to use the BasicTracer bindings -opentelemetry.initGlobalTracerRegistry(tracerRegistry); +opentelemetry.trace.initGlobalTracerProvider(provider); -module.exports = opentelemetry.getTracer(); +module.exports = opentelemetry.trace.getTracer('ioredis-example'); diff --git a/examples/mysql/package.json b/examples/mysql/package.json index 09e3e92eb5..208d3d298c 100644 --- a/examples/mysql/package.json +++ b/examples/mysql/package.json @@ -28,7 +28,7 @@ "url": "https://github.com/open-telemetry/opentelemetry-js/issues" }, "dependencies": { - "@opentelemetry/core": "^0.3.3", + "@opentelemetry/api": "^0.3.3", "@opentelemetry/exporter-jaeger": "^0.3.3", "@opentelemetry/exporter-zipkin": "^0.3.3", "@opentelemetry/node": "^0.3.3", diff --git a/examples/mysql/tracer.js b/examples/mysql/tracer.js index e3e93e4d79..7193230276 100644 --- a/examples/mysql/tracer.js +++ b/examples/mysql/tracer.js @@ -1,13 +1,13 @@ 'use strict'; -const opentelemetry = require('@opentelemetry/core'); -const { NodeTracerRegistry } = require('@opentelemetry/node'); +const opentelemetry = require('@opentelemetry/api'); +const { NodeTracerProvider } = require('@opentelemetry/node'); const { SimpleSpanProcessor } = require('@opentelemetry/tracing'); const { JaegerExporter } = require('@opentelemetry/exporter-jaeger'); const { ZipkinExporter } = require('@opentelemetry/exporter-zipkin'); module.exports = (serviceName) => { - const registry = new NodeTracerRegistry({ + const provider = new NodeTracerProvider({ plugins: { mysql: { enabled: true, @@ -20,15 +20,15 @@ module.exports = (serviceName) => { }, }); - registry.addSpanProcessor(new SimpleSpanProcessor(new ZipkinExporter({ + provider.addSpanProcessor(new SimpleSpanProcessor(new ZipkinExporter({ serviceName, }))); - registry.addSpanProcessor(new SimpleSpanProcessor(new JaegerExporter({ + provider.addSpanProcessor(new SimpleSpanProcessor(new JaegerExporter({ serviceName, }))); - // Initialize the OpenTelemetry APIs to use the BasicTracerRegistry bindings - opentelemetry.initGlobalTracerRegistry(registry); + // Initialize the OpenTelemetry APIs to use the BasicTracerProvider bindings + opentelemetry.trace.initGlobalTracerProvider(provider); - return opentelemetry.getTracer(); + return opentelemetry.trace.getTracer('mysql-example'); }; diff --git a/examples/opentracing-shim/shim.js b/examples/opentracing-shim/shim.js index 4730f9e258..993445ab26 100644 --- a/examples/opentracing-shim/shim.js +++ b/examples/opentracing-shim/shim.js @@ -1,17 +1,17 @@ 'use strict'; -const { NodeTracerRegistry } = require('@opentelemetry/node'); +const { NodeTracerProvider } = require('@opentelemetry/node'); const { SimpleSpanProcessor } = require('@opentelemetry/tracing'); const { JaegerExporter } = require('@opentelemetry/exporter-jaeger'); const { ZipkinExporter } = require('@opentelemetry/exporter-zipkin'); const { TracerShim } = require('@opentelemetry/shim-opentracing'); function shim(serviceName) { - const registry = new NodeTracerRegistry(); + const provider = new NodeTracerProvider(); - registry.addSpanProcessor(new SimpleSpanProcessor(getExporter(serviceName))); + provider.addSpanProcessor(new SimpleSpanProcessor(getExporter(serviceName))); - return new TracerShim(registry.getTracer('opentracing-shim')); + return new TracerShim(provider.getTracer('opentracing-shim')); } function getExporter(serviceName) { diff --git a/examples/postgres/package.json b/examples/postgres/package.json index 52b291bff2..8fcc5218a7 100644 --- a/examples/postgres/package.json +++ b/examples/postgres/package.json @@ -30,7 +30,7 @@ "url": "https://github.com/open-telemetry/opentelemetry-js/issues" }, "dependencies": { - "@opentelemetry/core": "^0.3.3", + "@opentelemetry/api": "^0.3.3", "@opentelemetry/exporter-jaeger": "^0.3.3", "@opentelemetry/exporter-zipkin": "^0.3.3", "@opentelemetry/node": "^0.3.3", @@ -38,7 +38,7 @@ "@opentelemetry/plugin-pg": "^0.3.3", "@opentelemetry/plugin-pg-pool": "^0.3.3", "@opentelemetry/tracing": "^0.3.3", - "@opentelemetry/types": "^0.3.3", + "@opentelemetry/api": "^0.3.3", "express": "^4.17.1", "pg": "^7.12.1" }, diff --git a/examples/postgres/server.js b/examples/postgres/server.js index 1c317a6595..b893acd4f8 100644 --- a/examples/postgres/server.js +++ b/examples/postgres/server.js @@ -2,7 +2,7 @@ // eslint-disable-next-line import/order const tracer = require('./tracer')('postgres-server-service'); -const { SpanKind, CanonicalCode } = require('@opentelemetry/types'); +const { SpanKind, CanonicalCode } = require('@opentelemetry/api'); const express = require('express'); const setupPg = require('./setupPsql'); diff --git a/examples/postgres/tracer.js b/examples/postgres/tracer.js index ab1d34ddc1..0174270837 100644 --- a/examples/postgres/tracer.js +++ b/examples/postgres/tracer.js @@ -1,7 +1,7 @@ 'use strict'; -const opentelemetry = require('@opentelemetry/core'); -const { NodeTracer } = require('@opentelemetry/node'); +const opentelemetry = require('@opentelemetry/api'); +const { NodeTracerProvider } = require('@opentelemetry/node'); const { SimpleSpanProcessor } = require('@opentelemetry/tracing'); const { JaegerExporter } = require('@opentelemetry/exporter-jaeger'); const { ZipkinExporter } = require('@opentelemetry/exporter-zipkin'); @@ -9,7 +9,7 @@ const { ZipkinExporter } = require('@opentelemetry/exporter-zipkin'); const EXPORTER = process.env.EXPORTER || ''; module.exports = (serviceName) => { - const tracer = new NodeTracer({ + const provider = new NodeTracerProvider({ plugins: { pg: { enabled: true, @@ -43,10 +43,10 @@ module.exports = (serviceName) => { }); } - tracer.addSpanProcessor(new SimpleSpanProcessor(exporter)); + provider.addSpanProcessor(new SimpleSpanProcessor(exporter)); // Initialize the OpenTelemetry APIs to use the BasicTracer bindings - opentelemetry.initGlobalTracer(tracer); + opentelemetry.trace.initGlobalTracerProvider(provider); - return opentelemetry.getTracer(); + return opentelemetry.trace.getTracer('example-postgres'); }; diff --git a/examples/prometheus/index.js b/examples/prometheus/index.js index 7e6a85dee9..4b856bf849 100644 --- a/examples/prometheus/index.js +++ b/examples/prometheus/index.js @@ -1,9 +1,9 @@ 'use strict'; -const { MeterRegistry } = require('@opentelemetry/metrics'); +const { MeterProvider } = require('@opentelemetry/metrics'); const { PrometheusExporter } = require('@opentelemetry/exporter-prometheus'); -const meter = new MeterRegistry().getMeter('example-prometheus'); +const meter = new MeterProvider().getMeter('example-prometheus'); const exporter = new PrometheusExporter( { diff --git a/examples/redis/client.js b/examples/redis/client.js index 30fd9b65ca..9fadc6f1a5 100644 --- a/examples/redis/client.js +++ b/examples/redis/client.js @@ -2,22 +2,22 @@ // eslint-disable-next-line import/order const tracer = require('./tracer')('example-redis-client'); -const types = require('@opentelemetry/types'); +const api = require('@opentelemetry/api'); const axios = require('axios').default; function makeRequest() { const span = tracer.startSpan('client.makeRequest()', { parent: tracer.getCurrentSpan(), - kind: types.SpanKind.CLIENT, + kind: api.SpanKind.CLIENT, }); tracer.withSpan(span, async () => { try { const res = await axios.get('http://localhost:8080/run_test'); - span.setStatus({ code: types.CanonicalCode.OK }); + span.setStatus({ code: api.CanonicalCode.OK }); console.log(res.statusText); } catch (e) { - span.setStatus({ code: types.CanonicalCode.UNKNOWN, message: e.message }); + span.setStatus({ code: api.CanonicalCode.UNKNOWN, message: e.message }); } span.end(); console.log('Sleeping 5 seconds before shutdown to ensure all records are flushed.'); diff --git a/examples/redis/express-tracer-handlers.js b/examples/redis/express-tracer-handlers.js index 1e15608ab5..9e8412a5c8 100644 --- a/examples/redis/express-tracer-handlers.js +++ b/examples/redis/express-tracer-handlers.js @@ -1,12 +1,12 @@ 'use strict'; -const types = require('@opentelemetry/types'); +const api = require('@opentelemetry/api'); function getMiddlewareTracer(tracer) { return (req, res, next) => { const span = tracer.startSpan(`express.middleware.tracer(${req.method} ${req.path})`, { parent: tracer.getCurrentSpan(), - kind: types.SpanKind.SERVER, + kind: api.SpanKind.SERVER, }); // End this span before sending out the response @@ -25,7 +25,7 @@ function getErrorTracer(tracer) { console.error('Caught error', err.message); const span = tracer.getCurrentSpan(); if (span) { - span.setStatus({ code: types.CanonicalCode.INTERNAL, message: err.message }); + span.setStatus({ code: api.CanonicalCode.INTERNAL, message: err.message }); } res.status(500).send(err.message); }; diff --git a/examples/redis/package.json b/examples/redis/package.json index 538dab4d12..716dff24a2 100644 --- a/examples/redis/package.json +++ b/examples/redis/package.json @@ -30,14 +30,14 @@ "url": "https://github.com/open-telemetry/opentelemetry-js/issues" }, "dependencies": { - "@opentelemetry/core": "^0.3.3", + "@opentelemetry/api": "^0.3.3", "@opentelemetry/exporter-jaeger": "^0.3.3", "@opentelemetry/exporter-zipkin": "^0.3.3", "@opentelemetry/node": "^0.3.3", "@opentelemetry/plugin-http": "^0.3.3", "@opentelemetry/plugin-redis": "^0.3.3", "@opentelemetry/tracing": "^0.3.3", - "@opentelemetry/types": "^0.3.3", + "@opentelemetry/api": "^0.3.3", "axios": "^0.19.0", "express": "^4.17.1", "redis": "^2.8.0" diff --git a/examples/redis/tracer.js b/examples/redis/tracer.js index fa2680830a..1f22877416 100644 --- a/examples/redis/tracer.js +++ b/examples/redis/tracer.js @@ -1,7 +1,7 @@ 'use strict'; -const opentelemetry = require('@opentelemetry/core'); -const { NodeTracerRegistry } = require('@opentelemetry/node'); +const opentelemetry = require('@opentelemetry/api'); +const { NodeTracerProvider } = require('@opentelemetry/node'); const { SimpleSpanProcessor } = require('@opentelemetry/tracing'); const { JaegerExporter } = require('@opentelemetry/exporter-jaeger'); const { ZipkinExporter } = require('@opentelemetry/exporter-zipkin'); @@ -10,7 +10,7 @@ const EXPORTER = process.env.EXPORTER || ''; module.exports = (serviceName) => { - const registry = new NodeTracerRegistry(); + const provider = new NodeTracerProvider(); let exporter; if (EXPORTER.toLowerCase().startsWith('z')) { @@ -23,10 +23,10 @@ module.exports = (serviceName) => { }); } - registry.addSpanProcessor(new SimpleSpanProcessor(exporter)); + provider.addSpanProcessor(new SimpleSpanProcessor(exporter)); - // Initialize the OpenTelemetry APIs to use the BasicTracerRegistry bindings - opentelemetry.initGlobalTracerRegistry(registry); + // Initialize the OpenTelemetry APIs to use the BasicTracerProvider bindings + opentelemetry.trace.initGlobalTracerProvider(provider); - return opentelemetry.getTracer(); + return opentelemetry.trace.getTracer('redis-example'); }; diff --git a/examples/stackdriver-trace/index.js b/examples/stackdriver-trace/index.js index 7dda540e81..83e43103a0 100644 --- a/examples/stackdriver-trace/index.js +++ b/examples/stackdriver-trace/index.js @@ -1,8 +1,8 @@ 'use strict'; -const opentelemetry = require('@opentelemetry/core'); -const { BasicTracerRegistry, SimpleSpanProcessor } = require('@opentelemetry/tracing'); -const { CanonicalCode } = require('@opentelemetry/types'); +const opentelemetry = require('@opentelemetry/api'); +const { BasicTracerProvider, SimpleSpanProcessor } = require('@opentelemetry/tracing'); +const { CanonicalCode } = require('@opentelemetry/api'); const { StackdriverTraceExporter } = require('@opentelemetry/exporter-stackdriver-trace'); // Initialize an exporter @@ -10,14 +10,14 @@ const exporter = new StackdriverTraceExporter({ projectId: '', }); -const registry = new BasicTracerRegistry(); +const provider = new BasicTracerProvider(); // Configure span processor to send spans to the provided exporter -registry.addSpanProcessor(new SimpleSpanProcessor(exporter)); +provider.addSpanProcessor(new SimpleSpanProcessor(exporter)); -// Initialize the OpenTelemetry APIs to use the BasicTracerRegistry bindings -opentelemetry.initGlobalTracerRegistry(registry); -const tracer = opentelemetry.getTracer('stackdriver-basic'); +// Initialize the OpenTelemetry APIs to use the BasicTracerProvider bindings +opentelemetry.trace.initGlobalTracerProvider(provider); +const tracer = opentelemetry.trace.getTracer('stackdriver-basic'); // Create a span. A span must be closed. const root = tracer.startSpan('main'); diff --git a/examples/stackdriver-trace/package.json b/examples/stackdriver-trace/package.json index a670009ef6..6ba6567dc2 100644 --- a/examples/stackdriver-trace/package.json +++ b/examples/stackdriver-trace/package.json @@ -25,10 +25,10 @@ "url": "https://github.com/open-telemetry/opentelemetry-js/issues" }, "dependencies": { - "@opentelemetry/core": "^0.3.3", + "@opentelemetry/api": "^0.3.3", "@opentelemetry/exporter-stackdriver-trace": "^0.3.3", "@opentelemetry/tracing": "^0.3.3", - "@opentelemetry/types": "^0.3.3" + "@opentelemetry/api": "^0.3.3" }, "homepage": "https://github.com/open-telemetry/opentelemetry-js#readme", "devDependencies": { diff --git a/examples/tracer-web/examples/document-load/index.js b/examples/tracer-web/examples/document-load/index.js index 77b7248825..d6f4d9d65f 100644 --- a/examples/tracer-web/examples/document-load/index.js +++ b/examples/tracer-web/examples/document-load/index.js @@ -1,26 +1,26 @@ import { ConsoleSpanExporter, SimpleSpanProcessor } from '@opentelemetry/tracing'; -import { WebTracerRegistry } from '@opentelemetry/web'; +import { WebTracerProvider } from '@opentelemetry/web'; import { DocumentLoad } from '@opentelemetry/plugin-document-load'; import { ZoneScopeManager } from '@opentelemetry/scope-zone'; import { CollectorExporter } from '@opentelemetry/exporter-collector'; -const registry = new WebTracerRegistry({ +const provider = new WebTracerProvider({ plugins: [ new DocumentLoad(), ], }); -registry.addSpanProcessor(new SimpleSpanProcessor(new ConsoleSpanExporter())); +provider.addSpanProcessor(new SimpleSpanProcessor(new ConsoleSpanExporter())); -const registryWithZone = new WebTracerRegistry({ +const providerWithZone = new WebTracerProvider({ scopeManager: new ZoneScopeManager(), plugins: [ new DocumentLoad(), ], }); -registryWithZone.addSpanProcessor(new SimpleSpanProcessor(new ConsoleSpanExporter())); -registryWithZone.addSpanProcessor(new SimpleSpanProcessor(new CollectorExporter())); +providerWithZone.addSpanProcessor(new SimpleSpanProcessor(new ConsoleSpanExporter())); +providerWithZone.addSpanProcessor(new SimpleSpanProcessor(new CollectorExporter())); -const tracerWithZone = registryWithZone.getTracer('example-tracer-web'); +const tracerWithZone = providerWithZone.getTracer('example-tracer-web'); let window; console.log('Current span is window', tracerWithZone.getCurrentSpan() === window); diff --git a/examples/tracer-web/package.json b/examples/tracer-web/package.json index ac246d9c1a..7a68243c30 100644 --- a/examples/tracer-web/package.json +++ b/examples/tracer-web/package.json @@ -34,6 +34,7 @@ "webpack-merge": "^4.2.2" }, "dependencies": { + "@opentelemetry/core": "^0.3.3", "@opentelemetry/exporter-collector": "^0.3.3", "@opentelemetry/plugin-document-load": "^0.3.3", "@opentelemetry/plugin-xml-http-request": "^0.3.3", diff --git a/getting-started/README.md b/getting-started/README.md index 61ae41d7e8..b8a491a6c0 100644 --- a/getting-started/README.md +++ b/getting-started/README.md @@ -73,14 +73,14 @@ Create a file named `tracing.js` and add the following code: ```javascript 'use strict'; -const opentelemetry = require("@opentelemetry/core"); -const { NodeTracerRegistry } = require("@opentelemetry/node"); +const opentelemetry = require("@opentelemetry/api"); +const { NodeTracerProvider } = require("@opentelemetry/node"); -const tracerRegistry = new NodeTracerRegistry({ +const provider = new NodeTracerProvider({ logLevel: opentelemetry.LogLevel.ERROR }); -opentelemetry.initGlobalTracerRegistry(tracerRegistry); +opentelemetry.trace.initGlobalTracerProvider(provider); ``` 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. @@ -109,19 +109,19 @@ After these dependencies are installed, we will need to initialize and register ```javascript 'use strict'; -const opentelemetry = require("@opentelemetry/core"); -const { NodeTracerRegistry } = require("@opentelemetry/node"); - +const opentelemetry = require("@opentelemetry/api"); +const { LogLevel } = require("@opentelemetry/core"); +const { NodeTracerProvider } = require("@opentelemetry/node"); const { SimpleSpanProcessor } = require("@opentelemetry/tracing"); const { ZipkinExporter } = require("@opentelemetry/exporter-zipkin"); -const tracerRegistry = new NodeTracerRegistry({ - logLevel: opentelemetry.LogLevel.ERROR +const provider = new NodeTracerProvider({ + logLevel: LogLevel.ERROR }); -opentelemetry.initGlobalTracerRegistry(tracerRegistry); +opentelemetry.trace.initGlobalTracerProvider(provider); -tracerRegistry.addSpanProcessor( +provider.addSpanProcessor( new SimpleSpanProcessor( new ZipkinExporter({ serviceName: "getting-started", @@ -238,9 +238,9 @@ Create a file named `monitoring.js` and add the following code: ```javascript 'use strict'; -const { MeterRegistry } = require('@opentelemetry/metrics'); +const { MeterProvider } = require('@opentelemetry/metrics'); -const meter = new MeterRegistry().getMeter('your-meter-name'); +const meter = new MeterProvider().getMeter('your-meter-name'); ``` Now, you can require this file from your application code and use the `Meter` to create and manage metrics. The simplest of these metrics is a counter. Let's create and export from our `monitoring.js` file a middleware function that express can use to count all requests by route. Modify the `monitoring.js` file so that it looks like this: @@ -248,9 +248,9 @@ Now, you can require this file from your application code and use the `Meter` to ```javascript 'use strict'; -const { MeterRegistry } = require('@opentelemetry/metrics'); +const { MeterProvider } = require('@opentelemetry/metrics'); -const meter = new MeterRegistry().getMeter('your-meter-name'); +const meter = new MeterProvider().getMeter('your-meter-name'); const requestCount = meter.createCounter("requests", { monotonic: true, @@ -301,10 +301,10 @@ Next, modify your `monitoring.js` file to look like this: ```javascript "use strict"; -const { MeterRegistry } = require('@opentelemetry/metrics'); +const { MeterProvider } = require('@opentelemetry/metrics'); const { PrometheusExporter } = require('@opentelemetry/exporter-prometheus'); -const meter = new MeterRegistry().getMeter('your-meter-name'); +const meter = new MeterProvider().getMeter('your-meter-name'); meter.addExporter( new PrometheusExporter( diff --git a/getting-started/monitored-example/monitoring.js b/getting-started/monitored-example/monitoring.js index 4567c158d1..0cc8daa8ce 100644 --- a/getting-started/monitored-example/monitoring.js +++ b/getting-started/monitored-example/monitoring.js @@ -1,9 +1,9 @@ "use strict"; -const { MeterRegistry } = require('@opentelemetry/metrics'); +const { MeterProvider } = require('@opentelemetry/metrics'); const { PrometheusExporter } = require('@opentelemetry/exporter-prometheus'); -const meter = new MeterRegistry().getMeter('example-monitored'); +const meter = new MeterProvider().getMeter('example-monitored'); meter.addExporter( new PrometheusExporter( diff --git a/getting-started/traced-example/tracing.js b/getting-started/traced-example/tracing.js index 4f265d0539..901007d205 100644 --- a/getting-started/traced-example/tracing.js +++ b/getting-started/traced-example/tracing.js @@ -1,15 +1,14 @@ "use strict"; -const opentelemetry = require("@opentelemetry/core"); -const { NodeTracerRegistry } = require("@opentelemetry/node"); - +const opentelemetry = require("@opentelemetry/api"); +const { NodeTracerProvider } = require("@opentelemetry/node"); const { SimpleSpanProcessor } = require("@opentelemetry/tracing"); const { ZipkinExporter } = require("@opentelemetry/exporter-zipkin"); -const tracerRegistry = new NodeTracerRegistry({ logLevel: opentelemetry.LogLevel.ERROR }); -opentelemetry.initGlobalTracerRegistry(tracerRegistry); +const provider = new NodeTracerProvider({ logLevel: opentelemetry.LogLevel.ERROR }); +opentelemetry.trace.initGlobalTracerProvider(provider); -tracer.addSpanProcessor( +provider.addSpanProcessor( new SimpleSpanProcessor( new ZipkinExporter({ serviceName: "getting-started" diff --git a/getting-started/ts-example/README.md b/getting-started/ts-example/README.md index ac188fcfb4..28a31cd96f 100644 --- a/getting-started/ts-example/README.md +++ b/getting-started/ts-example/README.md @@ -60,7 +60,7 @@ $ npm install \ @opentelemetry/core \ @opentelemetry/node \ @opentelemetry/plugin-http \ - @opentelemetry/types + @opentelemetry/api ``` #### Initialize a global tracer @@ -72,14 +72,15 @@ All tracing initialization should happen before your application’s code runs. Create a file named `tracing.ts` and add the following code: ```typescript -import * as opentelemetry from '@opentelemetry/core'; -import { NodeTracer } from '@opentelemetry/node'; +import * as opentelemetry from '@opentelemetry/api'; +import { LogLevel } from '@opentelemetry/core'; +import { NodeTracerProvider } from '@opentelemetry/node'; -const tracer: NodeTracer = new NodeTracer({ - logLevel: opentelemetry.LogLevel.ERROR +const provider: NodeTracerProvider = new NodeTracerProvider({ + logLevel: LogLevel.ERROR }); -opentelemetry.initGlobalTracer(tracer); +opentelemetry.trace.initGlobalTracerProvider(provider); ``` If you run your application now with `ts-node -r ./tracing.ts app.ts`, 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. @@ -106,21 +107,21 @@ $ # npm install @opentelemetry/exporter-jaeger After these dependencies are installed, we will need to initialize and register them. Modify `tracing.ts` so that it matches the following code snippet, replacing the service name `"getting-started"` with your own service name if you wish. ```typescript -import * as opentelemetry from '@opentelemetry/core'; -import { NodeTracer } from '@opentelemetry/node'; +import * as opentelemetry from '@opentelemetry/api'; +import { NodeTracerProvider } from '@opentelemetry/node'; import { SimpleSpanProcessor } from '@opentelemetry/tracing'; import { ZipkinExporter } from '@opentelemetry/exporter-zipkin'; // For Jaeger, use the following line instead: // import { JaegerExporter } from '@opentelemetry/exporter-jaeger'; -const tracer: NodeTracer = new NodeTracer({ +const provider: NodeTracerProvider = new NodeTracerProvider({ logLevel: opentelemetry.LogLevel.ERROR }); -opentelemetry.initGlobalTracer(tracer); +opentelemetry.trace.initGlobalTracerProvider(provider); -tracer.addSpanProcessor( +provider.addSpanProcessor( new SimpleSpanProcessor( new ZipkinExporter({ // For Jaeger, use the following line instead: @@ -236,18 +237,18 @@ In order to create and monitor metrics, we will need a `Meter`. In OpenTelemetry Create a file named `monitoring.ts` and add the following code: ```typescript -import { MeterRegistry } from '@opentelemetry/metrics'; +import { MeterProvider } from '@opentelemetry/metrics'; -const meter = new MeterRegistry().getMeter('your-meter-name'); +const meter = new MeterProvider().getMeter('your-meter-name'); ``` Now, you can require this file from your application code and use the `Meter` to create and manage metrics. The simplest of these metrics is a counter. Let's create and export from our `monitoring.ts` file a middleware function that express can use to count all requests by route. Modify the `monitoring.ts` file so that it looks like this: ```typescript -import { MeterRegistry } from '@opentelemetry/metrics'; -import { Metric, BoundCounter } from '@opentelemetry/types'; +import { MeterProvider } from '@opentelemetry/metrics'; +import { Metric, BoundCounter } from '@opentelemetry/api'; -const meter = new MeterRegistry().getMeter('your-meter-name'); +const meter = new MeterProvider().getMeter('your-meter-name'); const requestCount: Metric = meter.createCounter("requests", { monotonic: true, @@ -296,11 +297,11 @@ $ npm install @opentelemetry/exporter-prometheus Next, modify your `monitoring.ts` file to look like this: ```typescript -import { MeterRegistry } from '@opentelemetry/metrics'; -import { Metric, BoundCounter } from '@opentelemetry/types'; +import { MeterProvider } from '@opentelemetry/metrics'; +import { Metric, BoundCounter } from '@opentelemetry/api'; import { PrometheusExporter } from '@opentelemetry/exporter-prometheus'; -const meter = new MeterRegistry().getMeter('your-meter-name'); +const meter = new MeterProvider().getMeter('your-meter-name'); meter.addExporter( new PrometheusExporter({ startServer: true }, () => { diff --git a/getting-started/ts-example/monitoring.ts b/getting-started/ts-example/monitoring.ts index 1dd3b57037..2221815e47 100644 --- a/getting-started/ts-example/monitoring.ts +++ b/getting-started/ts-example/monitoring.ts @@ -1,8 +1,8 @@ -import { MeterRegistry } from '@opentelemetry/metrics'; -import { Metric, BoundCounter } from '@opentelemetry/types'; +import { MeterProvider } from '@opentelemetry/metrics'; +import { Metric, BoundCounter } from '@opentelemetry/api'; import { PrometheusExporter } from '@opentelemetry/exporter-prometheus'; -const meter = new MeterRegistry().getMeter('example-ts'); +const meter = new MeterProvider().getMeter('example-ts'); meter.addExporter( new PrometheusExporter({ startServer: true }, () => { diff --git a/getting-started/ts-example/package.json b/getting-started/ts-example/package.json index cb80ec9ead..03f13ec9be 100644 --- a/getting-started/ts-example/package.json +++ b/getting-started/ts-example/package.json @@ -13,6 +13,7 @@ "ts-node": "^8.6.2" }, "dependencies": { + "@opentelemetry/api": "^0.3.3", "@opentelemetry/core": "^0.3.3", "@opentelemetry/exporter-prometheus": "^0.3.3", "@opentelemetry/exporter-zipkin": "^0.3.3", @@ -20,7 +21,6 @@ "@opentelemetry/node": "^0.3.3", "@opentelemetry/plugin-http": "^0.3.3", "@opentelemetry/tracing": "^0.3.3", - "@opentelemetry/types": "^0.3.3", "axios": "^0.19.1", "express": "^4.17.1" } diff --git a/getting-started/ts-example/tracing.ts b/getting-started/ts-example/tracing.ts index ddaac1a760..cc8bae9b15 100644 --- a/getting-started/ts-example/tracing.ts +++ b/getting-started/ts-example/tracing.ts @@ -1,15 +1,15 @@ -import * as opentelemetry from "@opentelemetry/core"; -import { NodeTracerRegistry } from "@opentelemetry/node"; +import * as opentelemetry from "@opentelemetry/api"; +import { NodeTracerProvider } from "@opentelemetry/node"; import { SimpleSpanProcessor } from "@opentelemetry/tracing"; import { ZipkinExporter } from "@opentelemetry/exporter-zipkin"; -const tracerRegistry: NodeTracerRegistry = new NodeTracerRegistry({ +const provider: NodeTracerProvider = new NodeTracerProvider({ logLevel: opentelemetry.LogLevel.ERROR }); -opentelemetry.initGlobalTracerRegistry(tracerRegistry); +opentelemetry.trace.initGlobalTracerProvider(provider); -tracerRegistry.addSpanProcessor( +provider.addSpanProcessor( new SimpleSpanProcessor( new ZipkinExporter({ serviceName: "getting-started" diff --git a/packages/opentelemetry-node/README.md b/packages/opentelemetry-node/README.md index 92c011d6e9..d0a10939b7 100644 --- a/packages/opentelemetry-node/README.md +++ b/packages/opentelemetry-node/README.md @@ -69,7 +69,7 @@ const provider = new NodeTracerProvider({ }); // Initialize the provider -opentelemetry.initGlobalTracerProvider(provider); +opentelemetry.trace.initGlobalTracerProvider(provider); // Your application code - http will automatically be instrumented if // @opentelemetry/plugin-http is present