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

Named Tracers / Tracer Registry #582

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
d75f53e
feat: spike of named tracer registry
dyladan Dec 2, 2019
ead9f16
Merge remote-tracking branch 'upstream/master' into tracer-registry
dyladan Dec 2, 2019
50927cd
chore: mysql/mongo tracer registry support
dyladan Dec 2, 2019
c686117
fix: lint
dyladan Dec 2, 2019
7dba62c
Merge remote-tracking branch 'upstream/master' into tracer-registry
dyladan Dec 2, 2019
14fa061
chore: add getTracer back
dyladan Dec 2, 2019
b1e887c
chore: change default tracer name to empty string
dyladan Dec 2, 2019
5ca0209
fix: lint
dyladan Dec 2, 2019
217d3b3
Merge branch 'master' into tracer-registry
dyladan Dec 2, 2019
61f4618
chore: update examples for registry
dyladan Dec 2, 2019
33dd773
Merge branch 'tracer-registry' of github.com:dynatrace-oss-contrib/op…
dyladan Dec 2, 2019
6f81608
Merge remote-tracking branch 'upstream/master' into tracer-registry
dyladan Dec 10, 2019
0687f1c
Merge remote-tracking branch 'upstream/master' into tracer-registry
dyladan Dec 17, 2019
cc4eba9
chore(tracer-registry): make name required
dyladan Dec 17, 2019
9d95597
chore: lint
dyladan Dec 17, 2019
3237f99
chore: update examples for required tracer name
dyladan Dec 17, 2019
643e286
chore: remove unused tracer delegate
dyladan Dec 17, 2019
508ff33
Merge remote-tracking branch 'upstream/master' into tracer-registry
dyladan Dec 18, 2019
41c1168
chore: remove references to basic tracer
dyladan Dec 23, 2019
6a94efe
chore: remove references to NodeTracer
dyladan Dec 23, 2019
4693d22
Merge remote-tracking branch 'upstream/master' into tracer-registry
dyladan Dec 26, 2019
13f96fd
chore: update xhr for tracer registry
dyladan Dec 26, 2019
38ffef8
chore: update tracer names to match package names
dyladan Dec 26, 2019
9915a2c
chore: add version script to all packages
dyladan Dec 26, 2019
69ff01f
chore: update plugins to use version script
dyladan Dec 26, 2019
40c4301
chore: add jsdoc to noop tracer registry
dyladan Dec 27, 2019
1eea9d2
Merge remote-tracking branch 'upstream/master' into tracer-registry
dyladan Dec 27, 2019
660f41f
chore: update ioredis for tracer registry
dyladan Dec 27, 2019
8e6399e
chore: update pg pool for tracer registry
dyladan Dec 27, 2019
bd0be2c
fix: lint
dyladan Dec 30, 2019
30a1b36
Merge remote-tracking branch 'upstream/master' into tracer-registry
dyladan Jan 3, 2020
7c39151
chore: fix tests
dyladan Jan 3, 2020
e814df6
chore: lint
dyladan Jan 3, 2020
0ec5b82
Merge remote-tracking branch 'upstream/master' into tracer-registry
dyladan Jan 6, 2020
cd47354
chore: lint
dyladan Jan 6, 2020
bfa8bfa
Merge branch 'master' into tracer-registry
mayurkale22 Jan 9, 2020
5740098
Merge branch 'master' into tracer-registry
mayurkale22 Jan 9, 2020
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
Prev Previous commit
Next Next commit
chore: remove references to NodeTracer
  • Loading branch information
dyladan committed Dec 23, 2019
commit 6a94efedc8d22ff27594190952941fb4b58b1a42
8 changes: 4 additions & 4 deletions examples/opentracing-shim/shim.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
"use strict";

const { NodeTracer } = require("@opentelemetry/node");
const { NodeTracerRegistry } = 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 tracer = new NodeTracer();
const registry = new NodeTracerRegistry();

tracer.addSpanProcessor(new SimpleSpanProcessor(getExporter(serviceName)));
registry.addSpanProcessor(new SimpleSpanProcessor(getExporter(serviceName)));

return new TracerShim(tracer);
return new TracerShim(registry.getTracer("opentracing-shim"));
}

