Skip to content

Commit

Permalink
chore!: rename collector exporters (open-telemetry#2476)
Browse files Browse the repository at this point in the history
* chore!: rename collector exporters

* chore: finish renaming

* chore: finish renaming

* chore: typo
  • Loading branch information
dyladan authored Sep 15, 2021
1 parent 745bd5c commit bebd82a
Show file tree
Hide file tree
Showing 124 changed files with 561 additions and 538 deletions.
8 changes: 4 additions & 4 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[submodule "packages/opentelemetry-exporter-collector-grpc/protos"]
path = packages/opentelemetry-exporter-collector-grpc/protos
[submodule "packages/opentelemetry-exporter-otlp-grpc/protos"]
path = packages/opentelemetry-exporter-otlp-grpc/protos
url = https://github.com/open-telemetry/opentelemetry-proto.git
[submodule "packages/opentelemetry-exporter-collector-proto/protos"]
path = packages/opentelemetry-exporter-collector-proto/protos
[submodule "packages/opentelemetry-exporter-otlp-proto/protos"]
path = packages/opentelemetry-exporter-otlp-proto/protos
url = https://github.com/open-telemetry/opentelemetry-proto.git
25 changes: 24 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,30 @@ To request automatic tracing support for a module not on this list, please [file

## Upgrade guidelines

### 0.24.x to x
### 0.25.x to 1.x.y

Collector exporter packages and types are renamed:

- `@opentelemetry/exporter-collector` => `@opentelemetry/exporter-otlp-http`
- `CollectorExporterBase` => `OTLPExporterBase`
- `CollectorTraceExporter` => `OTLPTraceExporter`
- `CollectorMetricExporter` => `OTLPMetricExporter`
- `CollectorExporterBrowserBase` => `OTLPExporterBrowserBase`
- `CollectorExporterNodeBase` => `OTLPExporterNodeBase`
- `CollectorExporterConfigBase` => `OTLPExporterConfigBase`
- `CollectorExporterError` => `OTLPExporterError`
- `COLLECTOR_SPAN_KIND_MAPPING` => `OTLP_SPAN_KIND_MAPPING`
- `collectorTypes` => `otlpTypes`
- `@opentelemetry/exporter-collector-grpc` => `@opentelemetry/exporter-otlp-grpc`
- `CollectorTraceExporter` => `OTLPTraceExporter`
- `CollectorMetricExporter` => `OTLPMetricExporter`
- `CollectorExporterConfigNode` => `OTLPExporterConfigNode`
- `@opentelemetry/exporter-collector-proto` => `@opentelemetry/exporter-otlp-proto`
- `CollectorExporterNodeBase` => `OTLPExporterNodeBase`
- `CollectorMetricExporter` => `OTLPMetricExporter`
- `CollectorTraceExporter` => `OTLPTraceExporter`

### 0.24.x to 0.25.x

- SDKs packages for trace and metrics has been renamed to have a consistent naming schema:
- @opentelemetry/tracing -> @opentelemetry/sdk-trace-base
Expand Down
2 changes: 1 addition & 1 deletion examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use the latest and greatest features, and best practices.
|[http](http/) | HTTP Instrumentation to automatically collect trace data and export them to the backend of choice | Intermediate |
|[https](https/) | HTTPS Instrumentation to automatically collect trace data and export them to the backend of choice | Intermediate |
|[grpc](grpc/) | gRPC Instrumentation to automatically collect trace data and export them to the backend of choice | Intermediate |
|[collector-exporter-node](collector-exporter-node/) | This example shows how to use `@opentelemetry/exporter-collector` to instrument a simple Node.js application | Intermediate |
|[otlp-exporter-node](otlp-exporter-node/) | This example shows how to use `@opentelemetry/exporter-otlp-http` to instrument a simple Node.js application | Intermediate |
|[opentracing-shim](opentracing-shim/) | This is a simple example that demonstrates how existing OpenTracing instrumentation can be integrated with OpenTelemetry | Intermediate |

Additional examples can be found at [@opentelemetry/opentelemetry-js-contrib][opentelemetry-js-contrib-examples]
Expand Down
2 changes: 1 addition & 1 deletion examples/basic-tracer-node/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,4 @@ Click on the trace to view its details.

Apache License 2.0

[opentelemetry-collector-url]: https://github.com/open-telemetry/opentelemetry-exporter-collector
[opentelemetry-collector-url]: https://github.com/open-telemetry/opentelemetry-exporter-otlp-http
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Overview

This example shows how to use [@opentelemetry/exporter-collector](https://github.com/open-telemetry/opentelemetry-js/tree/main/packages/opentelemetry-exporter-collector) to instrument a simple Node.js application.
This example shows how to use [@opentelemetry/exporter-otlp-http](https://github.com/open-telemetry/opentelemetry-js/tree/main/packages/opentelemetry-exporter-otlp-http) 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/main/packages/opentelemetry-exporter-collector) and grpc. It will use [proto format](https://github.com/open-telemetry/opentelemetry-proto).
This example will export spans data simultaneously using [Exporter Collector](https://github.com/open-telemetry/opentelemetry-js/tree/main/packages/opentelemetry-exporter-otlp-http) and grpc. It will use [proto format](https://github.com/open-telemetry/opentelemetry-proto).

## Installation

Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
'use strict';

const { DiagConsoleLogger, DiagLogLevel, diag } = require('@opentelemetry/api');
const { CollectorMetricExporter } = require('@opentelemetry/exporter-collector');
// const { CollectorMetricExporter } = require('@opentelemetry/exporter-collector-grpc');
// const { CollectorMetricExporter } = require('@opentelemetry/exporter-collector-proto');
const { OTLPMetricExporter } = require('@opentelemetry/exporter-otlp-http');
// const { OTLPMetricExporter } = require('@opentelemetry/exporter-otlp-grpc');
// const { OTLPMetricExporter } = require('@opentelemetry/exporter-otlp-proto');
const { MeterProvider } = require('@opentelemetry/sdk-metrics-base');
const { Resource } = require('@opentelemetry/resources');
const { SemanticResourceAttributes } = require('@opentelemetry/semantic-conventions');

// Optional and only needed to see the internal diagnostic logging (during development)
diag.setLogger(new DiagConsoleLogger(), DiagLogLevel.DEBUG);

const metricExporter = new CollectorMetricExporter({
const metricExporter = new OTLPMetricExporter({
// url: 'http://localhost:55681/v1/metrics',
});

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "example-collector-exporter-node",
"name": "example-otlp-exporter-node",
"private": true,
"version": "0.25.0",
"description": "Example of using @opentelemetry/collector-exporter in Node.js",
Expand Down Expand Up @@ -30,9 +30,9 @@
"dependencies": {
"@opentelemetry/api": "^1.0.2",
"@opentelemetry/core": "0.25.0",
"@opentelemetry/exporter-collector": "0.25.0",
"@opentelemetry/exporter-collector-grpc": "0.25.0",
"@opentelemetry/exporter-collector-proto": "0.25.0",
"@opentelemetry/exporter-otlp-http": "0.25.0",
"@opentelemetry/exporter-otlp-grpc": "0.25.0",
"@opentelemetry/exporter-otlp-proto": "0.25.0",
"@opentelemetry/resources": "0.25.0",
"@opentelemetry/semantic-conventions": "0.25.0",
"@opentelemetry/sdk-metrics-base": "0.25.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@

const opentelemetry = require('@opentelemetry/api');
const { BasicTracerProvider, ConsoleSpanExporter, SimpleSpanProcessor } = require('@opentelemetry/sdk-trace-base');
const { CollectorTraceExporter } = require('@opentelemetry/exporter-collector');
const { OTLPTraceExporter } = require('@opentelemetry/exporter-otlp-http');
const { Resource } = require('@opentelemetry/resources');
const { SemanticResourceAttributes } = require('@opentelemetry/semantic-conventions');
// const { CollectorTraceExporter } = require('@opentelemetry/exporter-collector-grpc');
// const { CollectorTraceExporter } = require('@opentelemetry/exporter-collector-proto');
// const { OTLPTraceExporter } = require('@opentelemetry/exporter-otlp-grpc');
// const { OTLPTraceExporter } = require('@opentelemetry/exporter-otlp-proto');

// opentelemetry.diag.setLogger(
// new opentelemetry.DiagConsoleLogger(),
// opentelemetry.DiagLogLevel.DEBUG,
// );

const exporter = new CollectorTraceExporter({
const exporter = new OTLPTraceExporter({
// headers: {
// foo: 'bar'
// },
Expand All @@ -28,7 +28,7 @@ provider.addSpanProcessor(new SimpleSpanProcessor(exporter));
provider.addSpanProcessor(new SimpleSpanProcessor(new ConsoleSpanExporter()));
provider.register();

const tracer = opentelemetry.trace.getTracer('example-collector-exporter-node');
const tracer = opentelemetry.trace.getTracer('example-otlp-exporter-node');

// Create a span. A span must be closed.
const parentSpan = tracer.startSpan('main');
Expand Down
4 changes: 2 additions & 2 deletions examples/tracer-web/examples/fetch/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict';
import { context, trace } from '@opentelemetry/api';
import { ConsoleSpanExporter, SimpleSpanProcessor } from '@opentelemetry/sdk-trace-base';
import { CollectorTraceExporter } from '@opentelemetry/exporter-collector';
import { OTLPTraceExporter } from '@opentelemetry/exporter-otlp-http';
import { WebTracerProvider } from '@opentelemetry/sdk-trace-web';
import { FetchInstrumentation } from '@opentelemetry/instrumentation-fetch';
import { ZoneContextManager } from '@opentelemetry/context-zone';
Expand All @@ -10,7 +10,7 @@ import { registerInstrumentations } from '@opentelemetry/instrumentation';

const provider = new WebTracerProvider();
provider.addSpanProcessor(new SimpleSpanProcessor(new ConsoleSpanExporter()));
provider.addSpanProcessor(new SimpleSpanProcessor(new CollectorTraceExporter()));
provider.addSpanProcessor(new SimpleSpanProcessor(new OTLPTraceExporter()));
provider.register({
contextManager: new ZoneContextManager(),
propagator: new B3Propagator(),
Expand Down
2 changes: 1 addition & 1 deletion examples/tracer-web/examples/metrics/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<button id="stopBtn">Stop metrics</button>
<br/>

If you run the collector from example "opentelemetry-exporter-collector" you should see traces at: <br/>
If you run the collector from example "opentelemetry-exporter-otlp-http" you should see traces at: <br/>
<a href="http://localhost:9090/graph?g0.range_input=1m&g0.expr=requests&g0.tab=0/" target="_blank">http://localhost:9090/</a>

</body>
Expand Down
4 changes: 2 additions & 2 deletions examples/tracer-web/examples/metrics/index.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
'use strict';

const { DiagConsoleLogger, DiagLogLevel, diag } = require('@opentelemetry/api');
const { CollectorMetricExporter } = require('@opentelemetry/exporter-collector');
const { OTLPMetricExporter } = require('@opentelemetry/exporter-otlp-http');
const { MeterProvider } = require('@opentelemetry/sdk-metrics-base');
const { Resource } = require('@opentelemetry/resources');
const { SemanticResourceAttributes } = require('@opentelemetry/semantic-conventions');

// Optional and only needed to see the internal diagnostic logging (during development)
diag.setLogger(new DiagConsoleLogger(), DiagLogLevel.DEBUG);

const metricExporter = new CollectorMetricExporter();
const metricExporter = new OTLPMetricExporter();

let interval;
let meter;
Expand Down
4 changes: 2 additions & 2 deletions examples/tracer-web/examples/xml-http-request/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ import { ConsoleSpanExporter, SimpleSpanProcessor } from '@opentelemetry/sdk-tra
import { WebTracerProvider } from '@opentelemetry/sdk-trace-web';
import { XMLHttpRequestInstrumentation } from '@opentelemetry/instrumentation-xml-http-request';
import { ZoneContextManager } from '@opentelemetry/context-zone';
import { CollectorTraceExporter } from '@opentelemetry/exporter-collector';
import { OTLPTraceExporter } from '@opentelemetry/exporter-otlp-http';
import { B3Propagator } from '@opentelemetry/propagator-b3';
import { registerInstrumentations } from '@opentelemetry/instrumentation';

const providerWithZone = new WebTracerProvider();
providerWithZone.addSpanProcessor(new SimpleSpanProcessor(new ConsoleSpanExporter()));
providerWithZone.addSpanProcessor(new SimpleSpanProcessor(new CollectorTraceExporter()));
providerWithZone.addSpanProcessor(new SimpleSpanProcessor(new OTLPTraceExporter()));

providerWithZone.register({
contextManager: new ZoneContextManager(),
Expand Down
2 changes: 1 addition & 1 deletion examples/tracer-web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"@opentelemetry/api": "^1.0.2",
"@opentelemetry/context-zone": "0.25.0",
"@opentelemetry/core": "0.25.0",
"@opentelemetry/exporter-collector": "0.25.0",
"@opentelemetry/exporter-otlp-http": "0.25.0",
"@opentelemetry/exporter-zipkin": "0.25.0",
"@opentelemetry/instrumentation": "0.25.0",
"@opentelemetry/instrumentation-fetch": "0.25.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ This module provides exporter for web and node to be used with [opentelemetry-co
## Installation

```bash
npm install --save @opentelemetry/exporter-collector-grpc
npm install --save @opentelemetry/exporter-otlp-grpc
```

## Service Name
Expand All @@ -20,19 +20,19 @@ In order to set the service name, use the `service.name` resource attribute as p

## Traces in Node - GRPC

The CollectorTraceExporter in Node expects the URL to only be the hostname. It will not work with `/v1/traces`.
The OTLPTraceExporter in Node expects the URL to only be the hostname. It will not work with `/v1/traces`.

```js
const { BasicTracerProvider, SimpleSpanProcessor } = require('@opentelemetry/sdk-trace-base');
const { CollectorTraceExporter } = require('@opentelemetry/exporter-collector-grpc');
const { OTLPTraceExporter } = require('@opentelemetry/exporter-otlp-grpc');

const collectorOptions = {
// url is optional and can be omitted - default is grpc://localhost:4317
url: 'grpc://<collector-hostname>:<port>',
};

const provider = new BasicTracerProvider();
const exporter = new CollectorTraceExporter(collectorOptions);
const exporter = new OTLPTraceExporter(collectorOptions);
provider.addSpanProcessor(new SimpleSpanProcessor(exporter));

provider.register();
Expand All @@ -48,7 +48,7 @@ const fs = require('fs');
const grpc = require('@grpc/grpc-js');

const { BasicTracerProvider, SimpleSpanProcessor } = require('@opentelemetry/sdk-trace-base');
const { CollectorTraceExporter } = require('@opentelemetry/exporter-collector-grpc');
const { OTLPTraceExporter } = require('@opentelemetry/exporter-otlp-grpc');

const collectorOptions = {
// url is optional and can be omitted - default is grpc://localhost:4317
Expand All @@ -57,7 +57,7 @@ const collectorOptions = {
};

const provider = new BasicTracerProvider();
const exporter = new CollectorTraceExporter(collectorOptions);
const exporter = new OTLPTraceExporter(collectorOptions);
provider.addSpanProcessor(new SimpleSpanProcessor(exporter));

provider.register();
Expand All @@ -84,7 +84,7 @@ The exporter can be configured to send custom metadata with each request as in t
const grpc = require('@grpc/grpc-js');

const { BasicTracerProvider, SimpleSpanProcessor } = require('@opentelemetry/sdk-trace-base');
const { CollectorTraceExporter } = require('@opentelemetry/exporter-collector-grpc');
const { OTLPTraceExporter } = require('@opentelemetry/exporter-otlp-grpc');

const metadata = new grpc.Metadata();
// For instance, an API key or access token might go here.
Expand All @@ -97,7 +97,7 @@ const collectorOptions = {
};

const provider = new BasicTracerProvider();
const exporter = new CollectorTraceExporter(collectorOptions);
const exporter = new OTLPTraceExporter(collectorOptions);
provider.addSpanProcessor(new SimpleSpanProcessor(exporter));

provider.register();
Expand All @@ -110,16 +110,16 @@ Note, that this will only work if TLS is also configured on the server.

## Metrics in Node - GRPC

The CollectorTraceExporter in Node expects the URL to only be the hostname. It will not work with `/v1/metrics`. All options that work with trace also work with metrics.
The OTLPTraceExporter in Node expects the URL to only be the hostname. It will not work with `/v1/metrics`. All options that work with trace also work with metrics.

```js
const { MeterProvider } = require('@opentelemetry/sdk-metrics-base');
const { CollectorMetricExporter } = require('@opentelemetry/exporter-collector-grpc');
const { OTLPMetricExporter } = require('@opentelemetry/exporter-otlp-grpc');
const collectorOptions = {
// url is optional and can be omitted - default is grpc://localhost:4317
url: 'grpc://<collector-hostname>:<port>',
};
const exporter = new CollectorMetricExporter(collectorOptions);
const exporter = new OTLPMetricExporter(collectorOptions);

// Register the exporter
const provider = new MeterProvider({
Expand All @@ -138,7 +138,7 @@ counter.add(10, { 'key': 'value' });

## Running opentelemetry-collector locally to see the traces

1. Go to examples/collector-exporter-node
1. Go to examples/otlp-exporter-node
2. run `npm run docker:start`
3. Open page at `http://localhost:9411/zipkin/` to observe the traces

Expand All @@ -155,11 +155,11 @@ Apache 2.0 - See [LICENSE][license-url] for more information.
[discussions-url]: https://github.com/open-telemetry/opentelemetry-js/discussions
[license-url]: https://github.com/open-telemetry/opentelemetry-js/blob/main/LICENSE
[license-image]: https://img.shields.io/badge/license-Apache_2.0-green.svg?style=flat
[dependencies-image]: https://status.david-dm.org/gh/open-telemetry/opentelemetry-js.svg?path=packages%2Fopentelemetry-exporter-collector-grpc
[dependencies-url]: https://david-dm.org/open-telemetry/opentelemetry-js?path=packages%2Fopentelemetry-exporter-collector-grpc
[devDependencies-image]: https://status.david-dm.org/gh/open-telemetry/opentelemetry-js.svg?path=packages%2Fopentelemetry-exporter-collector-grpc&type=dev
[devDependencies-url]: https://david-dm.org/open-telemetry/opentelemetry-js?path=packages%2Fopentelemetry-exporter-collector-grpc&type=dev
[npm-url]: https://www.npmjs.com/package/@opentelemetry/exporter-collector-grpc
[dependencies-image]: https://status.david-dm.org/gh/open-telemetry/opentelemetry-js.svg?path=packages%2Fopentelemetry-exporter-otlp-grpc
[dependencies-url]: https://david-dm.org/open-telemetry/opentelemetry-js?path=packages%2Fopentelemetry-exporter-otlp-grpc
[devDependencies-image]: https://status.david-dm.org/gh/open-telemetry/opentelemetry-js.svg?path=packages%2Fopentelemetry-exporter-otlp-grpc&type=dev
[devDependencies-url]: https://david-dm.org/open-telemetry/opentelemetry-js?path=packages%2Fopentelemetry-exporter-otlp-grpc&type=dev
[npm-url]: https://www.npmjs.com/package/@opentelemetry/exporter-otlp-grpc
[npm-img]: https://badge.fury.io/js/%40opentelemetry%2Fexporter-collector-grpc.svg
[opentelemetry-collector-url]: https://github.com/open-telemetry/opentelemetry-collector
[semconv-resource-service-name]: https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/resource/semantic_conventions/README.md#service
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "@opentelemetry/exporter-collector-grpc",
"name": "@opentelemetry/exporter-otlp-grpc",
"version": "0.25.0",
"description": "OpenTelemetry Collector Exporter allows user to send collected traces to the OpenTelemetry Collector",
"main": "build/src/index.js",
Expand Down Expand Up @@ -70,7 +70,7 @@
"@grpc/grpc-js": "^1.3.7",
"@grpc/proto-loader": "^0.6.4",
"@opentelemetry/core": "0.25.0",
"@opentelemetry/exporter-collector": "0.25.0",
"@opentelemetry/exporter-otlp-http": "0.25.0",
"@opentelemetry/sdk-metrics-base": "0.25.0",
"@opentelemetry/resources": "0.25.0",
"@opentelemetry/sdk-trace-base": "0.25.0"
Expand Down
Loading

0 comments on commit bebd82a

Please sign in to comment.