From e859b8e930e121d4226eda7671d096c7ee253b16 Mon Sep 17 00:00:00 2001 From: Mayur Kale Date: Fri, 27 Dec 2019 05:58:24 -0800 Subject: [PATCH] chore: update plugin readme with example links (#647) --- .../README.md | 2 ++ packages/opentelemetry-plugin-mysql/README.md | 24 +++++++++++++++++-- packages/opentelemetry-plugin-redis/README.md | 2 +- .../README.md | 4 +++- .../opentelemetry-shim-opentracing/README.md | 2 ++ 5 files changed, 30 insertions(+), 4 deletions(-) diff --git a/packages/opentelemetry-plugin-document-load/README.md b/packages/opentelemetry-plugin-document-load/README.md index a3a8d30533..f9f3ab4525 100644 --- a/packages/opentelemetry-plugin-document-load/README.md +++ b/packages/opentelemetry-plugin-document-load/README.md @@ -57,6 +57,8 @@ Because the browser does not send a trace context header for the initial page na ``` +See [examples/tracer-web](https://github.com/open-telemetry/opentelemetry-js/tree/master/examples/tracer-web) for a short example. + ## Useful links - For more information on OpenTelemetry, visit: - For more about OpenTelemetry JavaScript: diff --git a/packages/opentelemetry-plugin-mysql/README.md b/packages/opentelemetry-plugin-mysql/README.md index 253c22e0d2..fb2e08e183 100644 --- a/packages/opentelemetry-plugin-mysql/README.md +++ b/packages/opentelemetry-plugin-mysql/README.md @@ -20,12 +20,32 @@ npm install --save @opentelemetry/plugin-mysql ## Usage +OpenTelemetry MySQL Instrumentation allows the user to automatically collect trace data and export them to the backend of choice, to give observability to distributed systems when working with [mysql](https://www.npmjs.com/package/mysql). + +To load a specific plugin (**MySQL** in this case), specify it in the Node Tracer's configuration +```js +const { NodeTracer } = require('@opentelemetry/node'); + +const tracer = new NodeTracer({ + plugins: { + mysql: { + enabled: true, + // You may use a package name or absolute path to the file. + path: '@opentelemetry/plugin-mysql', + } + } +}); +``` + +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 opentelemetry = require('@opentelemetry/plugin-mysql'); +const { NodeTracer } = require('@opentelemetry/node'); -// TODO: DEMONSTRATE API +const tracer = new NodeTracer(); ``` +See [examples/mysql](https://github.com/open-telemetry/opentelemetry-js/tree/master/examples/mysql) for a short example. + ## Useful links - For more information on OpenTelemetry, visit: - For more about OpenTelemetry JavaScript: diff --git a/packages/opentelemetry-plugin-redis/README.md b/packages/opentelemetry-plugin-redis/README.md index 9c0a44ef44..25f5f62f3f 100644 --- a/packages/opentelemetry-plugin-redis/README.md +++ b/packages/opentelemetry-plugin-redis/README.md @@ -44,7 +44,7 @@ const { NodeTracer } = require('@opentelemetry/node'); const tracer = new NodeTracer(); ``` - +See [examples/redis](https://github.com/open-telemetry/opentelemetry-js/tree/master/examples/redis) for a short example. ## Useful links - For more information on OpenTelemetry, visit: diff --git a/packages/opentelemetry-plugin-xml-http-request/README.md b/packages/opentelemetry-plugin-xml-http-request/README.md index e647c8a6b0..a19f8a7d34 100644 --- a/packages/opentelemetry-plugin-xml-http-request/README.md +++ b/packages/opentelemetry-plugin-xml-http-request/README.md @@ -25,7 +25,7 @@ const webTracerWithZone = new WebTracer({ scopeManager: new ZoneScopeManager(), plugins: [ new XMLHttpRequestPlugin({ - propagateTraceHeaderCorsUrls: ['http://localhost:8090'] + propagateTraceHeaderCorsUrls: ['http://localhost:8090'] }) ] }); @@ -43,6 +43,8 @@ req.send(); ![Screenshot of the running example](images/request.jpg) ![Screenshot of the running example](images/cors.jpg) +See [examples/tracer-web](https://github.com/open-telemetry/opentelemetry-js/tree/master/examples/tracer-web) for a short example. + ## Useful links - For more information on OpenTelemetry, visit: - For more about OpenTelemetry JavaScript: diff --git a/packages/opentelemetry-shim-opentracing/README.md b/packages/opentelemetry-shim-opentracing/README.md index d6686be1b0..c5a3bec21c 100644 --- a/packages/opentelemetry-shim-opentracing/README.md +++ b/packages/opentelemetry-shim-opentracing/README.md @@ -34,6 +34,8 @@ opentracing.initGlobalTracer(new TracerShim(tracer)); ``` +See [examples/opentracing-shim](https://github.com/open-telemetry/opentelemetry-js/tree/master/examples/opentracing-shim) for a short example. + ## License