Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update getting started to tracer registry #709

Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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