diff --git a/.circleci/config.yml b/.circleci/config.yml
index 135c4e16d61..e2da6c0c118 100644
--- a/.circleci/config.yml
+++ b/.circleci/config.yml
@@ -169,7 +169,10 @@ jobs:
- checkout
- run:
name: Install minimal doc and lint modules globally
- command: npm i -g tslint lerna typedoc linkinator typescript gts tslint-consistent-codestyle tslint-microsoft-contrib
+ command: npm i -g tslint lerna typedoc linkinator typescript tslint-consistent-codestyle tslint-microsoft-contrib
+ - run:
+ name: Install gts version 1.1.0 globally
+ command: npm i -g gts@1.1.0
- run:
name: Symlink global modules into all lerna packages
command: lerna exec 'npm link tslint lerna typedoc linkinator typescript gts tslint-consistent-codestyle tslint-microsoft-contrib'
@@ -273,3 +276,4 @@ workflows:
- node12
- node13
- node12-browsers
+
diff --git a/examples/collector-exporter-node/README.md b/examples/collector-exporter-node/README.md
new file mode 100644
index 00000000000..3b84a51e163
--- /dev/null
+++ b/examples/collector-exporter-node/README.md
@@ -0,0 +1,39 @@
+# Overview
+
+This example shows how to use [@opentelemetry/exporter-collector](https://github.com/open-telemetry/opentelemetry-js/tree/master/packages/opentelemetry-exporter-collector) to instrument a simple Node.js application.
+
+This example will export spans data simultaneously using [Exporter Collector](https://github.com/open-telemetry/opentelemetry-js/tree/master/packages/opentelemetry-exporter-collector) and grpc. It will use [proto format](https://github.com/open-telemetry/opentelemetry-proto).
+
+
+## Installation
+
+```shell script
+$ # from this directory
+$ npm install
+```
+
+## Run the Application
+
+1. Run docker
+```shell script
+$ # from this directory
+$ npm run docker:start
+```
+
+2. Run app
+```shell script
+$ # from this directory
+$ npm start
+```
+
+3. Open page at http://localhost:9411/zipkin/ - you should be able to see the spans in zipkin
+![Screenshot of the running example](images/spans.png)
+
+
+## Useful links
+- For more information on OpenTelemetry, visit:
+- For more information on tracing, visit:
+
+## LICENSE
+
+Apache License 2.0
diff --git a/examples/collector-exporter-node/docker/collector-config.yaml b/examples/collector-exporter-node/docker/collector-config.yaml
new file mode 100644
index 00000000000..2f64d8b4fc6
--- /dev/null
+++ b/examples/collector-exporter-node/docker/collector-config.yaml
@@ -0,0 +1,18 @@
+receivers:
+ otlp:
+ endpoint: 0.0.0.0:55678
+
+exporters:
+ zipkin:
+ url: "http://zipkin-all-in-one:9411/api/v2/spans"
+
+processors:
+ batch:
+ queued_retry:
+
+service:
+ pipelines:
+ traces:
+ receivers: [otlp]
+ exporters: [zipkin]
+ processors: [batch, queued_retry]
diff --git a/examples/collector-exporter-node/docker/docker-compose.yaml b/examples/collector-exporter-node/docker/docker-compose.yaml
new file mode 100644
index 00000000000..fee8f1aca03
--- /dev/null
+++ b/examples/collector-exporter-node/docker/docker-compose.yaml
@@ -0,0 +1,19 @@
+version: "2"
+services:
+
+ # Collector
+ collector:
+ image: omnition/opentelemetry-collector-contrib:0.2.8
+ command: ["--config=/conf/collector-config.yaml", "--log-level=DEBUG"]
+ volumes:
+ - ./collector-config.yaml:/conf/collector-config.yaml
+ ports:
+ - "55678:55678"
+ depends_on:
+ - zipkin-all-in-one
+
+ # Zipkin
+ zipkin-all-in-one:
+ image: openzipkin/zipkin:latest
+ ports:
+ - "9411:9411"
diff --git a/examples/collector-exporter-node/images/spans.png b/examples/collector-exporter-node/images/spans.png
new file mode 100644
index 00000000000..ae70839afdc
Binary files /dev/null and b/examples/collector-exporter-node/images/spans.png differ
diff --git a/examples/collector-exporter-node/package.json b/examples/collector-exporter-node/package.json
new file mode 100644
index 00000000000..861b5076b44
--- /dev/null
+++ b/examples/collector-exporter-node/package.json
@@ -0,0 +1,34 @@
+{
+ "name": "example-collector-exporter-node",
+ "private": true,
+ "version": "0.6.1",
+ "description": "Example of using @opentelemetry/collector-exporter in Node.js",
+ "main": "index.js",
+ "scripts": {
+ "start": "node ./start.js",
+ "docker:start": "cd ./docker && docker-compose down && docker-compose up",
+ "docker:stop": "cd ./docker && docker-compose down"
+ },
+ "repository": {
+ "type": "git",
+ "url": "git+ssh://git@github.com/open-telemetry/opentelemetry-js.git"
+ },
+ "keywords": [
+ "opentelemetry",
+ "tracing"
+ ],
+ "engines": {
+ "node": ">=8"
+ },
+ "author": "OpenTelemetry Authors",
+ "license": "Apache-2.0",
+ "bugs": {
+ "url": "https://github.com/open-telemetry/opentelemetry-js/issues"
+ },
+ "dependencies": {
+ "@opentelemetry/api": "^0.6.1",
+ "@opentelemetry/exporter-collector": "^0.6.1",
+ "@opentelemetry/tracing": "^0.6.1"
+ },
+ "homepage": "https://github.com/open-telemetry/opentelemetry-js#readme"
+}
diff --git a/examples/collector-exporter-node/start.js b/examples/collector-exporter-node/start.js
new file mode 100644
index 00000000000..9acbcc06870
--- /dev/null
+++ b/examples/collector-exporter-node/start.js
@@ -0,0 +1,52 @@
+'use strict';
+
+const opentelemetry = require('@opentelemetry/api');
+const { BasicTracerProvider, SimpleSpanProcessor } = require('@opentelemetry/tracing');
+const { CollectorExporter } = require('@opentelemetry/exporter-collector');
+
+const address = '127.0.0.1:55678';
+const exporter = new CollectorExporter({
+ serviceName: 'basic-service',
+ url: address,
+});
+
+const provider = new BasicTracerProvider();
+provider.addSpanProcessor(new SimpleSpanProcessor(exporter));
+provider.register();
+
+const tracer = opentelemetry.trace.getTracer('example-collector-exporter-node');
+
+// Create a span. A span must be closed.
+const parentSpan = tracer.startSpan('main');
+for (let i = 0; i < 10; i += 1) {
+ doWork(parentSpan);
+}
+// Be sure to end the span.
+parentSpan.end();
+
+// give some time before it is closed
+setTimeout(() => {
+ // flush and close the connection.
+ exporter.shutdown();
+}, 2000);
+
+function doWork(parent) {
+ // Start another span. In this example, the main method already started a
+ // span, so that'll be the parent span, and this will be a child span.
+ const span = tracer.startSpan('doWork', {
+ parent,
+ });
+
+ // simulate some random work.
+ for (let i = 0; i <= Math.floor(Math.random() * 40000000); i += 1) {
+ // empty
+ }
+ // Set attributes to the span.
+ span.setAttribute('key', 'value');
+
+ // Annotate our span to capture metadata about our operation
+ span.addEvent('invoking doWork');
+
+ // end span
+ span.end();
+}