function getExporter(serviceName) {
Expand Down
32 changes: 16 additions & 16 deletions packages/opentelemetry-node/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ For manual instrumentation see the
[@opentelemetry/tracing](https://github.com/open-telemetry/opentelemetry-js/tree/master/packages/opentelemetry-tracing) package.

## How does automated instrumentation work?
This package exposes a `NodeTracer` that will automatically hook into the module loader of Node.js.
This package exposes a `NodeTracerRegistry` that will automatically hook into the module loader of Node.js.

For this to work, please make sure that `NodeTracer` is initialized before any other module of your application, (like `http` or `express`) is loaded.
For this to work, please make sure that `NodeTracerRegistry` is initialized before any other module of your application, (like `http` or `express`) is loaded.

OpenTelemetry comes with a growing number of instrumentation plugins for well know modules (see [supported modules](https://github.com/open-telemetry/opentelemetry-js#plugins)) and an API to create custom plugins (see [the plugin developer guide](https://github.com/open-telemetry/opentelemetry-js/blob/master/doc/plugin-guide.md)).


Whenever a module is loaded `NodeTracer` will check if a matching instrumentation plugin has been installed.
Whenever a module is loaded `NodeTracerRegistry` will check if a matching instrumentation plugin has been installed.

> **Please note:** This module does *not* bundle any plugins. They need to be installed separately.

Expand All @@ -34,7 +34,7 @@ This instrumentation code will automatically
In short, this means that this module will use provided plugins to automatically instrument your application to produce spans and provide end-to-end tracing by just adding a few lines of code.

## Creating custom spans on top of auto-instrumentation
Additionally to automated instrumentation, `NodeTracer` exposes the same API as [@opentelemetry/tracing](https://github.com/open-telemetry/opentelemetry-js/tree/master/packages/opentelemetry-tracing), allowing creating custom spans if needed.
Additionally to automated instrumentation, `NodeTracerRegistry` exposes the same API as [@opentelemetry/tracing](https://github.com/open-telemetry/opentelemetry-js/tree/master/packages/opentelemetry-tracing), allowing creating custom spans if needed.

## Installation

Expand All @@ -50,14 +50,14 @@ npm install --save @opentelemetry/plugin-https

## Usage

The following code will configure the `NodeTracer` to instrument `http` using `@opentelemetry/plugin-http`.
The following code will configure the `NodeTracerRegistry` to instrument `http` using `@opentelemetry/plugin-http`.

```js
const opentelemetry = require('@opentelemetry/core');
const { NodeTracer } = require('@opentelemetry/node');
const { NodeTracerRegistry } = require('@opentelemetry/node');

// Create and configure NodeTracer
const tracer = new NodeTracer({
// Create and configure NodeTracerRegistry
const registry = new NodeTracerRegistry({
plugins: {
http: {
enabled: true,
Expand All @@ -68,25 +68,25 @@ const tracer = new NodeTracer({
}
});

// Initialize the tracer
opentelemetry.initGlobalTracer(tracer);
// Initialize the registry
opentelemetry.initGlobalTracerRegistry(registry);

// Your application code - http will automatically be instrumented if
// @opentelemetry/plugin-http is present
const http = require('http');
```

To enable instrumentation for all [supported modules](https://github.com/open-telemetry/opentelemetry-js#plugins), create an instance of `NodeTracer` without providing any plugin configuration to the constructor.
To enable instrumentation for all [supported modules](https://github.com/open-telemetry/opentelemetry-js#plugins), create an instance of `NodeTracerRegistry` without providing any plugin configuration to the constructor.

```js
const opentelemetry = require('@opentelemetry/core');
const { NodeTracer } = require('@opentelemetry/node');
const { NodeTracerRegistry } = require('@opentelemetry/node');

// Create and initialize NodeTracer
const tracer = new NodeTracer();
// Create and initialize NodeTracerRegistry
const registry = new NodeTracerRegistry();

// Initialize the tracer
opentelemetry.initGlobalTracer(tracer);
// Initialize the registry
opentelemetry.initGlobalTracerRegistry(registry);

// Your application code
// ...
Expand Down
6 changes: 3 additions & 3 deletions packages/opentelemetry-plugin-dns/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ npm install --save @opentelemetry/plugin-dns
## Usage

```js
const { NodeTracer } = require('@opentelemetry/node');
const { NodeTracerRegistry } = require('@opentelemetry/node');

const tracer = new NodeTracer({
const registry = new NodeTracerRegistry({
plugins: {
dns: {
enabled: true,
Expand All @@ -37,7 +37,7 @@ const tracer = new NodeTracer({
If you use Zipkin, you must use `ignoreHostnames` in order to not trace those calls. If the server is local. You can set :

```
const tracer = new NodeTracer({
const registry = new NodeTracerRegistry({
plugins: {
dns: {
enabled: true,
Expand Down
8 changes: 4 additions & 4 deletions packages/opentelemetry-plugin-grpc/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ OpenTelemetry gRPC Instrumentation allows the user to automatically collect trac

To load a specific plugin (**gRPC** in this case), specify it in the Node Tracer's configuration.
```javascript
const { NodeTracer } = require('@opentelemetry/node');
const { NodeTracerRegistry } = require('@opentelemetry/node');

const tracer = new NodeTracer({
const registry = new NodeTracerRegistry({
plugins: {
grpc: {
enabled: true,
Expand All @@ -37,9 +37,9 @@ const tracer = new NodeTracer({

To load all the [supported plugins](https://github.com/open-telemetry/opentelemetry-js#plugins), use below approach. Each plugin is only loaded when the module that it patches is loaded; in other words, there is no computational overhead for listing plugins for unused modules.
```javascript
const { NodeTracer } = require('@opentelemetry/node');
const { NodeTracerRegistry } = require('@opentelemetry/node');

const tracer = new NodeTracer();
const registry = new NodeTracerRegistry();
```

See [examples/grpc](https://github.com/open-telemetry/opentelemetry-js/tree/master/examples/grpc) for a short example.
Expand Down
8 changes: 4 additions & 4 deletions packages/opentelemetry-plugin-http/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ OpenTelemetry HTTP Instrumentation allows the user to automatically collect trac

To load a specific plugin (HTTP in this case), specify it in the Node Tracer's configuration.
```js
const { NodeTracer } = require('@opentelemetry/node');
const { NodeTracerRegistry } = require('@opentelemetry/node');

const tracer = new NodeTracer({
const registry = new NodeTracerRegistry({
plugins: {
http: {
enabled: true,
Expand All @@ -38,9 +38,9 @@ const tracer = new NodeTracer({

To load all the [supported plugins](https://github.com/open-telemetry/opentelemetry-js#plugins), use below approach. Each plugin is only loaded when the module that it patches is loaded; in other words, there is no computational overhead for listing plugins for unused modules.
```js
const { NodeTracer } = require('@opentelemetry/node');
const { NodeTracerRegistry } = require('@opentelemetry/node');

const tracer = new NodeTracer();
const registry = new NodeTracerRegistry();
```

See [examples/http](https://github.com/open-telemetry/opentelemetry-js/tree/master/examples/http) for a short example.
Expand Down
8 changes: 4 additions & 4 deletions packages/opentelemetry-plugin-https/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ OpenTelemetry HTTPS Instrumentation allows the user to automatically collect tra

To load a specific plugin (HTTPS in this case), specify it in the Node Tracer's configuration.
```js
const { NodeTracer } = require('@opentelemetry/node');
const { NodeTracerRegistry } = require('@opentelemetry/node');

const tracer = new NodeTracer({
const registry = new NodeTracerRegistry({
plugins: {
https: {
enabled: true,
Expand All @@ -38,9 +38,9 @@ const tracer = new NodeTracer({

To load all the [supported plugins](https://github.com/open-telemetry/opentelemetry-js#plugins), use below approach. Each plugin is only loaded when the module that it patches is loaded; in other words, there is no computational overhead for listing plugins for unused modules.
```js
const { NodeTracer } = require('@opentelemetry/node');
const { NodeTracerRegistry } = require('@opentelemetry/node');

const tracer = new NodeTracer();
const registry = new NodeTracerRegistry();
```

See [examples/https](https://github.com/open-telemetry/opentelemetry-js/tree/master/examples/https) for a short example.
Expand Down
8 changes: 4 additions & 4 deletions packages/opentelemetry-plugin-mongodb-core/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ OpenTelemetry Mongodb Instrumentation allows the user to automatically collect t

To load a specific plugin (mongodb in this case), specify it in the Node Tracer's configuration.
```js
const { NodeTracer } = require('@opentelemetry/node');
const { NodeTracerRegistry } = require('@opentelemetry/node');

const tracer = new NodeTracer({
const registry = new NodeTracerRegistry({
plugins: {
'mongodb-core': {
enabled: true,
Expand All @@ -36,9 +36,9 @@ const tracer = new NodeTracer({

To load all the [supported plugins](https://github.com/open-telemetry/opentelemetry-js#plugins), use below approach. Each plugin is only loaded when the module that it patches is loaded; in other words, there is no computational overhead for listing plugins for unused modules.
```js
const { NodeTracer } = require('@opentelemetry/node');
const { NodeTracerRegistry } = require('@opentelemetry/node');

const tracer = new NodeTracer();
const registry = new NodeTracerRegistry();
```

See [examples/mongodb](https://github.com/open-telemetry/opentelemetry-js/tree/master/examples/mongodb-core) for a short example.
Expand Down
8 changes: 4 additions & 4 deletions packages/opentelemetry-plugin-redis/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ OpenTelemetry Redis Instrumentation allows the user to automatically collect tra

To load a specific plugin (**redis** in this case), specify it in the Node Tracer's configuration
```js
const { NodeTracer } = require('@opentelemetry/node');
const { NodeTracerRegistry } = require('@opentelemetry/node');

const tracer = new NodeTracer({
const registry = new NodeTracerRegistry({
plugins: {
redis: {
enabled: true,
Expand All @@ -39,9 +39,9 @@ const tracer = new NodeTracer({

To load all the [supported plugins](https://github.com/open-telemetry/opentelemetry-js#plugins), use below approach. Each plugin is only loaded when the module that it patches is loaded; in other words, there is no computational overhead for listing plugins for unused modules.
```javascript
const { NodeTracer } = require('@opentelemetry/node');
const { NodeTracerRegistry } = require('@opentelemetry/node');

const tracer = new NodeTracer();
const registry = new NodeTracerRegistry();
```

<!-- See [examples/redis](https://github.com/open-telemetry/opentelemetry-js/tree/master/examples/redis) for a short example. -->
Expand Down