From ec4de16ea16deda6b19a0d16736b4978af08290f Mon Sep 17 00:00:00 2001 From: Naseem Date: Wed, 22 Jan 2020 21:06:20 -0500 Subject: [PATCH] fix: ioredis example --- examples/ioredis/index.js | 2 ++ examples/ioredis/package.json | 14 +++++++------- examples/ioredis/tracer.js | 4 ++-- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/examples/ioredis/index.js b/examples/ioredis/index.js index aac0986be4c..ac1e5ec4f6a 100644 --- a/examples/ioredis/index.js +++ b/examples/ioredis/index.js @@ -10,8 +10,10 @@ async function main() { try { await redis.set('test', 'data'); await redis.get('test'); + process.exit(0); } catch (error) { console.error(error); + process.exit(1); } } diff --git a/examples/ioredis/package.json b/examples/ioredis/package.json index 056121566f3..97f1248a812 100644 --- a/examples/ioredis/package.json +++ b/examples/ioredis/package.json @@ -1,7 +1,7 @@ { "name": "ioredis-example", "private": true, - "version": "0.3.2", + "version": "0.3.3", "description": "Example of HTTP integration with OpenTelemetry", "main": "index.js", "scripts": { @@ -28,12 +28,12 @@ "url": "https://github.com/open-telemetry/opentelemetry-js/issues" }, "dependencies": { - "@opentelemetry/core": "^0.3.2", - "@opentelemetry/exporter-jaeger": "^0.3.2", - "@opentelemetry/exporter-zipkin": "^0.3.2", - "@opentelemetry/node": "^0.3.2", - "@opentelemetry/plugin-ioredis": "^0.3.2", - "@opentelemetry/tracing": "^0.3.2", + "@opentelemetry/core": "^0.3.3", + "@opentelemetry/exporter-jaeger": "^0.3.3", + "@opentelemetry/exporter-zipkin": "^0.3.3", + "@opentelemetry/node": "^0.3.3", + "@opentelemetry/plugin-ioredis": "^0.3.3", + "@opentelemetry/tracing": "^0.3.3", "ioredis": "^4.14.1" }, "homepage": "https://github.com/open-telemetry/opentelemetry-js#readme", diff --git a/examples/ioredis/tracer.js b/examples/ioredis/tracer.js index 11e053fef72..34b29d1fa33 100644 --- a/examples/ioredis/tracer.js +++ b/examples/ioredis/tracer.js @@ -8,7 +8,7 @@ const { ZipkinExporter } = require('@opentelemetry/exporter-zipkin'); const EXPORTER = process.env.EXPORTER || ''; -const tracer = new NodeTracer(); +const tracerRegistry = new NodeTracerRegistry(); let exporter; if (EXPORTER.toLowerCase().startsWith('z')) { @@ -24,6 +24,6 @@ if (EXPORTER.toLowerCase().startsWith('z')) { tracer.addSpanProcessor(new SimpleSpanProcessor(exporter)); // Initialize the OpenTelemetry APIs to use the BasicTracer bindings -opentelemetry.initGlobalTracer(tracer); +opentelemetry.initGlobalTracerRegistry(tracerRegistry); module.exports = opentelemetry.getTracer();