Skip to content

Commit

Permalink
fix: to tracer registry (#709)
Browse files Browse the repository at this point in the history
  • Loading branch information
Naseem authored and mayurkale22 committed Jan 20, 2020
1 parent 6de9afb commit 8b62485
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 15 deletions.
14 changes: 7 additions & 7 deletions getting-started/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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",
Expand Down
6 changes: 3 additions & 3 deletions getting-started/traced-example/tracing.js
Original file line number Diff line number Diff line change
@@ -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(
Expand Down
9 changes: 4 additions & 5 deletions getting-started/ts-example/tracing.ts
Original file line number Diff line number Diff line change
@@ -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"
Expand Down

0 comments on commit 8b62485

Please sign in to comment.