diff --git a/.gitmodules b/.gitmodules index 1f72e80687..f66e08a1b8 100644 --- a/.gitmodules +++ b/.gitmodules @@ -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 diff --git a/README.md b/README.md index 6a7086a503..d0e06cc564 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/examples/README.md b/examples/README.md index e92bef80ac..fc404138f7 100644 --- a/examples/README.md +++ b/examples/README.md @@ -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] diff --git a/examples/basic-tracer-node/README.md b/examples/basic-tracer-node/README.md index 46f6d3c3a9..6db3fc7834 100644 --- a/examples/basic-tracer-node/README.md +++ b/examples/basic-tracer-node/README.md @@ -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 diff --git a/examples/collector-exporter-node/README.md b/examples/otlp-exporter-node/README.md similarity index 88% rename from examples/collector-exporter-node/README.md rename to examples/otlp-exporter-node/README.md index bbaf44229e..abfa241965 100644 --- a/examples/collector-exporter-node/README.md +++ b/examples/otlp-exporter-node/README.md @@ -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 diff --git a/examples/collector-exporter-node/docker/collector-config.yaml b/examples/otlp-exporter-node/docker/collector-config.yaml similarity index 100% rename from examples/collector-exporter-node/docker/collector-config.yaml rename to examples/otlp-exporter-node/docker/collector-config.yaml diff --git a/examples/collector-exporter-node/docker/docker-compose.yaml b/examples/otlp-exporter-node/docker/docker-compose.yaml similarity index 100% rename from examples/collector-exporter-node/docker/docker-compose.yaml rename to examples/otlp-exporter-node/docker/docker-compose.yaml diff --git a/examples/collector-exporter-node/docker/prometheus.yaml b/examples/otlp-exporter-node/docker/prometheus.yaml similarity index 100% rename from examples/collector-exporter-node/docker/prometheus.yaml rename to examples/otlp-exporter-node/docker/prometheus.yaml diff --git a/examples/collector-exporter-node/images/spans.png b/examples/otlp-exporter-node/images/spans.png similarity index 100% rename from examples/collector-exporter-node/images/spans.png rename to examples/otlp-exporter-node/images/spans.png diff --git a/examples/collector-exporter-node/metrics.js b/examples/otlp-exporter-node/metrics.js similarity index 80% rename from examples/collector-exporter-node/metrics.js rename to examples/otlp-exporter-node/metrics.js index d8df8be495..e0065aa697 100644 --- a/examples/collector-exporter-node/metrics.js +++ b/examples/otlp-exporter-node/metrics.js @@ -1,9 +1,9 @@ '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'); @@ -11,7 +11,7 @@ const { SemanticResourceAttributes } = require('@opentelemetry/semantic-conventi // 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', }); diff --git a/examples/collector-exporter-node/package.json b/examples/otlp-exporter-node/package.json similarity index 85% rename from examples/collector-exporter-node/package.json rename to examples/otlp-exporter-node/package.json index 296b66a79c..8fb2a32a82 100644 --- a/examples/collector-exporter-node/package.json +++ b/examples/otlp-exporter-node/package.json @@ -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", @@ -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", diff --git a/examples/collector-exporter-node/tracing.js b/examples/otlp-exporter-node/tracing.js similarity index 83% rename from examples/collector-exporter-node/tracing.js rename to examples/otlp-exporter-node/tracing.js index c670d3624a..4f718274aa 100644 --- a/examples/collector-exporter-node/tracing.js +++ b/examples/otlp-exporter-node/tracing.js @@ -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' // }, @@ -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'); diff --git a/examples/tracer-web/examples/fetch/index.js b/examples/tracer-web/examples/fetch/index.js index dd966100e9..689a119afd 100644 --- a/examples/tracer-web/examples/fetch/index.js +++ b/examples/tracer-web/examples/fetch/index.js @@ -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'; @@ -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(), diff --git a/examples/tracer-web/examples/metrics/index.html b/examples/tracer-web/examples/metrics/index.html index 7951c564ce..76a3ea5c03 100644 --- a/examples/tracer-web/examples/metrics/index.html +++ b/examples/tracer-web/examples/metrics/index.html @@ -28,7 +28,7 @@
-If you run the collector from example "opentelemetry-exporter-collector" you should see traces at:
+If you run the collector from example "opentelemetry-exporter-otlp-http" you should see traces at:
http://localhost:9090/ diff --git a/examples/tracer-web/examples/metrics/index.js b/examples/tracer-web/examples/metrics/index.js index 2a84819d53..53d6ac6a07 100644 --- a/examples/tracer-web/examples/metrics/index.js +++ b/examples/tracer-web/examples/metrics/index.js @@ -1,7 +1,7 @@ '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'); @@ -9,7 +9,7 @@ const { SemanticResourceAttributes } = require('@opentelemetry/semantic-conventi // 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; diff --git a/examples/tracer-web/examples/xml-http-request/index.js b/examples/tracer-web/examples/xml-http-request/index.js index da99a1bdd9..edf3180bd1 100644 --- a/examples/tracer-web/examples/xml-http-request/index.js +++ b/examples/tracer-web/examples/xml-http-request/index.js @@ -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(), diff --git a/examples/tracer-web/package.json b/examples/tracer-web/package.json index bd85e1c9f8..4605a88754 100644 --- a/examples/tracer-web/package.json +++ b/examples/tracer-web/package.json @@ -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", diff --git a/packages/opentelemetry-exporter-collector-grpc/.eslintignore b/packages/opentelemetry-exporter-otlp-grpc/.eslintignore similarity index 100% rename from packages/opentelemetry-exporter-collector-grpc/.eslintignore rename to packages/opentelemetry-exporter-otlp-grpc/.eslintignore diff --git a/packages/opentelemetry-exporter-collector-grpc/.eslintrc.js b/packages/opentelemetry-exporter-otlp-grpc/.eslintrc.js similarity index 100% rename from packages/opentelemetry-exporter-collector-grpc/.eslintrc.js rename to packages/opentelemetry-exporter-otlp-grpc/.eslintrc.js diff --git a/packages/opentelemetry-exporter-collector-grpc/.npmignore b/packages/opentelemetry-exporter-otlp-grpc/.npmignore similarity index 100% rename from packages/opentelemetry-exporter-collector-grpc/.npmignore rename to packages/opentelemetry-exporter-otlp-grpc/.npmignore diff --git a/packages/opentelemetry-exporter-collector-grpc/LICENSE b/packages/opentelemetry-exporter-otlp-grpc/LICENSE similarity index 100% rename from packages/opentelemetry-exporter-collector-grpc/LICENSE rename to packages/opentelemetry-exporter-otlp-grpc/LICENSE diff --git a/packages/opentelemetry-exporter-collector-grpc/README.md b/packages/opentelemetry-exporter-otlp-grpc/README.md similarity index 82% rename from packages/opentelemetry-exporter-collector-grpc/README.md rename to packages/opentelemetry-exporter-otlp-grpc/README.md index 0e6738705b..1ef2a34732 100644 --- a/packages/opentelemetry-exporter-collector-grpc/README.md +++ b/packages/opentelemetry-exporter-otlp-grpc/README.md @@ -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 @@ -20,11 +20,11 @@ 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 @@ -32,7 +32,7 @@ const collectorOptions = { }; const provider = new BasicTracerProvider(); -const exporter = new CollectorTraceExporter(collectorOptions); +const exporter = new OTLPTraceExporter(collectorOptions); provider.addSpanProcessor(new SimpleSpanProcessor(exporter)); provider.register(); @@ -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 @@ -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(); @@ -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. @@ -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(); @@ -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://:', }; -const exporter = new CollectorMetricExporter(collectorOptions); +const exporter = new OTLPMetricExporter(collectorOptions); // Register the exporter const provider = new MeterProvider({ @@ -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 @@ -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 diff --git a/packages/opentelemetry-exporter-collector-grpc/package.json b/packages/opentelemetry-exporter-otlp-grpc/package.json similarity index 95% rename from packages/opentelemetry-exporter-collector-grpc/package.json rename to packages/opentelemetry-exporter-otlp-grpc/package.json index 68c1035187..e4a7e9411b 100644 --- a/packages/opentelemetry-exporter-collector-grpc/package.json +++ b/packages/opentelemetry-exporter-otlp-grpc/package.json @@ -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", @@ -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" diff --git a/packages/opentelemetry-exporter-collector-grpc/protos b/packages/opentelemetry-exporter-otlp-grpc/protos similarity index 100% rename from packages/opentelemetry-exporter-collector-grpc/protos rename to packages/opentelemetry-exporter-otlp-grpc/protos diff --git a/packages/opentelemetry-exporter-collector-grpc/src/CollectorExporterNodeBase.ts b/packages/opentelemetry-exporter-otlp-grpc/src/OTLPExporterNodeBase.ts similarity index 85% rename from packages/opentelemetry-exporter-collector-grpc/src/CollectorExporterNodeBase.ts rename to packages/opentelemetry-exporter-otlp-grpc/src/OTLPExporterNodeBase.ts index da9a1b9d76..895ee3fa28 100644 --- a/packages/opentelemetry-exporter-collector-grpc/src/CollectorExporterNodeBase.ts +++ b/packages/opentelemetry-exporter-otlp-grpc/src/OTLPExporterNodeBase.ts @@ -16,12 +16,12 @@ import { diag } from '@opentelemetry/api'; import { - CollectorExporterBase, - collectorTypes, -} from '@opentelemetry/exporter-collector'; + OTLPExporterBase, + otlpTypes, +} from '@opentelemetry/exporter-otlp-http'; import { Metadata } from '@grpc/grpc-js'; import { - CollectorExporterConfigNode, + OTLPExporterConfigNode, GRPCQueueItem, ServiceClientType, } from './types'; @@ -29,13 +29,13 @@ import { ServiceClient } from './types'; import { getEnv, baggageUtils } from '@opentelemetry/core'; /** - * Collector Metric Exporter abstract base class + * OTLP Metric Exporter abstract base class */ -export abstract class CollectorExporterNodeBase< +export abstract class OTLPExporterNodeBase< ExportItem, ServiceRequest -> extends CollectorExporterBase< - CollectorExporterConfigNode, +> extends OTLPExporterBase< + OTLPExporterConfigNode, ExportItem, ServiceRequest > { @@ -44,7 +44,7 @@ export abstract class CollectorExporterNodeBase< serviceClient?: ServiceClient = undefined; private _send!: Function; - constructor(config: CollectorExporterConfigNode = {}) { + constructor(config: OTLPExporterConfigNode = {}) { super(config); if (config.headers) { diag.warn('Headers cannot be set when using grpc'); @@ -59,7 +59,7 @@ export abstract class CollectorExporterNodeBase< private _sendPromise( objects: ExportItem[], onSuccess: () => void, - onError: (error: collectorTypes.CollectorExporterError) => void + onError: (error: otlpTypes.OTLPExporterError) => void ): void { const promise = new Promise((resolve, reject) => { this._send(this, objects, resolve, reject); @@ -74,7 +74,7 @@ export abstract class CollectorExporterNodeBase< promise.then(popPromise, popPromise); } - onInit(config: CollectorExporterConfigNode): void { + onInit(config: OTLPExporterConfigNode): void { this._isShutdown = false; // defer to next tick and lazy load to avoid loading grpc too early // and making this impossible to be instrumented @@ -88,7 +88,7 @@ export abstract class CollectorExporterNodeBase< send( objects: ExportItem[], onSuccess: () => void, - onError: (error: collectorTypes.CollectorExporterError) => void + onError: (error: otlpTypes.OTLPExporterError) => void ): void { if (this._isShutdown) { diag.debug('Shutdown already started. Cannot send objects'); diff --git a/packages/opentelemetry-exporter-collector-grpc/src/CollectorMetricExporter.ts b/packages/opentelemetry-exporter-otlp-grpc/src/OTLPMetricExporter.ts similarity index 73% rename from packages/opentelemetry-exporter-collector-grpc/src/CollectorMetricExporter.ts rename to packages/opentelemetry-exporter-otlp-grpc/src/OTLPMetricExporter.ts index 53e9dd39a1..a914c299cd 100644 --- a/packages/opentelemetry-exporter-collector-grpc/src/CollectorMetricExporter.ts +++ b/packages/opentelemetry-exporter-otlp-grpc/src/OTLPMetricExporter.ts @@ -15,12 +15,12 @@ */ import { - collectorTypes, - toCollectorExportMetricServiceRequest, -} from '@opentelemetry/exporter-collector'; + otlpTypes, + toOTLPExportMetricServiceRequest, +} from '@opentelemetry/exporter-otlp-http'; import { MetricRecord, MetricExporter } from '@opentelemetry/sdk-metrics-base'; -import { CollectorExporterConfigNode, ServiceClientType } from './types'; -import { CollectorExporterNodeBase } from './CollectorExporterNodeBase'; +import { OTLPExporterConfigNode, ServiceClientType } from './types'; +import { OTLPExporterNodeBase } from './OTLPExporterNodeBase'; import { baggageUtils, getEnv } from '@opentelemetry/core'; import { validateAndNormalizeUrl } from './util'; import { Metadata } from '@grpc/grpc-js'; @@ -28,18 +28,18 @@ import { Metadata } from '@grpc/grpc-js'; const DEFAULT_COLLECTOR_URL = 'localhost:4317'; /** - * Collector Metric Exporter for Node + * OTLP Metric Exporter for Node */ -export class CollectorMetricExporter - extends CollectorExporterNodeBase< +export class OTLPMetricExporter + extends OTLPExporterNodeBase< MetricRecord, - collectorTypes.opentelemetryProto.collector.metrics.v1.ExportMetricsServiceRequest + otlpTypes.opentelemetryProto.collector.metrics.v1.ExportMetricsServiceRequest > implements MetricExporter { // Converts time to nanoseconds protected readonly _startTime = new Date().getTime() * 1000000; - constructor(config: CollectorExporterConfigNode = {}) { + constructor(config: OTLPExporterConfigNode = {}) { super(config); const headers = baggageUtils.parseKeyPairsIntoRecord(getEnv().OTEL_EXPORTER_OTLP_METRICS_HEADERS); this.metadata ||= new Metadata(); @@ -50,15 +50,15 @@ export class CollectorMetricExporter convert( metrics: MetricRecord[] - ): collectorTypes.opentelemetryProto.collector.metrics.v1.ExportMetricsServiceRequest { - return toCollectorExportMetricServiceRequest( + ): otlpTypes.opentelemetryProto.collector.metrics.v1.ExportMetricsServiceRequest { + return toOTLPExportMetricServiceRequest( metrics, this._startTime, this ); } - getDefaultUrl(config: CollectorExporterConfigNode) { + getDefaultUrl(config: OTLPExporterConfigNode) { return typeof config.url === 'string' ? validateAndNormalizeUrl(config.url) : getEnv().OTEL_EXPORTER_OTLP_METRICS_ENDPOINT.length > 0 diff --git a/packages/opentelemetry-exporter-collector-grpc/src/CollectorTraceExporter.ts b/packages/opentelemetry-exporter-otlp-grpc/src/OTLPTraceExporter.ts similarity index 72% rename from packages/opentelemetry-exporter-collector-grpc/src/CollectorTraceExporter.ts rename to packages/opentelemetry-exporter-otlp-grpc/src/OTLPTraceExporter.ts index c996417c9d..828a7067d7 100644 --- a/packages/opentelemetry-exporter-collector-grpc/src/CollectorTraceExporter.ts +++ b/packages/opentelemetry-exporter-otlp-grpc/src/OTLPTraceExporter.ts @@ -15,12 +15,12 @@ */ import { ReadableSpan, SpanExporter } from '@opentelemetry/sdk-trace-base'; -import { CollectorExporterNodeBase } from './CollectorExporterNodeBase'; +import { OTLPExporterNodeBase } from './OTLPExporterNodeBase'; import { - collectorTypes, - toCollectorExportTraceServiceRequest, -} from '@opentelemetry/exporter-collector'; -import { CollectorExporterConfigNode, ServiceClientType } from './types'; + otlpTypes, + toOTLPExportTraceServiceRequest, +} from '@opentelemetry/exporter-otlp-http'; +import { OTLPExporterConfigNode, ServiceClientType } from './types'; import { baggageUtils, getEnv } from '@opentelemetry/core'; import { validateAndNormalizeUrl } from './util'; import { Metadata } from '@grpc/grpc-js'; @@ -28,16 +28,16 @@ import { Metadata } from '@grpc/grpc-js'; const DEFAULT_COLLECTOR_URL = 'localhost:4317'; /** - * Collector Trace Exporter for Node + * OTLP Trace Exporter for Node */ -export class CollectorTraceExporter - extends CollectorExporterNodeBase< +export class OTLPTraceExporter + extends OTLPExporterNodeBase< ReadableSpan, - collectorTypes.opentelemetryProto.collector.trace.v1.ExportTraceServiceRequest + otlpTypes.opentelemetryProto.collector.trace.v1.ExportTraceServiceRequest > implements SpanExporter { - constructor(config: CollectorExporterConfigNode = {}) { + constructor(config: OTLPExporterConfigNode = {}) { super(config); const headers = baggageUtils.parseKeyPairsIntoRecord(getEnv().OTEL_EXPORTER_OTLP_TRACES_HEADERS); this.metadata ||= new Metadata(); @@ -48,11 +48,11 @@ export class CollectorTraceExporter convert( spans: ReadableSpan[] - ): collectorTypes.opentelemetryProto.collector.trace.v1.ExportTraceServiceRequest { - return toCollectorExportTraceServiceRequest(spans, this); + ): otlpTypes.opentelemetryProto.collector.trace.v1.ExportTraceServiceRequest { + return toOTLPExportTraceServiceRequest(spans, this); } - getDefaultUrl(config: CollectorExporterConfigNode) { + getDefaultUrl(config: OTLPExporterConfigNode) { return typeof config.url === 'string' ? validateAndNormalizeUrl(config.url) : getEnv().OTEL_EXPORTER_OTLP_TRACES_ENDPOINT.length > 0 diff --git a/packages/opentelemetry-exporter-collector-grpc/src/index.ts b/packages/opentelemetry-exporter-otlp-grpc/src/index.ts similarity index 87% rename from packages/opentelemetry-exporter-collector-grpc/src/index.ts rename to packages/opentelemetry-exporter-otlp-grpc/src/index.ts index fcbe012b52..d54490a7ea 100644 --- a/packages/opentelemetry-exporter-collector-grpc/src/index.ts +++ b/packages/opentelemetry-exporter-otlp-grpc/src/index.ts @@ -14,5 +14,5 @@ * limitations under the License. */ -export * from './CollectorTraceExporter'; -export * from './CollectorMetricExporter'; +export * from './OTLPTraceExporter'; +export * from './OTLPMetricExporter'; diff --git a/packages/opentelemetry-exporter-collector-grpc/src/types.ts b/packages/opentelemetry-exporter-otlp-grpc/src/types.ts similarity index 81% rename from packages/opentelemetry-exporter-collector-grpc/src/types.ts rename to packages/opentelemetry-exporter-otlp-grpc/src/types.ts index 184901727b..da10ea415d 100644 --- a/packages/opentelemetry-exporter-collector-grpc/src/types.ts +++ b/packages/opentelemetry-exporter-otlp-grpc/src/types.ts @@ -14,7 +14,7 @@ * limitations under the License. */ -import { collectorTypes } from '@opentelemetry/exporter-collector'; +import { otlpTypes } from '@opentelemetry/exporter-otlp-http'; import * as grpc from '@grpc/grpc-js'; /** @@ -24,7 +24,7 @@ import * as grpc from '@grpc/grpc-js'; export interface GRPCQueueItem { objects: ExportedItem[]; onSuccess: () => void; - onError: (error: collectorTypes.CollectorExporterError) => void; + onError: (error: otlpTypes.OTLPExporterError) => void; } /** @@ -39,10 +39,10 @@ export interface ServiceClient extends grpc.Client { } /** - * Collector Exporter Config for Node + * OTLP Exporter Config for Node */ -export interface CollectorExporterConfigNode - extends collectorTypes.CollectorExporterConfigBase { +export interface OTLPExporterConfigNode + extends otlpTypes.OTLPExporterConfigBase { credentials?: grpc.ChannelCredentials; metadata?: grpc.Metadata; } diff --git a/packages/opentelemetry-exporter-collector-grpc/src/util.ts b/packages/opentelemetry-exporter-otlp-grpc/src/util.ts similarity index 88% rename from packages/opentelemetry-exporter-collector-grpc/src/util.ts rename to packages/opentelemetry-exporter-otlp-grpc/src/util.ts index 299a6e7e81..1e2e480383 100644 --- a/packages/opentelemetry-exporter-collector-grpc/src/util.ts +++ b/packages/opentelemetry-exporter-otlp-grpc/src/util.ts @@ -18,19 +18,19 @@ import * as grpc from '@grpc/grpc-js'; import * as protoLoader from '@grpc/proto-loader'; import { diag } from '@opentelemetry/api'; import { globalErrorHandler } from '@opentelemetry/core'; -import { collectorTypes } from '@opentelemetry/exporter-collector'; +import { otlpTypes } from '@opentelemetry/exporter-otlp-http'; import * as path from 'path'; -import { CollectorExporterNodeBase } from './CollectorExporterNodeBase'; +import { OTLPExporterNodeBase } from './OTLPExporterNodeBase'; import { URL } from 'url'; import { - CollectorExporterConfigNode, + OTLPExporterConfigNode, GRPCQueueItem, ServiceClientType, } from './types'; export function onInit( - collector: CollectorExporterNodeBase, - config: CollectorExporterConfigNode + collector: OTLPExporterNodeBase, + config: OTLPExporterConfigNode ): void { collector.grpcQueue = []; const credentials: grpc.ChannelCredentials = @@ -77,10 +77,10 @@ export function onInit( } export function send( - collector: CollectorExporterNodeBase, + collector: OTLPExporterNodeBase, objects: ExportItem[], onSuccess: () => void, - onError: (error: collectorTypes.CollectorExporterError) => void + onError: (error: otlpTypes.OTLPExporterError) => void ): void { if (collector.serviceClient) { const serviceRequest = collector.convert(objects); @@ -88,7 +88,7 @@ export function send( collector.serviceClient.export( serviceRequest, collector.metadata || new grpc.Metadata(), - (err: collectorTypes.ExportServiceError) => { + (err: otlpTypes.ExportServiceError) => { if (err) { diag.error('Service request', serviceRequest); onError(err); diff --git a/packages/opentelemetry-exporter-collector-grpc/submodule.md b/packages/opentelemetry-exporter-otlp-grpc/submodule.md similarity index 100% rename from packages/opentelemetry-exporter-collector-grpc/submodule.md rename to packages/opentelemetry-exporter-otlp-grpc/submodule.md diff --git a/packages/opentelemetry-exporter-collector-grpc/test/CollectorExporterNodeBase.test.ts b/packages/opentelemetry-exporter-otlp-grpc/test/OTLPExporterNodeBase.test.ts similarity index 88% rename from packages/opentelemetry-exporter-collector-grpc/test/CollectorExporterNodeBase.test.ts rename to packages/opentelemetry-exporter-otlp-grpc/test/OTLPExporterNodeBase.test.ts index 84042f6ed5..f52f212f37 100644 --- a/packages/opentelemetry-exporter-collector-grpc/test/CollectorExporterNodeBase.test.ts +++ b/packages/opentelemetry-exporter-otlp-grpc/test/OTLPExporterNodeBase.test.ts @@ -14,15 +14,15 @@ * limitations under the License. */ -import { collectorTypes } from '@opentelemetry/exporter-collector'; +import { otlpTypes } from '@opentelemetry/exporter-otlp-http'; import { ReadableSpan } from '@opentelemetry/sdk-trace-base'; import * as assert from 'assert'; -import { CollectorExporterNodeBase } from '../src/CollectorExporterNodeBase'; -import { CollectorExporterConfigNode, ServiceClientType } from '../src/types'; +import { OTLPExporterNodeBase } from '../src/OTLPExporterNodeBase'; +import { OTLPExporterConfigNode, ServiceClientType } from '../src/types'; import { mockedReadableSpan } from './helper'; -class MockCollectorExporter extends CollectorExporterNodeBase< +class MockCollectorExporter extends OTLPExporterNodeBase< ReadableSpan, ReadableSpan[] > { @@ -31,14 +31,14 @@ class MockCollectorExporter extends CollectorExporterNodeBase< */ sendCallbacks: { onSuccess: () => void; - onError: (error: collectorTypes.CollectorExporterError) => void; + onError: (error: otlpTypes.OTLPExporterError) => void; }[] = []; - getDefaultUrl(config: CollectorExporterConfigNode): string { + getDefaultUrl(config: OTLPExporterConfigNode): string { return ''; } - getDefaultServiceName(config: CollectorExporterConfigNode): string { + getDefaultServiceName(config: OTLPExporterConfigNode): string { return ''; } @@ -60,12 +60,12 @@ MockCollectorExporter.prototype['_send'] = function _sendMock( self: MockCollectorExporter, objects: ReadableSpan[], onSuccess: () => void, - onError: (error: collectorTypes.CollectorExporterError) => void + onError: (error: otlpTypes.OTLPExporterError) => void ): void { self.sendCallbacks.push({ onSuccess, onError }); }; -describe('CollectorExporterNodeBase', () => { +describe('OTLPExporterNodeBase', () => { let exporter: MockCollectorExporter; const concurrencyLimit = 5; diff --git a/packages/opentelemetry-exporter-collector-grpc/test/CollectorMetricExporter.test.ts b/packages/opentelemetry-exporter-otlp-grpc/test/OTLPMetricExporter.test.ts similarity index 88% rename from packages/opentelemetry-exporter-collector-grpc/test/CollectorMetricExporter.test.ts rename to packages/opentelemetry-exporter-otlp-grpc/test/OTLPMetricExporter.test.ts index 139cb359b0..86b8e1cef3 100644 --- a/packages/opentelemetry-exporter-collector-grpc/test/CollectorMetricExporter.test.ts +++ b/packages/opentelemetry-exporter-otlp-grpc/test/OTLPMetricExporter.test.ts @@ -21,14 +21,14 @@ import { ValueRecorder, } from '@opentelemetry/api-metrics'; import { diag } from '@opentelemetry/api'; -import { collectorTypes } from '@opentelemetry/exporter-collector'; +import { otlpTypes } from '@opentelemetry/exporter-otlp-http'; import * as metrics from '@opentelemetry/sdk-metrics-base'; import * as assert from 'assert'; import * as fs from 'fs'; import * as grpc from '@grpc/grpc-js'; import * as path from 'path'; import * as sinon from 'sinon'; -import { CollectorMetricExporter } from '../src'; +import { OTLPMetricExporter } from '../src'; import { ensureExportedCounterIsCorrect, ensureExportedObserverIsCorrect, @@ -54,14 +54,14 @@ type TestParams = { const metadata = new grpc.Metadata(); metadata.set('k', 'v'); -const testCollectorMetricExporter = (params: TestParams) => - describe(`CollectorMetricExporter - node ${ +const testOTLPMetricExporter = (params: TestParams) => + describe(`OTLPMetricExporter - node ${ params.useTLS ? 'with' : 'without' } TLS, ${params.metadata ? 'with' : 'without'} metadata`, () => { - let collectorExporter: CollectorMetricExporter; + let collectorExporter: OTLPMetricExporter; let server: grpc.Server; let exportedData: - | collectorTypes.opentelemetryProto.metrics.v1.ResourceMetrics[] + | otlpTypes.opentelemetryProto.metrics.v1.ResourceMetrics[] | undefined; let metrics: metrics.MetricRecord[]; let reqMetadata: grpc.Metadata | undefined; @@ -86,7 +86,7 @@ const testCollectorMetricExporter = (params: TestParams) => .MetricsService.service, { Export: (data: { - request: collectorTypes.opentelemetryProto.collector.metrics.v1.ExportMetricsServiceRequest; + request: otlpTypes.opentelemetryProto.collector.metrics.v1.ExportMetricsServiceRequest; metadata: grpc.Metadata; }) => { try { @@ -128,7 +128,7 @@ const testCollectorMetricExporter = (params: TestParams) => fs.readFileSync('./test/certs/client.crt') ) : undefined; - collectorExporter = new CollectorMetricExporter({ + collectorExporter = new OTLPMetricExporter({ url: 'grpcs://' + address, credentials, metadata: params.metadata, @@ -167,7 +167,7 @@ const testCollectorMetricExporter = (params: TestParams) => it('should warn about headers', () => { // Need to stub/spy on the underlying logger as the 'diag' instance is global const spyLoggerWarn = sinon.stub(diag, 'warn'); - collectorExporter = new CollectorMetricExporter({ + collectorExporter = new OTLPMetricExporter({ url: `http://${address}`, headers: { foo: 'bar', @@ -178,7 +178,7 @@ const testCollectorMetricExporter = (params: TestParams) => }); it('should warn about path in url', () => { const spyLoggerWarn = sinon.stub(diag, 'warn'); - collectorExporter = new CollectorMetricExporter({ + collectorExporter = new OTLPMetricExporter({ url: `http://${address}/v1/metrics` }); const args = spyLoggerWarn.args[0]; @@ -238,9 +238,9 @@ const testCollectorMetricExporter = (params: TestParams) => }); }); -describe('CollectorMetricExporter - node (getDefaultUrl)', () => { +describe('OTLPMetricExporter - node (getDefaultUrl)', () => { it('should default to localhost', done => { - const collectorExporter = new CollectorMetricExporter({}); + const collectorExporter = new OTLPMetricExporter({}); setTimeout(() => { assert.strictEqual(collectorExporter['url'], 'localhost:4317'); done(); @@ -248,7 +248,7 @@ describe('CollectorMetricExporter - node (getDefaultUrl)', () => { }); it('should keep the URL if included', done => { const url = 'http://foo.bar.com'; - const collectorExporter = new CollectorMetricExporter({ url }); + const collectorExporter = new OTLPMetricExporter({ url }); setTimeout(() => { assert.strictEqual(collectorExporter['url'], 'foo.bar.com'); done(); @@ -260,7 +260,7 @@ describe('when configuring via environment', () => { const envSource = process.env; it('should use url defined in env', () => { envSource.OTEL_EXPORTER_OTLP_ENDPOINT = 'http://foo.bar'; - const collectorExporter = new CollectorMetricExporter(); + const collectorExporter = new OTLPMetricExporter(); assert.strictEqual( collectorExporter.url, 'foo.bar' @@ -270,7 +270,7 @@ describe('when configuring via environment', () => { it('should override global exporter url with signal url defined in env', () => { envSource.OTEL_EXPORTER_OTLP_ENDPOINT = 'http://foo.bar'; envSource.OTEL_EXPORTER_OTLP_METRICS_ENDPOINT = 'http://foo.metrics'; - const collectorExporter = new CollectorMetricExporter(); + const collectorExporter = new OTLPMetricExporter(); assert.strictEqual( collectorExporter.url, 'foo.metrics' @@ -280,7 +280,7 @@ describe('when configuring via environment', () => { }); it('should use headers defined via env', () => { envSource.OTEL_EXPORTER_OTLP_HEADERS = 'foo=bar'; - const collectorExporter = new CollectorMetricExporter(); + const collectorExporter = new OTLPMetricExporter(); assert.deepStrictEqual(collectorExporter.metadata?.get('foo'), ['bar']); envSource.OTEL_EXPORTER_OTLP_HEADERS = ''; }); @@ -290,7 +290,7 @@ describe('when configuring via environment', () => { metadata.set('goo', 'lol'); envSource.OTEL_EXPORTER_OTLP_HEADERS = 'foo=jar,bar=foo'; envSource.OTEL_EXPORTER_OTLP_METRICS_HEADERS = 'foo=boo'; - const collectorExporter = new CollectorMetricExporter({ metadata }); + const collectorExporter = new OTLPMetricExporter({ metadata }); assert.deepStrictEqual(collectorExporter.metadata?.get('foo'), ['boo']); assert.deepStrictEqual(collectorExporter.metadata?.get('bar'), ['foo']); assert.deepStrictEqual(collectorExporter.metadata?.get('goo'), ['lol']); @@ -299,6 +299,6 @@ describe('when configuring via environment', () => { }); }); -testCollectorMetricExporter({ useTLS: true }); -testCollectorMetricExporter({ useTLS: false }); -testCollectorMetricExporter({ metadata }); +testOTLPMetricExporter({ useTLS: true }); +testOTLPMetricExporter({ useTLS: false }); +testOTLPMetricExporter({ metadata }); diff --git a/packages/opentelemetry-exporter-collector-grpc/test/CollectorTraceExporter.test.ts b/packages/opentelemetry-exporter-otlp-grpc/test/OTLPTraceExporter.test.ts similarity index 88% rename from packages/opentelemetry-exporter-collector-grpc/test/CollectorTraceExporter.test.ts rename to packages/opentelemetry-exporter-otlp-grpc/test/OTLPTraceExporter.test.ts index d2d16a47ad..2014308967 100644 --- a/packages/opentelemetry-exporter-collector-grpc/test/CollectorTraceExporter.test.ts +++ b/packages/opentelemetry-exporter-otlp-grpc/test/OTLPTraceExporter.test.ts @@ -15,7 +15,7 @@ */ import * as protoLoader from '@grpc/proto-loader'; -import { collectorTypes } from '@opentelemetry/exporter-collector'; +import { otlpTypes } from '@opentelemetry/exporter-otlp-http'; import { diag } from '@opentelemetry/api'; import { BasicTracerProvider, @@ -27,7 +27,7 @@ import * as fs from 'fs'; import * as grpc from '@grpc/grpc-js'; import * as path from 'path'; import * as sinon from 'sinon'; -import { CollectorTraceExporter } from '../src'; +import { OTLPTraceExporter } from '../src'; import { ensureExportedSpanIsCorrect, @@ -51,13 +51,13 @@ const metadata = new grpc.Metadata(); metadata.set('k', 'v'); const testCollectorExporter = (params: TestParams) => - describe(`CollectorTraceExporter - node ${ + describe(`OTLPTraceExporter - node ${ params.useTLS ? 'with' : 'without' } TLS, ${params.metadata ? 'with' : 'without'} metadata`, () => { - let collectorExporter: CollectorTraceExporter; + let collectorExporter: OTLPTraceExporter; let server: grpc.Server; let exportedData: - | collectorTypes.opentelemetryProto.trace.v1.ResourceSpans + | otlpTypes.opentelemetryProto.trace.v1.ResourceSpans | undefined; let reqMetadata: grpc.Metadata | undefined; @@ -81,7 +81,7 @@ const testCollectorExporter = (params: TestParams) => .service, { Export: (data: { - request: collectorTypes.opentelemetryProto.collector.trace.v1.ExportTraceServiceRequest; + request: otlpTypes.opentelemetryProto.collector.trace.v1.ExportTraceServiceRequest; metadata: grpc.Metadata; }) => { try { @@ -123,7 +123,7 @@ const testCollectorExporter = (params: TestParams) => fs.readFileSync('./test/certs/client.crt') ) : undefined; - collectorExporter = new CollectorTraceExporter({ + collectorExporter = new OTLPTraceExporter({ url: 'grpcs://' + address, credentials, metadata: params.metadata, @@ -144,7 +144,7 @@ const testCollectorExporter = (params: TestParams) => it('should warn about headers when using grpc', () => { // Need to stub/spy on the underlying logger as the 'diag' instance is global const spyLoggerWarn = sinon.stub(diag, 'warn'); - collectorExporter = new CollectorTraceExporter({ + collectorExporter = new OTLPTraceExporter({ url: `http://${address}`, headers: { foo: 'bar', @@ -155,7 +155,7 @@ const testCollectorExporter = (params: TestParams) => }); it('should warn about path in url', () => { const spyLoggerWarn = sinon.stub(diag, 'warn'); - collectorExporter = new CollectorTraceExporter({ + collectorExporter = new OTLPTraceExporter({ url: `http://${address}/v1/trace`, }); const args = spyLoggerWarn.args[0]; @@ -200,9 +200,9 @@ const testCollectorExporter = (params: TestParams) => }); }); -describe('CollectorTraceExporter - node (getDefaultUrl)', () => { +describe('OTLPTraceExporter - node (getDefaultUrl)', () => { it('should default to localhost', done => { - const collectorExporter = new CollectorTraceExporter({}); + const collectorExporter = new OTLPTraceExporter({}); setTimeout(() => { assert.strictEqual(collectorExporter['url'], 'localhost:4317'); done(); @@ -210,7 +210,7 @@ describe('CollectorTraceExporter - node (getDefaultUrl)', () => { }); it('should keep the URL if included', done => { const url = 'http://foo.bar.com'; - const collectorExporter = new CollectorTraceExporter({ url }); + const collectorExporter = new OTLPTraceExporter({ url }); setTimeout(() => { assert.strictEqual(collectorExporter['url'], 'foo.bar.com'); done(); @@ -222,7 +222,7 @@ describe('when configuring via environment', () => { const envSource = process.env; it('should use url defined in env', () => { envSource.OTEL_EXPORTER_OTLP_ENDPOINT = 'http://foo.bar'; - const collectorExporter = new CollectorTraceExporter(); + const collectorExporter = new OTLPTraceExporter(); assert.strictEqual( collectorExporter.url, 'foo.bar' @@ -232,7 +232,7 @@ describe('when configuring via environment', () => { it('should override global exporter url with signal url defined in env', () => { envSource.OTEL_EXPORTER_OTLP_ENDPOINT = 'http://foo.bar'; envSource.OTEL_EXPORTER_OTLP_TRACES_ENDPOINT = 'http://foo.traces'; - const collectorExporter = new CollectorTraceExporter(); + const collectorExporter = new OTLPTraceExporter(); assert.strictEqual( collectorExporter.url, 'foo.traces' @@ -242,7 +242,7 @@ describe('when configuring via environment', () => { }); it('should use headers defined via env', () => { envSource.OTEL_EXPORTER_OTLP_HEADERS = 'foo=bar'; - const collectorExporter = new CollectorTraceExporter(); + const collectorExporter = new OTLPTraceExporter(); assert.deepStrictEqual(collectorExporter.metadata?.get('foo'), ['bar']); envSource.OTEL_EXPORTER_OTLP_HEADERS = ''; }); @@ -252,7 +252,7 @@ describe('when configuring via environment', () => { metadata.set('goo', 'lol'); envSource.OTEL_EXPORTER_OTLP_HEADERS = 'foo=jar,bar=foo'; envSource.OTEL_EXPORTER_OTLP_TRACES_HEADERS = 'foo=boo'; - const collectorExporter = new CollectorTraceExporter({ metadata }); + const collectorExporter = new OTLPTraceExporter({ metadata }); assert.deepStrictEqual(collectorExporter.metadata?.get('foo'), ['boo']); assert.deepStrictEqual(collectorExporter.metadata?.get('bar'), ['foo']); assert.deepStrictEqual(collectorExporter.metadata?.get('goo'), ['lol']); diff --git a/packages/opentelemetry-exporter-collector-grpc/test/certs/ca.crt b/packages/opentelemetry-exporter-otlp-grpc/test/certs/ca.crt similarity index 100% rename from packages/opentelemetry-exporter-collector-grpc/test/certs/ca.crt rename to packages/opentelemetry-exporter-otlp-grpc/test/certs/ca.crt diff --git a/packages/opentelemetry-exporter-collector-grpc/test/certs/ca.key b/packages/opentelemetry-exporter-otlp-grpc/test/certs/ca.key similarity index 100% rename from packages/opentelemetry-exporter-collector-grpc/test/certs/ca.key rename to packages/opentelemetry-exporter-otlp-grpc/test/certs/ca.key diff --git a/packages/opentelemetry-exporter-collector-grpc/test/certs/client.crt b/packages/opentelemetry-exporter-otlp-grpc/test/certs/client.crt similarity index 100% rename from packages/opentelemetry-exporter-collector-grpc/test/certs/client.crt rename to packages/opentelemetry-exporter-otlp-grpc/test/certs/client.crt diff --git a/packages/opentelemetry-exporter-collector-grpc/test/certs/client.csr b/packages/opentelemetry-exporter-otlp-grpc/test/certs/client.csr similarity index 100% rename from packages/opentelemetry-exporter-collector-grpc/test/certs/client.csr rename to packages/opentelemetry-exporter-otlp-grpc/test/certs/client.csr diff --git a/packages/opentelemetry-exporter-collector-grpc/test/certs/client.key b/packages/opentelemetry-exporter-otlp-grpc/test/certs/client.key similarity index 100% rename from packages/opentelemetry-exporter-collector-grpc/test/certs/client.key rename to packages/opentelemetry-exporter-otlp-grpc/test/certs/client.key diff --git a/packages/opentelemetry-exporter-collector-grpc/test/certs/regenerate.sh b/packages/opentelemetry-exporter-otlp-grpc/test/certs/regenerate.sh similarity index 100% rename from packages/opentelemetry-exporter-collector-grpc/test/certs/regenerate.sh rename to packages/opentelemetry-exporter-otlp-grpc/test/certs/regenerate.sh diff --git a/packages/opentelemetry-exporter-collector-grpc/test/certs/server.crt b/packages/opentelemetry-exporter-otlp-grpc/test/certs/server.crt similarity index 100% rename from packages/opentelemetry-exporter-collector-grpc/test/certs/server.crt rename to packages/opentelemetry-exporter-otlp-grpc/test/certs/server.crt diff --git a/packages/opentelemetry-exporter-collector-grpc/test/certs/server.csr b/packages/opentelemetry-exporter-otlp-grpc/test/certs/server.csr similarity index 100% rename from packages/opentelemetry-exporter-collector-grpc/test/certs/server.csr rename to packages/opentelemetry-exporter-otlp-grpc/test/certs/server.csr diff --git a/packages/opentelemetry-exporter-collector-grpc/test/certs/server.key b/packages/opentelemetry-exporter-otlp-grpc/test/certs/server.key similarity index 100% rename from packages/opentelemetry-exporter-collector-grpc/test/certs/server.key rename to packages/opentelemetry-exporter-otlp-grpc/test/certs/server.key diff --git a/packages/opentelemetry-exporter-collector-grpc/test/helper.ts b/packages/opentelemetry-exporter-otlp-grpc/test/helper.ts similarity index 94% rename from packages/opentelemetry-exporter-collector-grpc/test/helper.ts rename to packages/opentelemetry-exporter-otlp-grpc/test/helper.ts index 871056ac31..e77f0f1742 100644 --- a/packages/opentelemetry-exporter-collector-grpc/test/helper.ts +++ b/packages/opentelemetry-exporter-otlp-grpc/test/helper.ts @@ -22,7 +22,7 @@ import { ValueRecorder, ValueType, } from '@opentelemetry/api-metrics'; -import { collectorTypes } from '@opentelemetry/exporter-collector'; +import { otlpTypes } from '@opentelemetry/exporter-otlp-http'; import * as metrics from '@opentelemetry/sdk-metrics-base'; import { Resource } from '@opentelemetry/resources'; import { ReadableSpan } from '@opentelemetry/sdk-trace-base'; @@ -167,7 +167,7 @@ export const mockedReadableSpan: ReadableSpan = { }; export function ensureExportedEventsAreCorrect( - events: collectorTypes.opentelemetryProto.trace.v1.Span.Event[] + events: otlpTypes.opentelemetryProto.trace.v1.Span.Event[] ) { assert.deepStrictEqual( events, @@ -226,7 +226,7 @@ export function ensureExportedEventsAreCorrect( } export function ensureExportedAttributesAreCorrect( - attributes: collectorTypes.opentelemetryProto.common.v1.KeyValue[] + attributes: otlpTypes.opentelemetryProto.common.v1.KeyValue[] ) { assert.deepStrictEqual( attributes, @@ -244,7 +244,7 @@ export function ensureExportedAttributesAreCorrect( } export function ensureExportedLinksAreCorrect( - attributes: collectorTypes.opentelemetryProto.trace.v1.Span.Link[] + attributes: otlpTypes.opentelemetryProto.trace.v1.Span.Link[] ) { assert.deepStrictEqual( attributes, @@ -270,7 +270,7 @@ export function ensureExportedLinksAreCorrect( } export function ensureExportedSpanIsCorrect( - span: collectorTypes.opentelemetryProto.trace.v1.Span + span: otlpTypes.opentelemetryProto.trace.v1.Span ) { if (span.attributes) { ensureExportedAttributesAreCorrect(span.attributes); @@ -328,7 +328,7 @@ export function ensureExportedSpanIsCorrect( } export function ensureExportedCounterIsCorrect( - metric: collectorTypes.opentelemetryProto.metrics.v1.Metric, + metric: otlpTypes.opentelemetryProto.metrics.v1.Metric, time?: number ) { assert.deepStrictEqual(metric, { @@ -353,7 +353,7 @@ export function ensureExportedCounterIsCorrect( } export function ensureExportedObserverIsCorrect( - metric: collectorTypes.opentelemetryProto.metrics.v1.Metric, + metric: otlpTypes.opentelemetryProto.metrics.v1.Metric, time?: number ) { assert.deepStrictEqual(metric, { @@ -376,7 +376,7 @@ export function ensureExportedObserverIsCorrect( } export function ensureExportedValueRecorderIsCorrect( - metric: collectorTypes.opentelemetryProto.metrics.v1.Metric, + metric: otlpTypes.opentelemetryProto.metrics.v1.Metric, time?: number, explicitBounds: number[] = [Infinity], bucketCounts: string[] = ['2', '0'] @@ -405,7 +405,7 @@ export function ensureExportedValueRecorderIsCorrect( } export function ensureResourceIsCorrect( - resource: collectorTypes.opentelemetryProto.resource.v1.Resource + resource: otlpTypes.opentelemetryProto.resource.v1.Resource ) { assert.deepStrictEqual(resource, { attributes: [ diff --git a/packages/opentelemetry-exporter-collector-grpc/test/util.test.ts b/packages/opentelemetry-exporter-otlp-grpc/test/util.test.ts similarity index 100% rename from packages/opentelemetry-exporter-collector-grpc/test/util.test.ts rename to packages/opentelemetry-exporter-otlp-grpc/test/util.test.ts diff --git a/packages/opentelemetry-exporter-collector-grpc/tsconfig.json b/packages/opentelemetry-exporter-otlp-grpc/tsconfig.json similarity index 87% rename from packages/opentelemetry-exporter-collector-grpc/tsconfig.json rename to packages/opentelemetry-exporter-otlp-grpc/tsconfig.json index 14cedee9b7..cfc7b73a48 100644 --- a/packages/opentelemetry-exporter-collector-grpc/tsconfig.json +++ b/packages/opentelemetry-exporter-otlp-grpc/tsconfig.json @@ -13,7 +13,7 @@ "path": "../opentelemetry-core" }, { - "path": "../opentelemetry-exporter-collector" + "path": "../opentelemetry-exporter-otlp-http" }, { "path": "../opentelemetry-resources" diff --git a/packages/opentelemetry-exporter-collector-proto/.eslintignore b/packages/opentelemetry-exporter-otlp-http/.eslintignore similarity index 100% rename from packages/opentelemetry-exporter-collector-proto/.eslintignore rename to packages/opentelemetry-exporter-otlp-http/.eslintignore diff --git a/packages/opentelemetry-exporter-collector/.eslintrc.js b/packages/opentelemetry-exporter-otlp-http/.eslintrc.js similarity index 100% rename from packages/opentelemetry-exporter-collector/.eslintrc.js rename to packages/opentelemetry-exporter-otlp-http/.eslintrc.js diff --git a/packages/opentelemetry-exporter-collector-proto/.npmignore b/packages/opentelemetry-exporter-otlp-http/.npmignore similarity index 100% rename from packages/opentelemetry-exporter-collector-proto/.npmignore rename to packages/opentelemetry-exporter-otlp-http/.npmignore diff --git a/packages/opentelemetry-exporter-collector-proto/LICENSE b/packages/opentelemetry-exporter-otlp-http/LICENSE similarity index 100% rename from packages/opentelemetry-exporter-collector-proto/LICENSE rename to packages/opentelemetry-exporter-otlp-http/LICENSE diff --git a/packages/opentelemetry-exporter-collector/README.md b/packages/opentelemetry-exporter-otlp-http/README.md similarity index 82% rename from packages/opentelemetry-exporter-collector/README.md rename to packages/opentelemetry-exporter-otlp-http/README.md index c58147413a..7aff40f464 100644 --- a/packages/opentelemetry-exporter-collector/README.md +++ b/packages/opentelemetry-exporter-otlp-http/README.md @@ -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 +npm install --save @opentelemetry/exporter-otlp-http ``` ## Service Name @@ -20,12 +20,12 @@ In order to set the service name, use the `service.name` resource attribute as p ## Traces in Web -The CollectorTraceExporter in Web expects the endpoint to end in `/v1/traces`. +The OTLPTraceExporter in Web expects the endpoint to end in `/v1/traces`. ```js import { BatchSpanProcessor } from '@opentelemetry/sdk-trace-base'; import { WebTracerProvider } from '@opentelemetry/sdk-trace-web'; -import { CollectorTraceExporter } from '@opentelemetry/exporter-collector'; +import { OTLPTraceExporter } from '@opentelemetry/exporter-otlp-http'; const collectorOptions = { url: '', // url is optional and can be omitted - default is http://localhost:55681/v1/traces @@ -34,7 +34,7 @@ const collectorOptions = { }; const provider = new WebTracerProvider(); -const exporter = new CollectorTraceExporter(collectorOptions); +const exporter = new OTLPTraceExporter(collectorOptions); provider.addSpanProcessor(new BatchSpanProcessor(exporter, { // The maximum queue size. After the size is reached spans are dropped. maxQueueSize: 100, @@ -52,17 +52,17 @@ provider.register(); ## Metrics in Web -The CollectorMetricExporter in Web expects the endpoint to end in `/v1/metrics`. +The OTLPMetricExporter in Web expects the endpoint to end in `/v1/metrics`. ```js import { MeterProvider } from '@opentelemetry/sdk-metrics-base'; -import { CollectorMetricExporter } from '@opentelemetry/exporter-collector'; +import { OTLPMetricExporter } from '@opentelemetry/exporter-otlp-http'; const collectorOptions = { url: '', // url is optional and can be omitted - default is http://localhost:55681/v1/metrics headers: {}, // an optional object containing custom headers to be sent with each request concurrencyLimit: 1, // an optional limit on pending requests }; -const exporter = new CollectorMetricExporter(collectorOptions); +const exporter = new OTLPMetricExporter(collectorOptions); // Register the exporter const meter = new MeterProvider({ @@ -80,7 +80,7 @@ counter.add(10, { 'key': 'value' }); ```js const { BasicTracerProvider, BatchSpanProcessor } = require('@opentelemetry/sdk-trace-base'); -const { CollectorTraceExporter } = require('@opentelemetry/exporter-collector'); +const { OTLPTraceExporter } = require('@opentelemetry/exporter-otlp-http'); const collectorOptions = { url: '', // url is optional and can be omitted - default is http://localhost:55681/v1/traces @@ -91,7 +91,7 @@ const collectorOptions = { }; const provider = new BasicTracerProvider(); -const exporter = new CollectorTraceExporter(collectorOptions); +const exporter = new OTLPTraceExporter(collectorOptions); provider.addSpanProcessor(new BatchSpanProcessor(exporter, { // The maximum queue size. After the size is reached spans are dropped. maxQueueSize: 1000, @@ -107,12 +107,12 @@ provider.register(); ```js const { MeterProvider } = require('@opentelemetry/sdk-metrics-base'); -const { CollectorMetricExporter } = require('@opentelemetry/exporter-collector'); +const { OTLPMetricExporter } = require('@opentelemetry/exporter-otlp-http'); const collectorOptions = { url: '', // url is optional and can be omitted - default is http://localhost:55681/v1/metrics concurrencyLimit: 1, // an optional limit on pending requests }; -const exporter = new CollectorMetricExporter(collectorOptions); +const exporter = new OTLPMetricExporter(collectorOptions); // Register the exporter const meter = new MeterProvider({ @@ -136,12 +136,12 @@ For PROTOBUF please check [npm-url-proto] ## Configuration options as environment variables -Instead of providing options to `CollectorMetricExporter` and `CollectorTraceExporter` explicitly, environment variables may be provided instead. +Instead of providing options to `OTLPMetricExporter` and `OTLPTraceExporter` explicitly, environment variables may be provided instead. ```sh OTEL_EXPORTER_OTLP_ENDPOINT=https://localhost:4317 # this will automatically append the version and signal path -# e.g. https://localhost:4317/v1/traces for `CollectorTraceExporter` and https://localhost:4317/v1/metrics for `CollectorMetricExporter` +# e.g. https://localhost:4317/v1/traces for `OTLPTraceExporter` and https://localhost:4317/v1/metrics for `OTLPMetricExporter` ``` If the trace and metric exporter endpoints have different providers, the env var for per-signal endpoints are available to use @@ -158,7 +158,7 @@ For more details, see [OpenTelemetry Specification on Protocol Exporter][opentel ## 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 @@ -175,13 +175,13 @@ 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 -[dependencies-url]: https://david-dm.org/open-telemetry/opentelemetry-js?path=packages%2Fopentelemetry-exporter-collector -[devDependencies-image]: https://status.david-dm.org/gh/open-telemetry/opentelemetry-js.svg?path=packages%2Fopentelemetry-exporter-collector&type=dev -[devDependencies-url]: https://david-dm.org/open-telemetry/opentelemetry-js?path=packages%2Fopentelemetry-exporter-collector&type=dev -[npm-url]: https://www.npmjs.com/package/@opentelemetry/exporter-collector -[npm-url-grpc]: https://www.npmjs.com/package/@opentelemetry/exporter-collector-grpc -[npm-url-proto]: https://www.npmjs.com/package/@opentelemetry/exporter-collector-proto +[dependencies-image]: https://status.david-dm.org/gh/open-telemetry/opentelemetry-js.svg?path=packages%2Fopentelemetry-exporter-otlp-http +[dependencies-url]: https://david-dm.org/open-telemetry/opentelemetry-js?path=packages%2Fopentelemetry-exporter-otlp-http +[devDependencies-image]: https://status.david-dm.org/gh/open-telemetry/opentelemetry-js.svg?path=packages%2Fopentelemetry-exporter-otlp-http&type=dev +[devDependencies-url]: https://david-dm.org/open-telemetry/opentelemetry-js?path=packages%2Fopentelemetry-exporter-otlp-http&type=dev +[npm-url]: https://www.npmjs.com/package/@opentelemetry/exporter-otlp-http +[npm-url-grpc]: https://www.npmjs.com/package/@opentelemetry/exporter-otlp-grpc +[npm-url-proto]: https://www.npmjs.com/package/@opentelemetry/exporter-otlp-proto [npm-img]: https://badge.fury.io/js/%40opentelemetry%2Fexporter-collector.svg [opentelemetry-collector-url]: https://github.com/open-telemetry/opentelemetry-collector [opentelemetry-spec-protocol-exporter]: https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/protocol/exporter.md#configuration-options diff --git a/packages/opentelemetry-exporter-collector/karma.conf.js b/packages/opentelemetry-exporter-otlp-http/karma.conf.js similarity index 100% rename from packages/opentelemetry-exporter-collector/karma.conf.js rename to packages/opentelemetry-exporter-otlp-http/karma.conf.js diff --git a/packages/opentelemetry-exporter-collector/package.json b/packages/opentelemetry-exporter-otlp-http/package.json similarity index 98% rename from packages/opentelemetry-exporter-collector/package.json rename to packages/opentelemetry-exporter-otlp-http/package.json index ada10fec40..3a03727c43 100644 --- a/packages/opentelemetry-exporter-collector/package.json +++ b/packages/opentelemetry-exporter-otlp-http/package.json @@ -1,5 +1,5 @@ { - "name": "@opentelemetry/exporter-collector", + "name": "@opentelemetry/exporter-otlp-http", "version": "0.25.0", "description": "OpenTelemetry Collector Exporter allows user to send collected traces to the OpenTelemetry Collector", "main": "build/src/index.js", diff --git a/packages/opentelemetry-exporter-collector/src/CollectorExporterBase.ts b/packages/opentelemetry-exporter-otlp-http/src/OTLPExporterBase.ts similarity index 94% rename from packages/opentelemetry-exporter-collector/src/CollectorExporterBase.ts rename to packages/opentelemetry-exporter-otlp-http/src/OTLPExporterBase.ts index db32231d29..1cbf94f633 100644 --- a/packages/opentelemetry-exporter-collector/src/CollectorExporterBase.ts +++ b/packages/opentelemetry-exporter-otlp-http/src/OTLPExporterBase.ts @@ -17,16 +17,16 @@ import { SpanAttributes, diag } from '@opentelemetry/api'; import { ExportResult, ExportResultCode } from '@opentelemetry/core'; import { - CollectorExporterError, - CollectorExporterConfigBase, + OTLPExporterError, + OTLPExporterConfigBase, ExportServiceError, } from './types'; /** * Collector Exporter abstract base class */ -export abstract class CollectorExporterBase< - T extends CollectorExporterConfigBase, +export abstract class OTLPExporterBase< + T extends OTLPExporterConfigBase, ExportItem, ServiceRequest > { @@ -135,7 +135,7 @@ export abstract class CollectorExporterBase< abstract send( items: ExportItem[], onSuccess: () => void, - onError: (error: CollectorExporterError) => void + onError: (error: OTLPExporterError) => void ): void; abstract getDefaultUrl(config: T): string; abstract convert(objects: ExportItem[]): ServiceRequest; diff --git a/packages/opentelemetry-exporter-collector/src/index.ts b/packages/opentelemetry-exporter-otlp-http/src/index.ts similarity index 75% rename from packages/opentelemetry-exporter-collector/src/index.ts rename to packages/opentelemetry-exporter-otlp-http/src/index.ts index 0d24649794..7b212c0399 100644 --- a/packages/opentelemetry-exporter-collector/src/index.ts +++ b/packages/opentelemetry-exporter-otlp-http/src/index.ts @@ -14,9 +14,9 @@ * limitations under the License. */ -export * from './CollectorExporterBase'; +export * from './OTLPExporterBase'; export * from './platform'; -export * as collectorTypes from './types'; -export { toCollectorExportTraceServiceRequest } from './transform'; -export { toCollectorExportMetricServiceRequest } from './transformMetrics'; +export * as otlpTypes from './types'; +export { toOTLPExportTraceServiceRequest } from './transform'; +export { toOTLPExportMetricServiceRequest } from './transformMetrics'; export { appendResourcePathToUrlIfNotPresent } from './util'; diff --git a/packages/opentelemetry-exporter-collector/src/platform/browser/CollectorExporterBrowserBase.ts b/packages/opentelemetry-exporter-otlp-http/src/platform/browser/OTLPExporterBrowserBase.ts similarity index 85% rename from packages/opentelemetry-exporter-collector/src/platform/browser/CollectorExporterBrowserBase.ts rename to packages/opentelemetry-exporter-otlp-http/src/platform/browser/OTLPExporterBrowserBase.ts index bf4af404b9..421772fcc2 100644 --- a/packages/opentelemetry-exporter-collector/src/platform/browser/CollectorExporterBrowserBase.ts +++ b/packages/opentelemetry-exporter-otlp-http/src/platform/browser/OTLPExporterBrowserBase.ts @@ -14,9 +14,9 @@ * limitations under the License. */ -import { CollectorExporterBase } from '../../CollectorExporterBase'; -import { CollectorExporterConfigBase } from '../../types'; -import * as collectorTypes from '../../types'; +import { OTLPExporterBase } from '../../OTLPExporterBase'; +import { OTLPExporterConfigBase } from '../../types'; +import * as otlpTypes from '../../types'; import { parseHeaders } from '../../util'; import { sendWithBeacon, sendWithXhr } from './util'; import { diag } from '@opentelemetry/api'; @@ -25,11 +25,11 @@ import { getEnv, baggageUtils } from '@opentelemetry/core'; /** * Collector Metric Exporter abstract base class */ -export abstract class CollectorExporterBrowserBase< +export abstract class OTLPExporterBrowserBase< ExportItem, ServiceRequest - > extends CollectorExporterBase< - CollectorExporterConfigBase, + > extends OTLPExporterBase< + OTLPExporterConfigBase, ExportItem, ServiceRequest > { @@ -39,7 +39,7 @@ export abstract class CollectorExporterBrowserBase< /** * @param config */ - constructor(config: CollectorExporterConfigBase = {}) { + constructor(config: OTLPExporterConfigBase = {}) { super(config); this._useXHR = !!config.headers || typeof navigator.sendBeacon !== 'function'; @@ -67,7 +67,7 @@ export abstract class CollectorExporterBrowserBase< send( items: ExportItem[], onSuccess: () => void, - onError: (error: collectorTypes.CollectorExporterError) => void + onError: (error: otlpTypes.OTLPExporterError) => void ): void { if (this._isShutdown) { diag.debug('Shutdown already started. Cannot send objects'); diff --git a/packages/opentelemetry-exporter-collector/src/platform/browser/CollectorMetricExporter.ts b/packages/opentelemetry-exporter-otlp-http/src/platform/browser/OTLPMetricExporter.ts similarity index 72% rename from packages/opentelemetry-exporter-collector/src/platform/browser/CollectorMetricExporter.ts rename to packages/opentelemetry-exporter-otlp-http/src/platform/browser/OTLPMetricExporter.ts index 80127d5e4b..7d3840f4c3 100644 --- a/packages/opentelemetry-exporter-collector/src/platform/browser/CollectorMetricExporter.ts +++ b/packages/opentelemetry-exporter-otlp-http/src/platform/browser/OTLPMetricExporter.ts @@ -15,10 +15,10 @@ */ import { MetricRecord, MetricExporter } from '@opentelemetry/sdk-metrics-base'; -import { CollectorExporterConfigBase } from '../../types'; -import * as collectorTypes from '../../types'; -import { CollectorExporterBrowserBase } from './CollectorExporterBrowserBase'; -import { toCollectorExportMetricServiceRequest } from '../../transformMetrics'; +import { OTLPExporterConfigBase } from '../../types'; +import * as otlpTypes from '../../types'; +import { OTLPExporterBrowserBase } from './OTLPExporterBrowserBase'; +import { toOTLPExportMetricServiceRequest } from '../../transformMetrics'; import { getEnv, baggageUtils } from '@opentelemetry/core'; import { appendResourcePathToUrlIfNotPresent } from '../../util'; @@ -28,16 +28,16 @@ const DEFAULT_COLLECTOR_URL=`http://localhost:55681${DEFAULT_COLLECTOR_RESOURCE_ /** * Collector Metric Exporter for Web */ -export class CollectorMetricExporter - extends CollectorExporterBrowserBase< +export class OTLPMetricExporter + extends OTLPExporterBrowserBase< MetricRecord, - collectorTypes.opentelemetryProto.collector.metrics.v1.ExportMetricsServiceRequest + otlpTypes.opentelemetryProto.collector.metrics.v1.ExportMetricsServiceRequest > implements MetricExporter { // Converts time to nanoseconds private readonly _startTime = new Date().getTime() * 1000000; - constructor(config: CollectorExporterConfigBase = {}) { + constructor(config: OTLPExporterConfigBase = {}) { super(config); this._headers = Object.assign( this._headers, @@ -49,15 +49,15 @@ export class CollectorMetricExporter convert( metrics: MetricRecord[] - ): collectorTypes.opentelemetryProto.collector.metrics.v1.ExportMetricsServiceRequest { - return toCollectorExportMetricServiceRequest( + ): otlpTypes.opentelemetryProto.collector.metrics.v1.ExportMetricsServiceRequest { + return toOTLPExportMetricServiceRequest( metrics, this._startTime, this ); } - getDefaultUrl(config: CollectorExporterConfigBase): string { + getDefaultUrl(config: OTLPExporterConfigBase): string { return typeof config.url === 'string' ? config.url : getEnv().OTEL_EXPORTER_OTLP_METRICS_ENDPOINT.length > 0 diff --git a/packages/opentelemetry-exporter-collector/src/platform/browser/CollectorTraceExporter.ts b/packages/opentelemetry-exporter-otlp-http/src/platform/browser/OTLPTraceExporter.ts similarity index 70% rename from packages/opentelemetry-exporter-collector/src/platform/browser/CollectorTraceExporter.ts rename to packages/opentelemetry-exporter-otlp-http/src/platform/browser/OTLPTraceExporter.ts index 801a8633dc..e68c571239 100644 --- a/packages/opentelemetry-exporter-collector/src/platform/browser/CollectorTraceExporter.ts +++ b/packages/opentelemetry-exporter-otlp-http/src/platform/browser/OTLPTraceExporter.ts @@ -14,11 +14,11 @@ * limitations under the License. */ -import { CollectorExporterConfigBase } from '../../types'; -import { CollectorExporterBrowserBase } from './CollectorExporterBrowserBase'; +import { OTLPExporterConfigBase } from '../../types'; +import { OTLPExporterBrowserBase } from './OTLPExporterBrowserBase'; import { ReadableSpan, SpanExporter } from '@opentelemetry/sdk-trace-base'; -import { toCollectorExportTraceServiceRequest } from '../../transform'; -import * as collectorTypes from '../../types'; +import { toOTLPExportTraceServiceRequest } from '../../transform'; +import * as otlpTypes from '../../types'; import { getEnv, baggageUtils } from '@opentelemetry/core'; import { appendResourcePathToUrlIfNotPresent } from '../../util'; @@ -28,13 +28,13 @@ const DEFAULT_COLLECTOR_URL=`http://localhost:55681${DEFAULT_COLLECTOR_RESOURCE_ /** * Collector Trace Exporter for Web */ -export class CollectorTraceExporter - extends CollectorExporterBrowserBase< +export class OTLPTraceExporter + extends OTLPExporterBrowserBase< ReadableSpan, - collectorTypes.opentelemetryProto.collector.trace.v1.ExportTraceServiceRequest + otlpTypes.opentelemetryProto.collector.trace.v1.ExportTraceServiceRequest > implements SpanExporter { - constructor(config: CollectorExporterConfigBase = {}) { + constructor(config: OTLPExporterConfigBase = {}) { super(config); this._headers = Object.assign( this._headers, @@ -45,11 +45,11 @@ export class CollectorTraceExporter } convert( spans: ReadableSpan[] - ): collectorTypes.opentelemetryProto.collector.trace.v1.ExportTraceServiceRequest { - return toCollectorExportTraceServiceRequest(spans, this, true); + ): otlpTypes.opentelemetryProto.collector.trace.v1.ExportTraceServiceRequest { + return toOTLPExportTraceServiceRequest(spans, this, true); } - getDefaultUrl(config: CollectorExporterConfigBase): string { + getDefaultUrl(config: OTLPExporterConfigBase): string { return typeof config.url === 'string' ? config.url : getEnv().OTEL_EXPORTER_OTLP_TRACES_ENDPOINT.length > 0 diff --git a/packages/opentelemetry-exporter-collector-proto/src/index.ts b/packages/opentelemetry-exporter-otlp-http/src/platform/browser/index.ts similarity index 87% rename from packages/opentelemetry-exporter-collector-proto/src/index.ts rename to packages/opentelemetry-exporter-otlp-http/src/platform/browser/index.ts index fcbe012b52..d54490a7ea 100644 --- a/packages/opentelemetry-exporter-collector-proto/src/index.ts +++ b/packages/opentelemetry-exporter-otlp-http/src/platform/browser/index.ts @@ -14,5 +14,5 @@ * limitations under the License. */ -export * from './CollectorTraceExporter'; -export * from './CollectorMetricExporter'; +export * from './OTLPTraceExporter'; +export * from './OTLPMetricExporter'; diff --git a/packages/opentelemetry-exporter-collector/src/platform/browser/util.ts b/packages/opentelemetry-exporter-otlp-http/src/platform/browser/util.ts similarity index 87% rename from packages/opentelemetry-exporter-collector/src/platform/browser/util.ts rename to packages/opentelemetry-exporter-otlp-http/src/platform/browser/util.ts index 6cc1f36d0b..8030552c17 100644 --- a/packages/opentelemetry-exporter-collector/src/platform/browser/util.ts +++ b/packages/opentelemetry-exporter-otlp-http/src/platform/browser/util.ts @@ -14,7 +14,7 @@ * limitations under the License. */ import { diag } from '@opentelemetry/api'; -import * as collectorTypes from '../../types'; +import * as otlpTypes from '../../types'; /** * Send metrics/spans using browser navigator.sendBeacon @@ -27,13 +27,13 @@ export function sendWithBeacon( url: string, blobPropertyBag: BlobPropertyBag, onSuccess: () => void, - onError: (error: collectorTypes.CollectorExporterError) => void + onError: (error: otlpTypes.OTLPExporterError) => void ): void { if (navigator.sendBeacon(url, new Blob([body], blobPropertyBag))) { diag.debug('sendBeacon - can send', body); onSuccess(); } else { - const error = new collectorTypes.CollectorExporterError( + const error = new otlpTypes.OTLPExporterError( `sendBeacon - cannot send ${body}` ); onError(error); @@ -52,7 +52,7 @@ export function sendWithXhr( url: string, headers: Record, onSuccess: () => void, - onError: (error: collectorTypes.CollectorExporterError) => void + onError: (error: otlpTypes.OTLPExporterError) => void ): void { const xhr = new XMLHttpRequest(); xhr.open('POST', url); @@ -77,7 +77,7 @@ export function sendWithXhr( diag.debug('xhr success', body); onSuccess(); } else { - const error = new collectorTypes.CollectorExporterError( + const error = new otlpTypes.OTLPExporterError( `Failed to export with XHR (status: ${xhr.status})`, xhr.status ); diff --git a/packages/opentelemetry-exporter-collector/src/platform/index.ts b/packages/opentelemetry-exporter-otlp-http/src/platform/index.ts similarity index 100% rename from packages/opentelemetry-exporter-collector/src/platform/index.ts rename to packages/opentelemetry-exporter-otlp-http/src/platform/index.ts diff --git a/packages/opentelemetry-exporter-collector/src/platform/node/CollectorExporterNodeBase.ts b/packages/opentelemetry-exporter-otlp-http/src/platform/node/OTLPExporterNodeBase.ts similarity index 82% rename from packages/opentelemetry-exporter-collector/src/platform/node/CollectorExporterNodeBase.ts rename to packages/opentelemetry-exporter-otlp-http/src/platform/node/OTLPExporterNodeBase.ts index 670569815b..03eb432b49 100644 --- a/packages/opentelemetry-exporter-collector/src/platform/node/CollectorExporterNodeBase.ts +++ b/packages/opentelemetry-exporter-otlp-http/src/platform/node/OTLPExporterNodeBase.ts @@ -17,9 +17,9 @@ import type * as http from 'http'; import type * as https from 'https'; -import { CollectorExporterBase } from '../../CollectorExporterBase'; -import { CollectorExporterNodeConfigBase, CompressionAlgorithm } from './types'; -import * as collectorTypes from '../../types'; +import { OTLPExporterBase } from '../../OTLPExporterBase'; +import { OTLPExporterNodeConfigBase, CompressionAlgorithm } from './types'; +import * as otlpTypes from '../../types'; import { parseHeaders } from '../../util'; import { createHttpAgent, sendWithHttp } from './util'; import { diag } from '@opentelemetry/api'; @@ -28,11 +28,11 @@ import { getEnv, baggageUtils } from '@opentelemetry/core'; /** * Collector Metric Exporter abstract base class */ -export abstract class CollectorExporterNodeBase< +export abstract class OTLPExporterNodeBase< ExportItem, ServiceRequest -> extends CollectorExporterBase< - CollectorExporterNodeConfigBase, +> extends OTLPExporterBase< + OTLPExporterNodeConfigBase, ExportItem, ServiceRequest > { @@ -41,7 +41,7 @@ export abstract class CollectorExporterNodeBase< agent: http.Agent | https.Agent | undefined; compression: CompressionAlgorithm; - constructor(config: CollectorExporterNodeConfigBase = {}) { + constructor(config: OTLPExporterNodeConfigBase = {}) { super(config); // eslint-disable-next-line @typescript-eslint/no-explicit-any if ((config as any).metadata) { @@ -56,14 +56,14 @@ export abstract class CollectorExporterNodeBase< this.compression = config.compression || CompressionAlgorithm.NONE; } - onInit(_config: CollectorExporterNodeConfigBase): void { + onInit(_config: OTLPExporterNodeConfigBase): void { this._isShutdown = false; } send( objects: ExportItem[], onSuccess: () => void, - onError: (error: collectorTypes.CollectorExporterError) => void + onError: (error: otlpTypes.OTLPExporterError) => void ): void { if (this._isShutdown) { diag.debug('Shutdown already started. Cannot send objects'); diff --git a/packages/opentelemetry-exporter-collector/src/platform/node/CollectorMetricExporter.ts b/packages/opentelemetry-exporter-otlp-http/src/platform/node/OTLPMetricExporter.ts similarity index 72% rename from packages/opentelemetry-exporter-collector/src/platform/node/CollectorMetricExporter.ts rename to packages/opentelemetry-exporter-otlp-http/src/platform/node/OTLPMetricExporter.ts index d1aa0555b5..5d3b645591 100644 --- a/packages/opentelemetry-exporter-collector/src/platform/node/CollectorMetricExporter.ts +++ b/packages/opentelemetry-exporter-otlp-http/src/platform/node/OTLPMetricExporter.ts @@ -15,10 +15,10 @@ */ import { MetricRecord, MetricExporter } from '@opentelemetry/sdk-metrics-base'; -import * as collectorTypes from '../../types'; -import { CollectorExporterNodeConfigBase } from './types'; -import { CollectorExporterNodeBase } from './CollectorExporterNodeBase'; -import { toCollectorExportMetricServiceRequest } from '../../transformMetrics'; +import * as otlpTypes from '../../types'; +import { OTLPExporterNodeConfigBase } from './types'; +import { OTLPExporterNodeBase } from './OTLPExporterNodeBase'; +import { toOTLPExportMetricServiceRequest } from '../../transformMetrics'; import { getEnv, baggageUtils } from '@opentelemetry/core'; import { appendResourcePathToUrlIfNotPresent } from '../../util'; @@ -28,16 +28,16 @@ const DEFAULT_COLLECTOR_URL=`http://localhost:55681${DEFAULT_COLLECTOR_RESOURCE_ /** * Collector Metric Exporter for Node */ -export class CollectorMetricExporter - extends CollectorExporterNodeBase< +export class OTLPMetricExporter + extends OTLPExporterNodeBase< MetricRecord, - collectorTypes.opentelemetryProto.collector.metrics.v1.ExportMetricsServiceRequest + otlpTypes.opentelemetryProto.collector.metrics.v1.ExportMetricsServiceRequest > implements MetricExporter { // Converts time to nanoseconds protected readonly _startTime = new Date().getTime() * 1000000; - constructor(config: CollectorExporterNodeConfigBase = {}) { + constructor(config: OTLPExporterNodeConfigBase = {}) { super(config); this.headers = Object.assign( this.headers, @@ -49,15 +49,15 @@ export class CollectorMetricExporter convert( metrics: MetricRecord[] - ): collectorTypes.opentelemetryProto.collector.metrics.v1.ExportMetricsServiceRequest { - return toCollectorExportMetricServiceRequest( + ): otlpTypes.opentelemetryProto.collector.metrics.v1.ExportMetricsServiceRequest { + return toOTLPExportMetricServiceRequest( metrics, this._startTime, this ); } - getDefaultUrl(config: CollectorExporterNodeConfigBase): string { + getDefaultUrl(config: OTLPExporterNodeConfigBase): string { return typeof config.url === 'string' ? config.url : getEnv().OTEL_EXPORTER_OTLP_METRICS_ENDPOINT.length > 0 diff --git a/packages/opentelemetry-exporter-collector/src/platform/node/CollectorTraceExporter.ts b/packages/opentelemetry-exporter-otlp-http/src/platform/node/OTLPTraceExporter.ts similarity index 70% rename from packages/opentelemetry-exporter-collector/src/platform/node/CollectorTraceExporter.ts rename to packages/opentelemetry-exporter-otlp-http/src/platform/node/OTLPTraceExporter.ts index a8853a4405..737980362a 100644 --- a/packages/opentelemetry-exporter-collector/src/platform/node/CollectorTraceExporter.ts +++ b/packages/opentelemetry-exporter-otlp-http/src/platform/node/OTLPTraceExporter.ts @@ -15,10 +15,10 @@ */ import { ReadableSpan, SpanExporter } from '@opentelemetry/sdk-trace-base'; -import { CollectorExporterNodeBase } from './CollectorExporterNodeBase'; -import { CollectorExporterNodeConfigBase } from './types'; -import * as collectorTypes from '../../types'; -import { toCollectorExportTraceServiceRequest } from '../../transform'; +import { OTLPExporterNodeBase } from './OTLPExporterNodeBase'; +import { OTLPExporterNodeConfigBase } from './types'; +import * as otlpTypes from '../../types'; +import { toOTLPExportTraceServiceRequest } from '../../transform'; import { getEnv, baggageUtils } from '@opentelemetry/core'; import { appendResourcePathToUrlIfNotPresent } from '../../util'; @@ -28,13 +28,13 @@ const DEFAULT_COLLECTOR_URL=`http://localhost:55681${DEFAULT_COLLECTOR_RESOURCE_ /** * Collector Trace Exporter for Node */ -export class CollectorTraceExporter - extends CollectorExporterNodeBase< +export class OTLPTraceExporter + extends OTLPExporterNodeBase< ReadableSpan, - collectorTypes.opentelemetryProto.collector.trace.v1.ExportTraceServiceRequest + otlpTypes.opentelemetryProto.collector.trace.v1.ExportTraceServiceRequest > implements SpanExporter { - constructor(config: CollectorExporterNodeConfigBase = {}) { + constructor(config: OTLPExporterNodeConfigBase = {}) { super(config); this.headers = Object.assign( this.headers, @@ -46,11 +46,11 @@ export class CollectorTraceExporter convert( spans: ReadableSpan[] - ): collectorTypes.opentelemetryProto.collector.trace.v1.ExportTraceServiceRequest { - return toCollectorExportTraceServiceRequest(spans, this, true); + ): otlpTypes.opentelemetryProto.collector.trace.v1.ExportTraceServiceRequest { + return toOTLPExportTraceServiceRequest(spans, this, true); } - getDefaultUrl(config: CollectorExporterNodeConfigBase) : string { + getDefaultUrl(config: OTLPExporterNodeConfigBase) : string { return typeof config.url === 'string' ? config.url : getEnv().OTEL_EXPORTER_OTLP_TRACES_ENDPOINT.length > 0 diff --git a/packages/opentelemetry-exporter-collector/src/platform/node/index.ts b/packages/opentelemetry-exporter-otlp-http/src/platform/node/index.ts similarity index 83% rename from packages/opentelemetry-exporter-collector/src/platform/node/index.ts rename to packages/opentelemetry-exporter-otlp-http/src/platform/node/index.ts index d2f9fa5223..cfd5b2286d 100644 --- a/packages/opentelemetry-exporter-collector/src/platform/node/index.ts +++ b/packages/opentelemetry-exporter-otlp-http/src/platform/node/index.ts @@ -14,8 +14,8 @@ * limitations under the License. */ -export * from './CollectorTraceExporter'; -export * from './CollectorMetricExporter'; -export * from './CollectorExporterNodeBase'; +export * from './OTLPTraceExporter'; +export * from './OTLPMetricExporter'; +export * from './OTLPExporterNodeBase'; export * from './util'; export * from './types'; diff --git a/packages/opentelemetry-exporter-collector/src/platform/node/types.ts b/packages/opentelemetry-exporter-otlp-http/src/platform/node/types.ts similarity index 86% rename from packages/opentelemetry-exporter-collector/src/platform/node/types.ts rename to packages/opentelemetry-exporter-otlp-http/src/platform/node/types.ts index 4ee5167e79..a37f5c3c9c 100644 --- a/packages/opentelemetry-exporter-collector/src/platform/node/types.ts +++ b/packages/opentelemetry-exporter-otlp-http/src/platform/node/types.ts @@ -16,13 +16,13 @@ import type * as http from 'http'; import type * as https from 'https'; -import { CollectorExporterConfigBase } from '../../types'; +import { OTLPExporterConfigBase } from '../../types'; /** * Collector Exporter node base config */ -export interface CollectorExporterNodeConfigBase - extends CollectorExporterConfigBase { +export interface OTLPExporterNodeConfigBase + extends OTLPExporterConfigBase { keepAlive?: boolean; compression?: CompressionAlgorithm; httpAgentOptions?: http.AgentOptions | https.AgentOptions; diff --git a/packages/opentelemetry-exporter-collector/src/platform/node/util.ts b/packages/opentelemetry-exporter-otlp-http/src/platform/node/util.ts similarity index 89% rename from packages/opentelemetry-exporter-collector/src/platform/node/util.ts rename to packages/opentelemetry-exporter-otlp-http/src/platform/node/util.ts index c7848014af..8c905c496d 100644 --- a/packages/opentelemetry-exporter-collector/src/platform/node/util.ts +++ b/packages/opentelemetry-exporter-otlp-http/src/platform/node/util.ts @@ -18,9 +18,9 @@ import * as http from 'http'; import * as https from 'https'; import * as zlib from 'zlib'; import { Readable } from 'stream'; -import * as collectorTypes from '../../types'; -import { CollectorExporterNodeBase } from './CollectorExporterNodeBase'; -import { CollectorExporterNodeConfigBase } from '.'; +import * as otlpTypes from '../../types'; +import { OTLPExporterNodeBase } from './OTLPExporterNodeBase'; +import { OTLPExporterNodeConfigBase } from '.'; import { diag } from '@opentelemetry/api'; import { CompressionAlgorithm } from './types'; @@ -35,11 +35,11 @@ const gzip = zlib.createGzip(); * @param onError */ export function sendWithHttp( - collector: CollectorExporterNodeBase, + collector: OTLPExporterNodeBase, data: string | Buffer, contentType: string, onSuccess: () => void, - onError: (error: collectorTypes.CollectorExporterError) => void + onError: (error: otlpTypes.OTLPExporterError) => void ): void { const parsedUrl = new url.URL(collector.url); @@ -66,7 +66,7 @@ export function sendWithHttp( diag.debug(`statusCode: ${res.statusCode}`, responseData); onSuccess(); } else { - const error = new collectorTypes.CollectorExporterError( + const error = new otlpTypes.OTLPExporterError( res.statusMessage, res.statusCode, responseData @@ -108,7 +108,7 @@ function readableFromBuffer(buff: string | Buffer): Readable { } export function createHttpAgent( - config: CollectorExporterNodeConfigBase + config: OTLPExporterNodeConfigBase ): http.Agent | https.Agent | undefined { if (config.httpAgentOptions && config.keepAlive === false) { diag.warn('httpAgentOptions is used only when keepAlive is true'); diff --git a/packages/opentelemetry-exporter-collector/src/transform.ts b/packages/opentelemetry-exporter-otlp-http/src/transform.ts similarity index 96% rename from packages/opentelemetry-exporter-collector/src/transform.ts rename to packages/opentelemetry-exporter-otlp-http/src/transform.ts index 710c01debf..c6ddffea19 100644 --- a/packages/opentelemetry-exporter-collector/src/transform.ts +++ b/packages/opentelemetry-exporter-otlp-http/src/transform.ts @@ -24,11 +24,11 @@ import { import * as core from '@opentelemetry/core'; import { Resource } from '@opentelemetry/resources'; import { ReadableSpan, TimedEvent } from '@opentelemetry/sdk-trace-base'; -import { CollectorExporterBase } from './CollectorExporterBase'; +import { OTLPExporterBase } from './OTLPExporterBase'; import { - COLLECTOR_SPAN_KIND_MAPPING, + OTLP_SPAN_KIND_MAPPING, opentelemetryProto, - CollectorExporterConfigBase, + OTLPExporterConfigBase, } from './types'; const MAX_INTEGER_VALUE = 2147483647; @@ -244,7 +244,7 @@ export function toCollectorResource( export function toCollectorKind( kind: SpanKind ): opentelemetryProto.trace.v1.Span.SpanKind { - const collectorKind = COLLECTOR_SPAN_KIND_MAPPING[kind]; + const collectorKind = OTLP_SPAN_KIND_MAPPING[kind]; return typeof collectorKind === 'number' ? collectorKind : opentelemetryProto.trace.v1.Span.SpanKind.SPAN_KIND_UNSPECIFIED; @@ -267,11 +267,11 @@ export function toCollectorTraceState( * @param collectorExporterBase * @param useHex - if ids should be kept as hex without converting to base64 */ -export function toCollectorExportTraceServiceRequest< - T extends CollectorExporterConfigBase +export function toOTLPExportTraceServiceRequest< + T extends OTLPExporterConfigBase >( spans: ReadableSpan[], - collectorTraceExporterBase: CollectorExporterBase< + collectorTraceExporterBase: OTLPExporterBase< T, ReadableSpan, opentelemetryProto.collector.trace.v1.ExportTraceServiceRequest diff --git a/packages/opentelemetry-exporter-collector/src/transformMetrics.ts b/packages/opentelemetry-exporter-otlp-http/src/transformMetrics.ts similarity index 96% rename from packages/opentelemetry-exporter-collector/src/transformMetrics.ts rename to packages/opentelemetry-exporter-otlp-http/src/transformMetrics.ts index bce26a45d8..cc0f580883 100644 --- a/packages/opentelemetry-exporter-collector/src/transformMetrics.ts +++ b/packages/opentelemetry-exporter-otlp-http/src/transformMetrics.ts @@ -24,9 +24,9 @@ import { MetricRecord, } from '@opentelemetry/sdk-metrics-base'; import { Resource } from '@opentelemetry/resources'; -import { CollectorExporterBase } from './CollectorExporterBase'; +import { OTLPExporterBase } from './OTLPExporterBase'; import { toCollectorResource } from './transform'; -import { CollectorExporterConfigBase, opentelemetryProto } from './types'; +import { OTLPExporterConfigBase, opentelemetryProto } from './types'; /** * Converts labels @@ -160,12 +160,12 @@ export function toCollectorMetric( * @param startTime start time of the metric in nanoseconds * @param collectorMetricExporterBase */ -export function toCollectorExportMetricServiceRequest< - T extends CollectorExporterConfigBase +export function toOTLPExportMetricServiceRequest< + T extends OTLPExporterConfigBase >( metrics: MetricRecord[], startTime: number, - collectorExporterBase: CollectorExporterBase< + collectorExporterBase: OTLPExporterBase< T, MetricRecord, opentelemetryProto.collector.metrics.v1.ExportMetricsServiceRequest diff --git a/packages/opentelemetry-exporter-collector/src/types.ts b/packages/opentelemetry-exporter-otlp-http/src/types.ts similarity index 98% rename from packages/opentelemetry-exporter-collector/src/types.ts rename to packages/opentelemetry-exporter-otlp-http/src/types.ts index d30bc53425..3f2bd27a01 100644 --- a/packages/opentelemetry-exporter-collector/src/types.ts +++ b/packages/opentelemetry-exporter-otlp-http/src/types.ts @@ -314,9 +314,9 @@ export namespace opentelemetryProto { /** * Interface for handling error */ -export class CollectorExporterError extends Error { +export class OTLPExporterError extends Error { readonly code?: number; - override readonly name: string = 'CollectorExporterError'; + override readonly name: string = 'OTLPExporterError'; readonly data?: string; constructor(message?: string, code?: number, data?: string) { @@ -341,7 +341,7 @@ export interface ExportServiceError { /** * Collector Exporter base config */ -export interface CollectorExporterConfigBase { +export interface OTLPExporterConfigBase { headers?: Partial>; hostname?: string; attributes?: SpanAttributes; @@ -352,7 +352,7 @@ export interface CollectorExporterConfigBase { /** * Mapping between api SpanKind and proto SpanKind */ -export const COLLECTOR_SPAN_KIND_MAPPING = { +export const OTLP_SPAN_KIND_MAPPING = { [SpanKind.INTERNAL]: opentelemetryProto.trace.v1.Span.SpanKind.SPAN_KIND_INTERNAL, [SpanKind.SERVER]: opentelemetryProto.trace.v1.Span.SpanKind.SPAN_KIND_SERVER, diff --git a/packages/opentelemetry-exporter-collector/src/util.ts b/packages/opentelemetry-exporter-otlp-http/src/util.ts similarity index 100% rename from packages/opentelemetry-exporter-collector/src/util.ts rename to packages/opentelemetry-exporter-otlp-http/src/util.ts diff --git a/packages/opentelemetry-exporter-collector/test/browser/CollectorMetricExporter.test.ts b/packages/opentelemetry-exporter-otlp-http/test/browser/CollectorMetricExporter.test.ts similarity index 92% rename from packages/opentelemetry-exporter-collector/test/browser/CollectorMetricExporter.test.ts rename to packages/opentelemetry-exporter-otlp-http/test/browser/CollectorMetricExporter.test.ts index 4090bbcccf..34463695c8 100644 --- a/packages/opentelemetry-exporter-collector/test/browser/CollectorMetricExporter.test.ts +++ b/packages/opentelemetry-exporter-otlp-http/test/browser/CollectorMetricExporter.test.ts @@ -30,9 +30,9 @@ import { } from '@opentelemetry/sdk-metrics-base'; import * as assert from 'assert'; import * as sinon from 'sinon'; -import { CollectorMetricExporter } from '../../src/platform/browser/index'; -import * as collectorTypes from '../../src/types'; -import { CollectorExporterConfigBase } from '../../src/types'; +import { OTLPMetricExporter } from '../../src/platform/browser/index'; +import * as otlpTypes from '../../src/types'; +import { OTLPExporterConfigBase } from '../../src/types'; import { ensureCounterIsCorrect, ensureExportMetricsServiceRequestIsSet, @@ -45,8 +45,8 @@ import { mockValueRecorder, } from '../helper'; -describe('CollectorMetricExporter - web', () => { - let collectorExporter: CollectorMetricExporter; +describe('OTLPMetricExporter - web', () => { + let collectorExporter: OTLPMetricExporter; let stubOpen: sinon.SinonStub; let stubBeacon: sinon.SinonStub; let metrics: MetricRecord[]; @@ -82,7 +82,7 @@ describe('CollectorMetricExporter - web', () => { describe('export', () => { describe('when "sendBeacon" is available', () => { beforeEach(() => { - collectorExporter = new CollectorMetricExporter({ + collectorExporter = new OTLPMetricExporter({ url: 'http://foo.bar.com', }); // Overwrites the start time to make tests consistent @@ -100,7 +100,7 @@ describe('CollectorMetricExporter - web', () => { const body = await blob.text(); const json = JSON.parse( body - ) as collectorTypes.opentelemetryProto.collector.metrics.v1.ExportMetricsServiceRequest; + ) as otlpTypes.opentelemetryProto.collector.metrics.v1.ExportMetricsServiceRequest; const metric1 = json.resourceMetrics[0].instrumentationLibraryMetrics[0].metrics[0]; const metric2 = @@ -191,7 +191,7 @@ describe('CollectorMetricExporter - web', () => { let server: any; beforeEach(() => { (window.navigator as any).sendBeacon = false; - collectorExporter = new CollectorMetricExporter({ + collectorExporter = new OTLPMetricExporter({ url: 'http://foo.bar.com', }); // Overwrites the start time to make tests consistent @@ -215,7 +215,7 @@ describe('CollectorMetricExporter - web', () => { const body = request.requestBody; const json = JSON.parse( body - ) as collectorTypes.opentelemetryProto.collector.metrics.v1.ExportMetricsServiceRequest; + ) as otlpTypes.opentelemetryProto.collector.metrics.v1.ExportMetricsServiceRequest; const metric1 = json.resourceMetrics[0].instrumentationLibraryMetrics[0].metrics[0]; const metric2 = @@ -321,7 +321,7 @@ describe('CollectorMetricExporter - web', () => { foo: 'bar', bar: 'baz', }; - let collectorExporterConfig: CollectorExporterConfigBase; + let collectorExporterConfig: OTLPExporterConfigBase; beforeEach(() => { collectorExporterConfig = { @@ -336,7 +336,7 @@ describe('CollectorMetricExporter - web', () => { describe('when "sendBeacon" is available', () => { beforeEach(() => { - collectorExporter = new CollectorMetricExporter( + collectorExporter = new OTLPMetricExporter( collectorExporterConfig ); }); @@ -358,7 +358,7 @@ describe('CollectorMetricExporter - web', () => { describe('when "sendBeacon" is NOT available', () => { beforeEach(() => { (window.navigator as any).sendBeacon = false; - collectorExporter = new CollectorMetricExporter( + collectorExporter = new OTLPMetricExporter( collectorExporterConfig ); }); @@ -384,7 +384,7 @@ describe('when configuring via environment', () => { const envSource = window as any; it('should use url defined in env', () => { envSource.OTEL_EXPORTER_OTLP_ENDPOINT = 'http://foo.bar/v1/metrics'; - const collectorExporter = new CollectorMetricExporter(); + const collectorExporter = new OTLPMetricExporter(); assert.strictEqual( collectorExporter.url, envSource.OTEL_EXPORTER_OTLP_ENDPOINT @@ -393,7 +393,7 @@ describe('when configuring via environment', () => { }); it('should use url defined in env and append version and signal when not present', () => { envSource.OTEL_EXPORTER_OTLP_ENDPOINT = 'http://foo.bar'; - const collectorExporter = new CollectorMetricExporter(); + const collectorExporter = new OTLPMetricExporter(); assert.strictEqual( collectorExporter.url, `${envSource.OTEL_EXPORTER_OTLP_ENDPOINT}/v1/metrics` @@ -403,7 +403,7 @@ describe('when configuring via environment', () => { it('should override global exporter url with signal url defined in env', () => { envSource.OTEL_EXPORTER_OTLP_ENDPOINT = 'http://foo.bar'; envSource.OTEL_EXPORTER_OTLP_METRICS_ENDPOINT = 'http://foo.metrics'; - const collectorExporter = new CollectorMetricExporter(); + const collectorExporter = new OTLPMetricExporter(); assert.strictEqual( collectorExporter.url, envSource.OTEL_EXPORTER_OTLP_METRICS_ENDPOINT @@ -413,7 +413,7 @@ describe('when configuring via environment', () => { }); it('should use headers defined via env', () => { envSource.OTEL_EXPORTER_OTLP_HEADERS = 'foo=bar'; - const collectorExporter = new CollectorMetricExporter({ headers: {} }); + const collectorExporter = new OTLPMetricExporter({ headers: {} }); // @ts-expect-error access internal property for testing assert.strictEqual(collectorExporter._headers.foo, 'bar'); envSource.OTEL_EXPORTER_OTLP_HEADERS = ''; @@ -421,7 +421,7 @@ describe('when configuring via environment', () => { it('should override global headers config with signal headers defined via env', () => { envSource.OTEL_EXPORTER_OTLP_HEADERS = 'foo=bar,bar=foo'; envSource.OTEL_EXPORTER_OTLP_METRICS_HEADERS = 'foo=boo'; - const collectorExporter = new CollectorMetricExporter({ headers: {} }); + const collectorExporter = new OTLPMetricExporter({ headers: {} }); // @ts-expect-error access internal property for testing assert.strictEqual(collectorExporter._headers.foo, 'boo'); // @ts-expect-error access internal property for testing diff --git a/packages/opentelemetry-exporter-collector/test/browser/CollectorTraceExporter.test.ts b/packages/opentelemetry-exporter-otlp-http/test/browser/CollectorTraceExporter.test.ts similarity index 88% rename from packages/opentelemetry-exporter-collector/test/browser/CollectorTraceExporter.test.ts rename to packages/opentelemetry-exporter-otlp-http/test/browser/CollectorTraceExporter.test.ts index 5f2dc1c46e..33cc33fff8 100644 --- a/packages/opentelemetry-exporter-collector/test/browser/CollectorTraceExporter.test.ts +++ b/packages/opentelemetry-exporter-otlp-http/test/browser/CollectorTraceExporter.test.ts @@ -19,9 +19,9 @@ import { ExportResultCode } from '@opentelemetry/core'; import { ReadableSpan } from '@opentelemetry/sdk-trace-base'; import * as assert from 'assert'; import * as sinon from 'sinon'; -import { CollectorTraceExporter } from '../../src/platform/browser/index'; -import { CollectorExporterConfigBase } from '../../src/types'; -import * as collectorTypes from '../../src/types'; +import { OTLPTraceExporter } from '../../src/platform/browser/index'; +import { OTLPExporterConfigBase } from '../../src/types'; +import * as otlpTypes from '../../src/types'; import { ensureSpanIsCorrect, @@ -31,9 +31,9 @@ import { mockedReadableSpan, } from '../helper'; -describe('CollectorTraceExporter - web', () => { - let collectorTraceExporter: CollectorTraceExporter; - let collectorExporterConfig: CollectorExporterConfigBase; +describe('OTLPTraceExporter - web', () => { + let collectorTraceExporter: OTLPTraceExporter; + let collectorExporterConfig: OTLPExporterConfigBase; let stubOpen: sinon.SinonStub; let stubBeacon: sinon.SinonStub; let spans: ReadableSpan[]; @@ -61,7 +61,7 @@ describe('CollectorTraceExporter - web', () => { describe('when "sendBeacon" is available', () => { beforeEach(() => { - collectorTraceExporter = new CollectorTraceExporter( + collectorTraceExporter = new OTLPTraceExporter( collectorExporterConfig ); }); @@ -76,7 +76,7 @@ describe('CollectorTraceExporter - web', () => { const body = await blob.text(); const json = JSON.parse( body - ) as collectorTypes.opentelemetryProto.collector.trace.v1.ExportTraceServiceRequest; + ) as otlpTypes.opentelemetryProto.collector.trace.v1.ExportTraceServiceRequest; const span1 = json.resourceSpans[0].instrumentationLibrarySpans[0].spans[0]; @@ -134,7 +134,7 @@ describe('CollectorTraceExporter - web', () => { let server: any; beforeEach(() => { (window.navigator as any).sendBeacon = false; - collectorTraceExporter = new CollectorTraceExporter( + collectorTraceExporter = new OTLPTraceExporter( collectorExporterConfig ); server = sinon.fakeServer.create(); @@ -154,7 +154,7 @@ describe('CollectorTraceExporter - web', () => { const body = request.requestBody; const json = JSON.parse( body - ) as collectorTypes.opentelemetryProto.collector.trace.v1.ExportTraceServiceRequest; + ) as otlpTypes.opentelemetryProto.collector.trace.v1.ExportTraceServiceRequest; const span1 = json.resourceSpans[0].instrumentationLibrarySpans[0].spans[0]; @@ -244,7 +244,7 @@ describe('CollectorTraceExporter - web', () => { describe('when "sendBeacon" is available', () => { beforeEach(() => { - collectorTraceExporter = new CollectorTraceExporter( + collectorTraceExporter = new OTLPTraceExporter( collectorExporterConfig ); }); @@ -266,7 +266,7 @@ describe('CollectorTraceExporter - web', () => { describe('when "sendBeacon" is NOT available', () => { beforeEach(() => { (window.navigator as any).sendBeacon = false; - collectorTraceExporter = new CollectorTraceExporter( + collectorTraceExporter = new OTLPTraceExporter( collectorExporterConfig ); }); @@ -288,9 +288,9 @@ describe('CollectorTraceExporter - web', () => { }); }); -describe('CollectorTraceExporter - browser (getDefaultUrl)', () => { +describe('OTLPTraceExporter - browser (getDefaultUrl)', () => { it('should default to v1/trace', done => { - const collectorExporter = new CollectorTraceExporter({}); + const collectorExporter = new OTLPTraceExporter({}); setTimeout(() => { assert.strictEqual( collectorExporter['url'], @@ -301,7 +301,7 @@ describe('CollectorTraceExporter - browser (getDefaultUrl)', () => { }); it('should keep the URL if included', done => { const url = 'http://foo.bar.com'; - const collectorExporter = new CollectorTraceExporter({ url }); + const collectorExporter = new OTLPTraceExporter({ url }); setTimeout(() => { assert.strictEqual(collectorExporter['url'], url); done(); @@ -313,7 +313,7 @@ describe('when configuring via environment', () => { const envSource = window as any; it('should use url defined in env', () => { envSource.OTEL_EXPORTER_OTLP_ENDPOINT = 'http://foo.bar/v1/traces'; - const collectorExporter = new CollectorTraceExporter(); + const collectorExporter = new OTLPTraceExporter(); assert.strictEqual( collectorExporter.url, envSource.OTEL_EXPORTER_OTLP_ENDPOINT @@ -322,7 +322,7 @@ describe('when configuring via environment', () => { }); it('should use url defined in env and append version and signal when not present', () => { envSource.OTEL_EXPORTER_OTLP_ENDPOINT = 'http://foo.bar'; - const collectorExporter = new CollectorTraceExporter(); + const collectorExporter = new OTLPTraceExporter(); assert.strictEqual( collectorExporter.url, `${envSource.OTEL_EXPORTER_OTLP_ENDPOINT}/v1/traces` @@ -332,7 +332,7 @@ describe('when configuring via environment', () => { it('should override global exporter url with signal url defined in env', () => { envSource.OTEL_EXPORTER_OTLP_ENDPOINT = 'http://foo.bar'; envSource.OTEL_EXPORTER_OTLP_TRACES_ENDPOINT = 'http://foo.traces'; - const collectorExporter = new CollectorTraceExporter(); + const collectorExporter = new OTLPTraceExporter(); assert.strictEqual( collectorExporter.url, envSource.OTEL_EXPORTER_OTLP_TRACES_ENDPOINT @@ -342,7 +342,7 @@ describe('when configuring via environment', () => { }); it('should use headers defined via env', () => { envSource.OTEL_EXPORTER_OTLP_HEADERS = 'foo=bar'; - const collectorExporter = new CollectorTraceExporter({ headers: {} }); + const collectorExporter = new OTLPTraceExporter({ headers: {} }); // @ts-expect-error access internal property for testing assert.strictEqual(collectorExporter._headers.foo, 'bar'); envSource.OTEL_EXPORTER_OTLP_HEADERS = ''; @@ -350,7 +350,7 @@ describe('when configuring via environment', () => { it('should override global headers config with signal headers defined via env', () => { envSource.OTEL_EXPORTER_OTLP_HEADERS = 'foo=bar,bar=foo'; envSource.OTEL_EXPORTER_OTLP_TRACES_HEADERS = 'foo=boo'; - const collectorExporter = new CollectorTraceExporter({ headers: {} }); + const collectorExporter = new OTLPTraceExporter({ headers: {} }); // @ts-expect-error access internal property for testing assert.strictEqual(collectorExporter._headers.foo, 'boo'); // @ts-expect-error access internal property for testing diff --git a/packages/opentelemetry-exporter-collector/test/browser/index-webpack.ts b/packages/opentelemetry-exporter-otlp-http/test/browser/index-webpack.ts similarity index 100% rename from packages/opentelemetry-exporter-collector/test/browser/index-webpack.ts rename to packages/opentelemetry-exporter-otlp-http/test/browser/index-webpack.ts diff --git a/packages/opentelemetry-exporter-collector/test/browser/util.test.ts b/packages/opentelemetry-exporter-otlp-http/test/browser/util.test.ts similarity index 100% rename from packages/opentelemetry-exporter-collector/test/browser/util.test.ts rename to packages/opentelemetry-exporter-otlp-http/test/browser/util.test.ts diff --git a/packages/opentelemetry-exporter-collector/test/certs/ca.crt b/packages/opentelemetry-exporter-otlp-http/test/certs/ca.crt similarity index 100% rename from packages/opentelemetry-exporter-collector/test/certs/ca.crt rename to packages/opentelemetry-exporter-otlp-http/test/certs/ca.crt diff --git a/packages/opentelemetry-exporter-collector/test/certs/ca.key b/packages/opentelemetry-exporter-otlp-http/test/certs/ca.key similarity index 100% rename from packages/opentelemetry-exporter-collector/test/certs/ca.key rename to packages/opentelemetry-exporter-otlp-http/test/certs/ca.key diff --git a/packages/opentelemetry-exporter-collector/test/certs/client.crt b/packages/opentelemetry-exporter-otlp-http/test/certs/client.crt similarity index 100% rename from packages/opentelemetry-exporter-collector/test/certs/client.crt rename to packages/opentelemetry-exporter-otlp-http/test/certs/client.crt diff --git a/packages/opentelemetry-exporter-collector/test/certs/client.csr b/packages/opentelemetry-exporter-otlp-http/test/certs/client.csr similarity index 100% rename from packages/opentelemetry-exporter-collector/test/certs/client.csr rename to packages/opentelemetry-exporter-otlp-http/test/certs/client.csr diff --git a/packages/opentelemetry-exporter-collector/test/certs/client.key b/packages/opentelemetry-exporter-otlp-http/test/certs/client.key similarity index 100% rename from packages/opentelemetry-exporter-collector/test/certs/client.key rename to packages/opentelemetry-exporter-otlp-http/test/certs/client.key diff --git a/packages/opentelemetry-exporter-collector/test/certs/regenerate.sh b/packages/opentelemetry-exporter-otlp-http/test/certs/regenerate.sh similarity index 100% rename from packages/opentelemetry-exporter-collector/test/certs/regenerate.sh rename to packages/opentelemetry-exporter-otlp-http/test/certs/regenerate.sh diff --git a/packages/opentelemetry-exporter-collector/test/certs/server.crt b/packages/opentelemetry-exporter-otlp-http/test/certs/server.crt similarity index 100% rename from packages/opentelemetry-exporter-collector/test/certs/server.crt rename to packages/opentelemetry-exporter-otlp-http/test/certs/server.crt diff --git a/packages/opentelemetry-exporter-collector/test/certs/server.csr b/packages/opentelemetry-exporter-otlp-http/test/certs/server.csr similarity index 100% rename from packages/opentelemetry-exporter-collector/test/certs/server.csr rename to packages/opentelemetry-exporter-otlp-http/test/certs/server.csr diff --git a/packages/opentelemetry-exporter-collector/test/certs/server.key b/packages/opentelemetry-exporter-otlp-http/test/certs/server.key similarity index 100% rename from packages/opentelemetry-exporter-collector/test/certs/server.key rename to packages/opentelemetry-exporter-otlp-http/test/certs/server.key diff --git a/packages/opentelemetry-exporter-collector/test/common/CollectorMetricExporter.test.ts b/packages/opentelemetry-exporter-otlp-http/test/common/CollectorMetricExporter.test.ts similarity index 81% rename from packages/opentelemetry-exporter-collector/test/common/CollectorMetricExporter.test.ts rename to packages/opentelemetry-exporter-otlp-http/test/common/CollectorMetricExporter.test.ts index 10c54f6c57..119702c683 100644 --- a/packages/opentelemetry-exporter-collector/test/common/CollectorMetricExporter.test.ts +++ b/packages/opentelemetry-exporter-otlp-http/test/common/CollectorMetricExporter.test.ts @@ -24,16 +24,16 @@ import { } from '@opentelemetry/sdk-metrics-base'; import * as assert from 'assert'; import * as sinon from 'sinon'; -import { CollectorExporterBase } from '../../src/CollectorExporterBase'; -import * as collectorTypes from '../../src/types'; -import { CollectorExporterConfigBase } from '../../src/types'; +import { OTLPExporterBase } from '../../src/OTLPExporterBase'; +import * as otlpTypes from '../../src/types'; +import { OTLPExporterConfigBase } from '../../src/types'; import { mockCounter, mockObserver } from '../helper'; -type CollectorExporterConfig = CollectorExporterConfigBase; -class CollectorMetricExporter extends CollectorExporterBase< +type CollectorExporterConfig = OTLPExporterConfigBase; +class OTLPMetricExporter extends OTLPExporterBase< CollectorExporterConfig, MetricRecord, - collectorTypes.opentelemetryProto.collector.metrics.v1.ExportMetricsServiceRequest + otlpTypes.opentelemetryProto.collector.metrics.v1.ExportMetricsServiceRequest > { onInit() {} onShutdown() {} @@ -43,13 +43,13 @@ class CollectorMetricExporter extends CollectorExporterBase< } convert( metrics: MetricRecord[] - ): collectorTypes.opentelemetryProto.collector.metrics.v1.ExportMetricsServiceRequest { + ): otlpTypes.opentelemetryProto.collector.metrics.v1.ExportMetricsServiceRequest { return { resourceMetrics: [] }; } } -describe('CollectorMetricExporter - common', () => { - let collectorExporter: CollectorMetricExporter; +describe('OTLPMetricExporter - common', () => { + let collectorExporter: OTLPMetricExporter; let collectorExporterConfig: CollectorExporterConfig; let metrics: MetricRecord[]; @@ -61,13 +61,13 @@ describe('CollectorMetricExporter - common', () => { let onInitSpy: any; beforeEach(async () => { - onInitSpy = sinon.stub(CollectorMetricExporter.prototype, 'onInit'); + onInitSpy = sinon.stub(OTLPMetricExporter.prototype, 'onInit'); collectorExporterConfig = { hostname: 'foo', attributes: {}, url: 'http://foo.bar.com', }; - collectorExporter = new CollectorMetricExporter(collectorExporterConfig); + collectorExporter = new OTLPMetricExporter(collectorExporterConfig); metrics = []; const counter: Metric & Counter = mockCounter(); const observer: Metric & ValueObserver = mockObserver( @@ -103,7 +103,7 @@ describe('CollectorMetricExporter - common', () => { describe('when config is missing certain params', () => { beforeEach(() => { - collectorExporter = new CollectorMetricExporter(); + collectorExporter = new OTLPMetricExporter(); }); }); }); @@ -111,11 +111,11 @@ describe('CollectorMetricExporter - common', () => { describe('export', () => { let spySend: any; beforeEach(() => { - spySend = sinon.stub(CollectorMetricExporter.prototype, 'send'); - collectorExporter = new CollectorMetricExporter(collectorExporterConfig); + spySend = sinon.stub(OTLPMetricExporter.prototype, 'send'); + collectorExporter = new OTLPMetricExporter(collectorExporterConfig); }); - it('should export metrics as collectorTypes.Metrics', done => { + it('should export metrics as otlpTypes.Metrics', done => { collectorExporter.export(metrics, () => {}); setTimeout(() => { const metric1 = spySend.args[0][0][0] as MetricRecord; @@ -181,7 +181,7 @@ describe('CollectorMetricExporter - common', () => { let onShutdownSpy: any; beforeEach(() => { onShutdownSpy = sinon.stub( - CollectorMetricExporter.prototype, + OTLPMetricExporter.prototype, 'onShutdown' ); collectorExporterConfig = { @@ -189,7 +189,7 @@ describe('CollectorMetricExporter - common', () => { attributes: {}, url: 'http://foo.bar.com', }; - collectorExporter = new CollectorMetricExporter(collectorExporterConfig); + collectorExporter = new OTLPMetricExporter(collectorExporterConfig); }); it('should call onShutdown', async () => { diff --git a/packages/opentelemetry-exporter-collector/test/common/CollectorTraceExporter.test.ts b/packages/opentelemetry-exporter-otlp-http/test/common/CollectorTraceExporter.test.ts similarity index 82% rename from packages/opentelemetry-exporter-collector/test/common/CollectorTraceExporter.test.ts rename to packages/opentelemetry-exporter-otlp-http/test/common/CollectorTraceExporter.test.ts index 65abf27963..f489a74906 100644 --- a/packages/opentelemetry-exporter-collector/test/common/CollectorTraceExporter.test.ts +++ b/packages/opentelemetry-exporter-otlp-http/test/common/CollectorTraceExporter.test.ts @@ -18,23 +18,23 @@ import { ExportResultCode } from '@opentelemetry/core'; import { ReadableSpan } from '@opentelemetry/sdk-trace-base'; import * as assert from 'assert'; import * as sinon from 'sinon'; -import { CollectorExporterBase } from '../../src/CollectorExporterBase'; -import { CollectorExporterConfigBase } from '../../src/types'; +import { OTLPExporterBase } from '../../src/OTLPExporterBase'; +import { OTLPExporterConfigBase } from '../../src/types'; import { mockedReadableSpan } from '../helper'; -import * as collectorTypes from '../../src/types'; +import * as otlpTypes from '../../src/types'; -type CollectorExporterConfig = CollectorExporterConfigBase; -class CollectorTraceExporter extends CollectorExporterBase< +type CollectorExporterConfig = OTLPExporterConfigBase; +class OTLPTraceExporter extends OTLPExporterBase< CollectorExporterConfig, ReadableSpan, - collectorTypes.opentelemetryProto.collector.trace.v1.ExportTraceServiceRequest + otlpTypes.opentelemetryProto.collector.trace.v1.ExportTraceServiceRequest > { onInit() {} onShutdown() {} send( items: any[], onSuccess: () => void, - onError: (error: collectorTypes.CollectorExporterError) => void + onError: (error: otlpTypes.OTLPExporterError) => void ) { const promise = Promise.resolve(null); this._sendingPromises.push( @@ -49,13 +49,13 @@ class CollectorTraceExporter extends CollectorExporterBase< convert( spans: ReadableSpan[] - ): collectorTypes.opentelemetryProto.collector.trace.v1.ExportTraceServiceRequest { + ): otlpTypes.opentelemetryProto.collector.trace.v1.ExportTraceServiceRequest { return { resourceSpans: [] }; } } -describe('CollectorTraceExporter - common', () => { - let collectorExporter: CollectorTraceExporter; +describe('OTLPTraceExporter - common', () => { + let collectorExporter: OTLPTraceExporter; let collectorExporterConfig: CollectorExporterConfig; afterEach(() => { @@ -66,13 +66,13 @@ describe('CollectorTraceExporter - common', () => { let onInitSpy: any; beforeEach(() => { - onInitSpy = sinon.stub(CollectorTraceExporter.prototype, 'onInit'); + onInitSpy = sinon.stub(OTLPTraceExporter.prototype, 'onInit'); collectorExporterConfig = { hostname: 'foo', attributes: {}, url: 'http://foo.bar.com', }; - collectorExporter = new CollectorTraceExporter(collectorExporterConfig); + collectorExporter = new OTLPTraceExporter(collectorExporterConfig); }); it('should create an instance', () => { @@ -97,11 +97,11 @@ describe('CollectorTraceExporter - common', () => { describe('export', () => { let spySend: any; beforeEach(() => { - spySend = sinon.stub(CollectorTraceExporter.prototype, 'send'); - collectorExporter = new CollectorTraceExporter(collectorExporterConfig); + spySend = sinon.stub(OTLPTraceExporter.prototype, 'send'); + collectorExporter = new OTLPTraceExporter(collectorExporterConfig); }); - it('should export spans as collectorTypes.Spans', done => { + it('should export spans as otlpTypes.Spans', done => { const spans: ReadableSpan[] = []; spans.push(Object.assign({}, mockedReadableSpan)); @@ -170,7 +170,7 @@ describe('CollectorTraceExporter - common', () => { }); describe('export - concurrency limit', () => { it('should error if too many concurrent exports are queued', done => { - const collectorExporterWithConcurrencyLimit = new CollectorTraceExporter({ + const collectorExporterWithConcurrencyLimit = new OTLPTraceExporter({ ...collectorExporterConfig, concurrencyLimit: 3, }); @@ -198,7 +198,7 @@ describe('CollectorTraceExporter - common', () => { let onShutdownSpy: any; beforeEach(() => { onShutdownSpy = sinon.stub( - CollectorTraceExporter.prototype, + OTLPTraceExporter.prototype, 'onShutdown' ); collectorExporterConfig = { @@ -206,7 +206,7 @@ describe('CollectorTraceExporter - common', () => { attributes: {}, url: 'http://foo.bar.com', }; - collectorExporter = new CollectorTraceExporter(collectorExporterConfig); + collectorExporter = new OTLPTraceExporter(collectorExporterConfig); }); it('should call onShutdown', async () => { diff --git a/packages/opentelemetry-exporter-collector/test/common/transform.test.ts b/packages/opentelemetry-exporter-otlp-http/test/common/transform.test.ts similarity index 100% rename from packages/opentelemetry-exporter-collector/test/common/transform.test.ts rename to packages/opentelemetry-exporter-otlp-http/test/common/transform.test.ts diff --git a/packages/opentelemetry-exporter-collector/test/common/transformMetrics.test.ts b/packages/opentelemetry-exporter-otlp-http/test/common/transformMetrics.test.ts similarity index 100% rename from packages/opentelemetry-exporter-collector/test/common/transformMetrics.test.ts rename to packages/opentelemetry-exporter-otlp-http/test/common/transformMetrics.test.ts diff --git a/packages/opentelemetry-exporter-collector/test/common/utils.test.ts b/packages/opentelemetry-exporter-otlp-http/test/common/utils.test.ts similarity index 100% rename from packages/opentelemetry-exporter-collector/test/common/utils.test.ts rename to packages/opentelemetry-exporter-otlp-http/test/common/utils.test.ts diff --git a/packages/opentelemetry-exporter-collector/test/helper.ts b/packages/opentelemetry-exporter-otlp-http/test/helper.ts similarity index 94% rename from packages/opentelemetry-exporter-collector/test/helper.ts rename to packages/opentelemetry-exporter-otlp-http/test/helper.ts index 78c13a8290..8783906034 100644 --- a/packages/opentelemetry-exporter-collector/test/helper.ts +++ b/packages/opentelemetry-exporter-otlp-http/test/helper.ts @@ -29,7 +29,7 @@ import * as metrics from '@opentelemetry/sdk-metrics-base'; import { Resource } from '@opentelemetry/resources'; import { ReadableSpan } from '@opentelemetry/sdk-trace-base'; import * as assert from 'assert'; -import * as collectorTypes from '../src/types'; +import * as otlpTypes from '../src/types'; import { opentelemetryProto } from '../src/types'; const meterProvider = new metrics.MeterProvider({ @@ -473,7 +473,7 @@ export function ensureLinksAreCorrect( } export function ensureSpanIsCorrect( - span: collectorTypes.opentelemetryProto.trace.v1.Span, + span: otlpTypes.opentelemetryProto.trace.v1.Span, useHex = true ) { if (span.attributes) { @@ -531,7 +531,7 @@ export function ensureSpanIsCorrect( } export function ensureWebResourceIsCorrect( - resource: collectorTypes.opentelemetryProto.resource.v1.Resource + resource: otlpTypes.opentelemetryProto.resource.v1.Resource ) { assert.strictEqual(resource.attributes.length, 7); assert.strictEqual(resource.attributes[0].key, 'service.name'); @@ -552,7 +552,7 @@ export function ensureWebResourceIsCorrect( } export function ensureCounterIsCorrect( - metric: collectorTypes.opentelemetryProto.metrics.v1.Metric, + metric: otlpTypes.opentelemetryProto.metrics.v1.Metric, time: number ) { assert.deepStrictEqual(metric, { @@ -570,14 +570,14 @@ export function ensureCounterIsCorrect( ], isMonotonic: true, aggregationTemporality: - collectorTypes.opentelemetryProto.metrics.v1.AggregationTemporality + otlpTypes.opentelemetryProto.metrics.v1.AggregationTemporality .AGGREGATION_TEMPORALITY_CUMULATIVE, }, }); } export function ensureDoubleCounterIsCorrect( - metric: collectorTypes.opentelemetryProto.metrics.v1.Metric, + metric: otlpTypes.opentelemetryProto.metrics.v1.Metric, time: number ) { assert.deepStrictEqual(metric, { @@ -595,14 +595,14 @@ export function ensureDoubleCounterIsCorrect( ], isMonotonic: true, aggregationTemporality: - collectorTypes.opentelemetryProto.metrics.v1.AggregationTemporality + otlpTypes.opentelemetryProto.metrics.v1.AggregationTemporality .AGGREGATION_TEMPORALITY_CUMULATIVE, }, }); } export function ensureObserverIsCorrect( - metric: collectorTypes.opentelemetryProto.metrics.v1.Metric, + metric: otlpTypes.opentelemetryProto.metrics.v1.Metric, time: number, value: number, name = 'double-observer' @@ -625,7 +625,7 @@ export function ensureObserverIsCorrect( } export function ensureSumObserverIsCorrect( - metric: collectorTypes.opentelemetryProto.metrics.v1.Metric, + metric: otlpTypes.opentelemetryProto.metrics.v1.Metric, time: number, value: number, name = 'double-sum-observer' @@ -645,14 +645,14 @@ export function ensureSumObserverIsCorrect( }, ], aggregationTemporality: - collectorTypes.opentelemetryProto.metrics.v1.AggregationTemporality + otlpTypes.opentelemetryProto.metrics.v1.AggregationTemporality .AGGREGATION_TEMPORALITY_CUMULATIVE, }, }); } export function ensureUpDownSumObserverIsCorrect( - metric: collectorTypes.opentelemetryProto.metrics.v1.Metric, + metric: otlpTypes.opentelemetryProto.metrics.v1.Metric, time: number, value: number, name = 'double-up-down-sum-observer' @@ -672,14 +672,14 @@ export function ensureUpDownSumObserverIsCorrect( }, ], aggregationTemporality: - collectorTypes.opentelemetryProto.metrics.v1.AggregationTemporality + otlpTypes.opentelemetryProto.metrics.v1.AggregationTemporality .AGGREGATION_TEMPORALITY_CUMULATIVE, }, }); } export function ensureValueRecorderIsCorrect( - metric: collectorTypes.opentelemetryProto.metrics.v1.Metric, + metric: otlpTypes.opentelemetryProto.metrics.v1.Metric, time: number, explicitBounds: (number | null)[] = [Infinity], bucketCounts: number[] = [2, 0] @@ -701,14 +701,14 @@ export function ensureValueRecorderIsCorrect( }, ], aggregationTemporality: - collectorTypes.opentelemetryProto.metrics.v1.AggregationTemporality + otlpTypes.opentelemetryProto.metrics.v1.AggregationTemporality .AGGREGATION_TEMPORALITY_CUMULATIVE, }, }); } export function ensureExportTraceServiceRequestIsSet( - json: collectorTypes.opentelemetryProto.collector.trace.v1.ExportTraceServiceRequest + json: otlpTypes.opentelemetryProto.collector.trace.v1.ExportTraceServiceRequest ) { const resourceSpans = json.resourceSpans; assert.strictEqual( @@ -741,7 +741,7 @@ export function ensureExportTraceServiceRequestIsSet( } export function ensureExportMetricsServiceRequestIsSet( - json: collectorTypes.opentelemetryProto.collector.metrics.v1.ExportMetricsServiceRequest + json: otlpTypes.opentelemetryProto.collector.metrics.v1.ExportMetricsServiceRequest ) { const resourceMetrics = json.resourceMetrics; assert.strictEqual( diff --git a/packages/opentelemetry-exporter-collector/test/node/CollectorMetricExporter.test.ts b/packages/opentelemetry-exporter-otlp-http/test/node/CollectorMetricExporter.test.ts similarity index 89% rename from packages/opentelemetry-exporter-collector/test/node/CollectorMetricExporter.test.ts rename to packages/opentelemetry-exporter-otlp-http/test/node/CollectorMetricExporter.test.ts index aa906b5bf7..2fd9e04a36 100644 --- a/packages/opentelemetry-exporter-collector/test/node/CollectorMetricExporter.test.ts +++ b/packages/opentelemetry-exporter-otlp-http/test/node/CollectorMetricExporter.test.ts @@ -32,10 +32,10 @@ import * as assert from 'assert'; import * as http from 'http'; import * as sinon from 'sinon'; import { - CollectorExporterNodeConfigBase, - CollectorMetricExporter, + OTLPExporterNodeConfigBase, + OTLPMetricExporter, } from '../../src/platform/node'; -import * as collectorTypes from '../../src/types'; +import * as otlpTypes from '../../src/types'; import { ensureCounterIsCorrect, ensureExportMetricsServiceRequestIsSet, @@ -55,9 +55,9 @@ const fakeRequest = { const address = 'localhost:1501'; -describe('CollectorMetricExporter - node with json over http', () => { - let collectorExporter: CollectorMetricExporter; - let collectorExporterConfig: CollectorExporterNodeConfigBase; +describe('OTLPMetricExporter - node with json over http', () => { + let collectorExporter: OTLPMetricExporter; + let collectorExporterConfig: OTLPExporterNodeConfigBase; let stubRequest: sinon.SinonStub; let stubWrite: sinon.SinonStub; let metrics: MetricRecord[]; @@ -71,7 +71,7 @@ describe('CollectorMetricExporter - node with json over http', () => { const metadata = 'foo'; // Need to stub/spy on the underlying logger as the "diag" instance is global const spyLoggerWarn = sinon.stub(diag, 'warn'); - collectorExporter = new CollectorMetricExporter({ + collectorExporter = new OTLPMetricExporter({ serviceName: 'basic-service', url: address, metadata, @@ -85,7 +85,7 @@ describe('CollectorMetricExporter - node with json over http', () => { const envSource = process.env; it('should use url defined in env', () => { envSource.OTEL_EXPORTER_OTLP_ENDPOINT = 'http://foo.bar/v1/metrics'; - const collectorExporter = new CollectorMetricExporter(); + const collectorExporter = new OTLPMetricExporter(); assert.strictEqual( collectorExporter.url, envSource.OTEL_EXPORTER_OTLP_ENDPOINT @@ -94,7 +94,7 @@ describe('CollectorMetricExporter - node with json over http', () => { }); it('should use url defined in env and append version and signal when not present', () => { envSource.OTEL_EXPORTER_OTLP_ENDPOINT = 'http://foo.bar'; - const collectorExporter = new CollectorMetricExporter(); + const collectorExporter = new OTLPMetricExporter(); assert.strictEqual( collectorExporter.url, `${envSource.OTEL_EXPORTER_OTLP_ENDPOINT}/v1/metrics` @@ -104,7 +104,7 @@ describe('CollectorMetricExporter - node with json over http', () => { it('should override global exporter url with signal url defined in env', () => { envSource.OTEL_EXPORTER_OTLP_ENDPOINT = 'http://foo.bar'; envSource.OTEL_EXPORTER_OTLP_METRICS_ENDPOINT = 'http://foo.metrics'; - const collectorExporter = new CollectorMetricExporter(); + const collectorExporter = new OTLPMetricExporter(); assert.strictEqual( collectorExporter.url, envSource.OTEL_EXPORTER_OTLP_METRICS_ENDPOINT @@ -114,14 +114,14 @@ describe('CollectorMetricExporter - node with json over http', () => { }); it('should use headers defined via env', () => { envSource.OTEL_EXPORTER_OTLP_HEADERS = 'foo=bar'; - const collectorExporter = new CollectorMetricExporter(); + const collectorExporter = new OTLPMetricExporter(); assert.strictEqual(collectorExporter.headers.foo, 'bar'); envSource.OTEL_EXPORTER_OTLP_HEADERS = ''; }); it('should override global headers config with signal headers defined via env', () => { envSource.OTEL_EXPORTER_OTLP_HEADERS = 'foo=bar,bar=foo'; envSource.OTEL_EXPORTER_OTLP_METRICS_HEADERS = 'foo=boo'; - const collectorExporter = new CollectorMetricExporter(); + const collectorExporter = new OTLPMetricExporter(); assert.strictEqual(collectorExporter.headers.foo, 'boo'); assert.strictEqual(collectorExporter.headers.bar, 'foo'); envSource.OTEL_EXPORTER_OTLP_METRICS_HEADERS = ''; @@ -143,7 +143,7 @@ describe('CollectorMetricExporter - node with json over http', () => { keepAlive: true, httpAgentOptions: { keepAliveMsecs: 2000 }, }; - collectorExporter = new CollectorMetricExporter(collectorExporterConfig); + collectorExporter = new OTLPMetricExporter(collectorExporterConfig); // Overwrites the start time to make tests consistent Object.defineProperty(collectorExporter, '_startTime', { value: 1592602232694000000, @@ -212,7 +212,7 @@ describe('CollectorMetricExporter - node with json over http', () => { const writeArgs = stubWrite.args[0]; const json = JSON.parse( writeArgs[0] - ) as collectorTypes.opentelemetryProto.collector.metrics.v1.ExportMetricsServiceRequest; + ) as otlpTypes.opentelemetryProto.collector.metrics.v1.ExportMetricsServiceRequest; const metric1 = json.resourceMetrics[0].instrumentationLibraryMetrics[0].metrics[0]; const metric2 = @@ -286,7 +286,7 @@ describe('CollectorMetricExporter - node with json over http', () => { setTimeout(() => { const result = responseSpy.args[0][0] as core.ExportResult; assert.strictEqual(result.code, core.ExportResultCode.FAILED); - const error = result.error as collectorTypes.CollectorExporterError; + const error = result.error as otlpTypes.OTLPExporterError; assert.ok(error !== undefined); assert.strictEqual(error.code, 400); assert.strictEqual(error.data, 'failed'); @@ -295,9 +295,9 @@ describe('CollectorMetricExporter - node with json over http', () => { }); }); }); - describe('CollectorMetricExporter - node (getDefaultUrl)', () => { + describe('OTLPMetricExporter - node (getDefaultUrl)', () => { it('should default to localhost', done => { - const collectorExporter = new CollectorMetricExporter(); + const collectorExporter = new OTLPMetricExporter(); setTimeout(() => { assert.strictEqual( collectorExporter['url'], @@ -309,7 +309,7 @@ describe('CollectorMetricExporter - node with json over http', () => { it('should keep the URL if included', done => { const url = 'http://foo.bar.com'; - const collectorExporter = new CollectorMetricExporter({ url }); + const collectorExporter = new OTLPMetricExporter({ url }); setTimeout(() => { assert.strictEqual(collectorExporter['url'], url); done(); diff --git a/packages/opentelemetry-exporter-collector/test/node/CollectorTraceExporter.test.ts b/packages/opentelemetry-exporter-otlp-http/test/node/CollectorTraceExporter.test.ts similarity index 88% rename from packages/opentelemetry-exporter-collector/test/node/CollectorTraceExporter.test.ts rename to packages/opentelemetry-exporter-otlp-http/test/node/CollectorTraceExporter.test.ts index b4a9e9367c..7ccf6a97f1 100644 --- a/packages/opentelemetry-exporter-collector/test/node/CollectorTraceExporter.test.ts +++ b/packages/opentelemetry-exporter-otlp-http/test/node/CollectorTraceExporter.test.ts @@ -23,11 +23,11 @@ import * as sinon from 'sinon'; import { PassThrough, Stream } from 'stream'; import * as zlib from 'zlib'; import { - CollectorTraceExporter, - CollectorExporterNodeConfigBase, + OTLPTraceExporter, + OTLPExporterNodeConfigBase, CompressionAlgorithm, } from '../../src/platform/node'; -import * as collectorTypes from '../../src/types'; +import * as otlpTypes from '../../src/types'; import { MockedResponse } from './nodeHelpers'; import { @@ -40,9 +40,9 @@ let fakeRequest: PassThrough; const address = 'localhost:1501'; -describe('CollectorTraceExporter - node with json over http', () => { - let collectorExporter: CollectorTraceExporter; - let collectorExporterConfig: CollectorExporterNodeConfigBase; +describe('OTLPTraceExporter - node with json over http', () => { + let collectorExporter: OTLPTraceExporter; + let collectorExporterConfig: OTLPExporterNodeConfigBase; let stubRequest: sinon.SinonStub; let spySetHeader: sinon.SinonSpy; let spans: ReadableSpan[]; @@ -57,7 +57,7 @@ describe('CollectorTraceExporter - node with json over http', () => { const metadata = 'foo'; // Need to stub/spy on the underlying logger as the "diag" instance is global const spyLoggerWarn = sinon.stub(diag, 'warn'); - collectorExporter = new CollectorTraceExporter({ + collectorExporter = new OTLPTraceExporter({ serviceName: 'basic-service', metadata, url: address, @@ -71,7 +71,7 @@ describe('CollectorTraceExporter - node with json over http', () => { const envSource = process.env; it('should use url defined in env', () => { envSource.OTEL_EXPORTER_OTLP_ENDPOINT = 'http://foo.bar/v1/traces'; - const collectorExporter = new CollectorTraceExporter(); + const collectorExporter = new OTLPTraceExporter(); assert.strictEqual( collectorExporter.url, envSource.OTEL_EXPORTER_OTLP_ENDPOINT @@ -80,7 +80,7 @@ describe('CollectorTraceExporter - node with json over http', () => { }); it('should use url defined in env and append version and signal when not present', () => { envSource.OTEL_EXPORTER_OTLP_ENDPOINT = 'http://foo.bar'; - const collectorExporter = new CollectorTraceExporter(); + const collectorExporter = new OTLPTraceExporter(); assert.strictEqual( collectorExporter.url, `${envSource.OTEL_EXPORTER_OTLP_ENDPOINT}/v1/traces` @@ -90,7 +90,7 @@ describe('CollectorTraceExporter - node with json over http', () => { it('should override global exporter url with signal url defined in env', () => { envSource.OTEL_EXPORTER_OTLP_ENDPOINT = 'http://foo.bar'; envSource.OTEL_EXPORTER_OTLP_TRACES_ENDPOINT = 'http://foo.traces'; - const collectorExporter = new CollectorTraceExporter(); + const collectorExporter = new OTLPTraceExporter(); assert.strictEqual( collectorExporter.url, envSource.OTEL_EXPORTER_OTLP_TRACES_ENDPOINT @@ -100,14 +100,14 @@ describe('CollectorTraceExporter - node with json over http', () => { }); it('should use headers defined via env', () => { envSource.OTEL_EXPORTER_OTLP_HEADERS = 'foo=bar'; - const collectorExporter = new CollectorTraceExporter(); + const collectorExporter = new OTLPTraceExporter(); assert.strictEqual(collectorExporter.headers.foo, 'bar'); envSource.OTEL_EXPORTER_OTLP_HEADERS = ''; }); it('should override global headers config with signal headers defined via env', () => { envSource.OTEL_EXPORTER_OTLP_HEADERS = 'foo=bar,bar=foo'; envSource.OTEL_EXPORTER_OTLP_TRACES_HEADERS = 'foo=boo'; - const collectorExporter = new CollectorTraceExporter(); + const collectorExporter = new OTLPTraceExporter(); assert.strictEqual(collectorExporter.headers.foo, 'boo'); assert.strictEqual(collectorExporter.headers.bar, 'foo'); envSource.OTEL_EXPORTER_OTLP_TRACES_HEADERS = ''; @@ -128,7 +128,7 @@ describe('CollectorTraceExporter - node with json over http', () => { keepAlive: true, httpAgentOptions: { keepAliveMsecs: 2000 }, }; - collectorExporter = new CollectorTraceExporter(collectorExporterConfig); + collectorExporter = new OTLPTraceExporter(collectorExporterConfig); spans = []; spans.push(Object.assign({}, mockedReadableSpan)); }); @@ -203,7 +203,7 @@ describe('CollectorTraceExporter - node with json over http', () => { const json = JSON.parse( responseBody - ) as collectorTypes.opentelemetryProto.collector.trace.v1.ExportTraceServiceRequest; + ) as otlpTypes.opentelemetryProto.collector.trace.v1.ExportTraceServiceRequest; const span1 = json.resourceSpans[0].instrumentationLibrarySpans[0].spans[0]; assert.ok(typeof span1 !== 'undefined', "span doesn't exist"); @@ -259,7 +259,7 @@ describe('CollectorTraceExporter - node with json over http', () => { setTimeout(() => { const result = responseSpy.args[0][0] as core.ExportResult; assert.strictEqual(result.code, core.ExportResultCode.FAILED); - const error = result.error as collectorTypes.CollectorExporterError; + const error = result.error as otlpTypes.OTLPExporterError; assert.ok(error !== undefined); assert.strictEqual(error.code, 400); assert.strictEqual(error.data, 'failed'); @@ -285,7 +285,7 @@ describe('CollectorTraceExporter - node with json over http', () => { compression: CompressionAlgorithm.GZIP, httpAgentOptions: { keepAliveMsecs: 2000 }, }; - collectorExporter = new CollectorTraceExporter(collectorExporterConfig); + collectorExporter = new OTLPTraceExporter(collectorExporterConfig); spans = []; spans.push(Object.assign({}, mockedReadableSpan)); }); @@ -299,7 +299,7 @@ describe('CollectorTraceExporter - node with json over http', () => { const json = JSON.parse( responseBody - ) as collectorTypes.opentelemetryProto.collector.trace.v1.ExportTraceServiceRequest; + ) as otlpTypes.opentelemetryProto.collector.trace.v1.ExportTraceServiceRequest; const span1 = json.resourceSpans[0].instrumentationLibrarySpans[0].spans[0]; assert.ok(typeof span1 !== 'undefined', "span doesn't exist"); @@ -320,9 +320,9 @@ describe('CollectorTraceExporter - node with json over http', () => { }); - describe('CollectorTraceExporter - node (getDefaultUrl)', () => { + describe('OTLPTraceExporter - node (getDefaultUrl)', () => { it('should default to localhost', done => { - const collectorExporter = new CollectorTraceExporter(); + const collectorExporter = new OTLPTraceExporter(); setTimeout(() => { assert.strictEqual( collectorExporter['url'], @@ -334,7 +334,7 @@ describe('CollectorTraceExporter - node with json over http', () => { it('should keep the URL if included', done => { const url = 'http://foo.bar.com'; - const collectorExporter = new CollectorTraceExporter({ url }); + const collectorExporter = new OTLPTraceExporter({ url }); setTimeout(() => { assert.strictEqual(collectorExporter['url'], url); done(); diff --git a/packages/opentelemetry-exporter-collector/test/node/nodeHelpers.ts b/packages/opentelemetry-exporter-otlp-http/test/node/nodeHelpers.ts similarity index 100% rename from packages/opentelemetry-exporter-collector/test/node/nodeHelpers.ts rename to packages/opentelemetry-exporter-otlp-http/test/node/nodeHelpers.ts diff --git a/packages/opentelemetry-exporter-collector/tsconfig.esm.json b/packages/opentelemetry-exporter-otlp-http/tsconfig.esm.json similarity index 100% rename from packages/opentelemetry-exporter-collector/tsconfig.esm.json rename to packages/opentelemetry-exporter-otlp-http/tsconfig.esm.json diff --git a/packages/opentelemetry-exporter-collector/tsconfig.json b/packages/opentelemetry-exporter-otlp-http/tsconfig.json similarity index 100% rename from packages/opentelemetry-exporter-collector/tsconfig.json rename to packages/opentelemetry-exporter-otlp-http/tsconfig.json diff --git a/packages/opentelemetry-exporter-collector/.eslintignore b/packages/opentelemetry-exporter-otlp-proto/.eslintignore similarity index 100% rename from packages/opentelemetry-exporter-collector/.eslintignore rename to packages/opentelemetry-exporter-otlp-proto/.eslintignore diff --git a/packages/opentelemetry-exporter-collector-proto/.eslintrc.js b/packages/opentelemetry-exporter-otlp-proto/.eslintrc.js similarity index 100% rename from packages/opentelemetry-exporter-collector-proto/.eslintrc.js rename to packages/opentelemetry-exporter-otlp-proto/.eslintrc.js diff --git a/packages/opentelemetry-exporter-collector/.npmignore b/packages/opentelemetry-exporter-otlp-proto/.npmignore similarity index 100% rename from packages/opentelemetry-exporter-collector/.npmignore rename to packages/opentelemetry-exporter-otlp-proto/.npmignore diff --git a/packages/opentelemetry-exporter-collector/LICENSE b/packages/opentelemetry-exporter-otlp-proto/LICENSE similarity index 100% rename from packages/opentelemetry-exporter-collector/LICENSE rename to packages/opentelemetry-exporter-otlp-proto/LICENSE diff --git a/packages/opentelemetry-exporter-collector-proto/README.md b/packages/opentelemetry-exporter-otlp-proto/README.md similarity index 84% rename from packages/opentelemetry-exporter-collector-proto/README.md rename to packages/opentelemetry-exporter-otlp-proto/README.md index 3ed53c555b..55b14756ab 100644 --- a/packages/opentelemetry-exporter-collector-proto/README.md +++ b/packages/opentelemetry-exporter-otlp-proto/README.md @@ -10,7 +10,7 @@ This module provides exporter for node to be used with [opentelemetry-collector] ## Installation ```bash -npm install --save @opentelemetry/exporter-collector-proto +npm install --save @opentelemetry/exporter-otlp-proto ``` ## Service Name @@ -22,7 +22,7 @@ In order to set the service name, use the `service.name` resource attribute as p ```js const { BasicTracerProvider, SimpleSpanProcessor } = require('@opentelemetry/sdk-trace-base'); -const { CollectorTraceExporter } = require('@opentelemetry/exporter-collector-proto'); +const { OTLPTraceExporter } = require('@opentelemetry/exporter-otlp-proto'); const collectorOptions = { url: '', // url is optional and can be omitted - default is http://localhost:55681/v1/traces @@ -32,7 +32,7 @@ const collectorOptions = { }; const provider = new BasicTracerProvider(); -const exporter = new CollectorTraceExporter(collectorOptions); +const exporter = new OTLPTraceExporter(collectorOptions); provider.addSpanProcessor(new SimpleSpanProcessor(exporter)); provider.register(); @@ -43,11 +43,11 @@ provider.register(); ```js const { MeterProvider } = require('@opentelemetry/sdk-metrics-base'); -const { CollectorMetricExporter } = require('@opentelemetry/exporter-collector-proto'); +const { OTLPMetricExporter } = require('@opentelemetry/exporter-otlp-proto'); const collectorOptions = { url: '', // url is optional and can be omitted - default is http://localhost:55681/v1/metrics }; -const exporter = new CollectorMetricExporter(collectorOptions); +const exporter = new OTLPMetricExporter(collectorOptions); // Register the exporter const meter = new MeterProvider({ @@ -63,7 +63,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 @@ -80,11 +80,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-proto -[dependencies-url]: https://david-dm.org/open-telemetry/opentelemetry-js?path=packages%2Fopentelemetry-exporter-collector-proto -[devDependencies-image]: https://status.david-dm.org/gh/open-telemetry/opentelemetry-js.svg?path=packages%2Fopentelemetry-exporter-collector-proto&type=dev -[devDependencies-url]: https://david-dm.org/open-telemetry/opentelemetry-js?path=packages%2Fopentelemetry-exporter-collector-proto&type=dev -[npm-url]: https://www.npmjs.com/package/@opentelemetry/exporter-collector-proto +[dependencies-image]: https://status.david-dm.org/gh/open-telemetry/opentelemetry-js.svg?path=packages%2Fopentelemetry-exporter-otlp-proto +[dependencies-url]: https://david-dm.org/open-telemetry/opentelemetry-js?path=packages%2Fopentelemetry-exporter-otlp-proto +[devDependencies-image]: https://status.david-dm.org/gh/open-telemetry/opentelemetry-js.svg?path=packages%2Fopentelemetry-exporter-otlp-proto&type=dev +[devDependencies-url]: https://david-dm.org/open-telemetry/opentelemetry-js?path=packages%2Fopentelemetry-exporter-otlp-proto&type=dev +[npm-url]: https://www.npmjs.com/package/@opentelemetry/exporter-otlp-proto [npm-img]: https://badge.fury.io/js/%40opentelemetry%2Fexporter-collector-proto.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 diff --git a/packages/opentelemetry-exporter-collector-proto/package.json b/packages/opentelemetry-exporter-otlp-proto/package.json similarity index 92% rename from packages/opentelemetry-exporter-collector-proto/package.json rename to packages/opentelemetry-exporter-otlp-proto/package.json index a5fd8ab5bc..b890fd32d9 100644 --- a/packages/opentelemetry-exporter-collector-proto/package.json +++ b/packages/opentelemetry-exporter-otlp-proto/package.json @@ -1,7 +1,7 @@ { - "name": "@opentelemetry/exporter-collector-proto", + "name": "@opentelemetry/exporter-otlp-proto", "version": "0.25.0", - "description": "OpenTelemetry Collector Exporter allows user to send collected traces to the OpenTelemetry Collector", + "description": "OpenTelemetry Collector Exporter allows user to send collected traces to the OpenTelemetry Collector using protobuf over HTTP", "main": "build/src/index.js", "types": "build/src/index.d.ts", "repository": "open-telemetry/opentelemetry-js", @@ -69,7 +69,7 @@ "dependencies": { "@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", diff --git a/packages/opentelemetry-exporter-collector-proto/protos b/packages/opentelemetry-exporter-otlp-proto/protos similarity index 100% rename from packages/opentelemetry-exporter-collector-proto/protos rename to packages/opentelemetry-exporter-otlp-proto/protos diff --git a/packages/opentelemetry-exporter-collector-proto/src/CollectorExporterNodeBase.ts b/packages/opentelemetry-exporter-otlp-proto/src/OTLPExporterNodeBase.ts similarity index 77% rename from packages/opentelemetry-exporter-collector-proto/src/CollectorExporterNodeBase.ts rename to packages/opentelemetry-exporter-otlp-proto/src/OTLPExporterNodeBase.ts index 9ff36306b7..5cb553a5c0 100644 --- a/packages/opentelemetry-exporter-collector-proto/src/CollectorExporterNodeBase.ts +++ b/packages/opentelemetry-exporter-otlp-proto/src/OTLPExporterNodeBase.ts @@ -16,36 +16,36 @@ import { diag } from '@opentelemetry/api'; import { - CollectorExporterNodeBase as CollectorExporterBaseMain, - collectorTypes, - CollectorExporterNodeConfigBase, + OTLPExporterNodeBase as OTLPExporterBaseMain, + otlpTypes, + OTLPExporterNodeConfigBase, CompressionAlgorithm, -} from '@opentelemetry/exporter-collector'; +} from '@opentelemetry/exporter-otlp-http'; import { ServiceClientType } from './types'; -type SendFn = (collector: CollectorExporterNodeBase, +type SendFn = (collector: OTLPExporterNodeBase, objects: ExportItem[], compression: CompressionAlgorithm, onSuccess: () => void, - onError: (error: collectorTypes.CollectorExporterError) => void) => void; + onError: (error: otlpTypes.OTLPExporterError) => void) => void; /** * Collector Metric Exporter abstract base class */ -export abstract class CollectorExporterNodeBase< +export abstract class OTLPExporterNodeBase< ExportItem, ServiceRequest -> extends CollectorExporterBaseMain { +> extends OTLPExporterBaseMain { private _send!: SendFn; - constructor(config: CollectorExporterNodeConfigBase = {}) { + constructor(config: OTLPExporterNodeConfigBase = {}) { super(config) } private _sendPromise( objects: ExportItem[], onSuccess: () => void, - onError: (error: collectorTypes.CollectorExporterError) => void + onError: (error: otlpTypes.OTLPExporterError) => void ): void { const promise = new Promise((resolve, reject) => { this._send(this, objects, this.compression, resolve, reject); @@ -60,7 +60,7 @@ export abstract class CollectorExporterNodeBase< promise.then(popPromise, popPromise); } - override onInit(config: CollectorExporterNodeConfigBase): void { + override onInit(config: OTLPExporterNodeConfigBase): void { this._isShutdown = false; // defer to next tick and lazy load to avoid loading protobufjs too early // and making this impossible to be instrumented @@ -74,7 +74,7 @@ export abstract class CollectorExporterNodeBase< override send( objects: ExportItem[], onSuccess: () => void, - onError: (error: collectorTypes.CollectorExporterError) => void + onError: (error: otlpTypes.OTLPExporterError) => void ): void { if (this._isShutdown) { diag.debug('Shutdown already started. Cannot send objects'); diff --git a/packages/opentelemetry-exporter-collector-proto/src/CollectorMetricExporter.ts b/packages/opentelemetry-exporter-otlp-proto/src/OTLPMetricExporter.ts similarity index 73% rename from packages/opentelemetry-exporter-collector-proto/src/CollectorMetricExporter.ts rename to packages/opentelemetry-exporter-otlp-proto/src/OTLPMetricExporter.ts index cffbdec9f9..bd1bc75c17 100644 --- a/packages/opentelemetry-exporter-collector-proto/src/CollectorMetricExporter.ts +++ b/packages/opentelemetry-exporter-otlp-proto/src/OTLPMetricExporter.ts @@ -15,32 +15,32 @@ */ import { - collectorTypes, - toCollectorExportMetricServiceRequest, - CollectorExporterNodeConfigBase, + otlpTypes, + toOTLPExportMetricServiceRequest, + OTLPExporterNodeConfigBase, appendResourcePathToUrlIfNotPresent, -} from '@opentelemetry/exporter-collector'; +} from '@opentelemetry/exporter-otlp-http'; import { MetricRecord, MetricExporter } from '@opentelemetry/sdk-metrics-base'; import { ServiceClientType } from './types'; -import { CollectorExporterNodeBase } from './CollectorExporterNodeBase'; +import { OTLPExporterNodeBase } from './OTLPExporterNodeBase'; import { getEnv, baggageUtils } from '@opentelemetry/core'; const DEFAULT_COLLECTOR_RESOURCE_PATH = '/v1/metrics'; const DEFAULT_COLLECTOR_URL=`http://localhost:55681${DEFAULT_COLLECTOR_RESOURCE_PATH}`; /** - * Collector Metric Exporter for Node with protobuf + * OTLP Metric Exporter for Node with protobuf */ -export class CollectorMetricExporter - extends CollectorExporterNodeBase< +export class OTLPMetricExporter + extends OTLPExporterNodeBase< MetricRecord, - collectorTypes.opentelemetryProto.collector.metrics.v1.ExportMetricsServiceRequest + otlpTypes.opentelemetryProto.collector.metrics.v1.ExportMetricsServiceRequest > implements MetricExporter { // Converts time to nanoseconds protected readonly _startTime = new Date().getTime() * 1000000; - constructor(config: CollectorExporterNodeConfigBase = {}) { + constructor(config: OTLPExporterNodeConfigBase = {}) { super(config); this.headers = Object.assign( this.headers, @@ -52,15 +52,15 @@ export class CollectorMetricExporter convert( metrics: MetricRecord[] - ): collectorTypes.opentelemetryProto.collector.metrics.v1.ExportMetricsServiceRequest { - return toCollectorExportMetricServiceRequest( + ): otlpTypes.opentelemetryProto.collector.metrics.v1.ExportMetricsServiceRequest { + return toOTLPExportMetricServiceRequest( metrics, this._startTime, this ); } - getDefaultUrl(config: CollectorExporterNodeConfigBase) { + getDefaultUrl(config: OTLPExporterNodeConfigBase) { return typeof config.url === 'string' ? config.url : getEnv().OTEL_EXPORTER_OTLP_METRICS_ENDPOINT.length > 0 diff --git a/packages/opentelemetry-exporter-collector-proto/src/CollectorTraceExporter.ts b/packages/opentelemetry-exporter-otlp-proto/src/OTLPTraceExporter.ts similarity index 73% rename from packages/opentelemetry-exporter-collector-proto/src/CollectorTraceExporter.ts rename to packages/opentelemetry-exporter-otlp-proto/src/OTLPTraceExporter.ts index 561890d04e..1e2f8d7af4 100644 --- a/packages/opentelemetry-exporter-collector-proto/src/CollectorTraceExporter.ts +++ b/packages/opentelemetry-exporter-otlp-proto/src/OTLPTraceExporter.ts @@ -15,13 +15,13 @@ */ import { ReadableSpan, SpanExporter } from '@opentelemetry/sdk-trace-base'; -import { CollectorExporterNodeBase } from './CollectorExporterNodeBase'; +import { OTLPExporterNodeBase } from './OTLPExporterNodeBase'; import { - collectorTypes, - toCollectorExportTraceServiceRequest, - CollectorExporterNodeConfigBase, + otlpTypes, + toOTLPExportTraceServiceRequest, + OTLPExporterNodeConfigBase, appendResourcePathToUrlIfNotPresent, -} from '@opentelemetry/exporter-collector'; +} from '@opentelemetry/exporter-otlp-http'; import { ServiceClientType } from './types'; import { getEnv, baggageUtils } from '@opentelemetry/core'; @@ -31,13 +31,13 @@ const DEFAULT_COLLECTOR_URL=`http://localhost:55681${DEFAULT_COLLECTOR_RESOURCE_ /** * Collector Trace Exporter for Node with protobuf */ -export class CollectorTraceExporter - extends CollectorExporterNodeBase< +export class OTLPTraceExporter + extends OTLPExporterNodeBase< ReadableSpan, - collectorTypes.opentelemetryProto.collector.trace.v1.ExportTraceServiceRequest + otlpTypes.opentelemetryProto.collector.trace.v1.ExportTraceServiceRequest > implements SpanExporter { - constructor(config: CollectorExporterNodeConfigBase = {}) { + constructor(config: OTLPExporterNodeConfigBase = {}) { super(config); this.headers = Object.assign( this.headers, @@ -49,11 +49,11 @@ export class CollectorTraceExporter convert( spans: ReadableSpan[] - ): collectorTypes.opentelemetryProto.collector.trace.v1.ExportTraceServiceRequest { - return toCollectorExportTraceServiceRequest(spans, this); + ): otlpTypes.opentelemetryProto.collector.trace.v1.ExportTraceServiceRequest { + return toOTLPExportTraceServiceRequest(spans, this); } - getDefaultUrl(config: CollectorExporterNodeConfigBase) { + getDefaultUrl(config: OTLPExporterNodeConfigBase) { return typeof config.url === 'string' ? config.url : getEnv().OTEL_EXPORTER_OTLP_TRACES_ENDPOINT.length > 0 diff --git a/packages/opentelemetry-exporter-collector/src/platform/browser/index.ts b/packages/opentelemetry-exporter-otlp-proto/src/index.ts similarity index 87% rename from packages/opentelemetry-exporter-collector/src/platform/browser/index.ts rename to packages/opentelemetry-exporter-otlp-proto/src/index.ts index fcbe012b52..d54490a7ea 100644 --- a/packages/opentelemetry-exporter-collector/src/platform/browser/index.ts +++ b/packages/opentelemetry-exporter-otlp-proto/src/index.ts @@ -14,5 +14,5 @@ * limitations under the License. */ -export * from './CollectorTraceExporter'; -export * from './CollectorMetricExporter'; +export * from './OTLPTraceExporter'; +export * from './OTLPMetricExporter'; diff --git a/packages/opentelemetry-exporter-collector-proto/src/types.ts b/packages/opentelemetry-exporter-otlp-proto/src/types.ts similarity index 100% rename from packages/opentelemetry-exporter-collector-proto/src/types.ts rename to packages/opentelemetry-exporter-otlp-proto/src/types.ts diff --git a/packages/opentelemetry-exporter-collector-proto/src/util.ts b/packages/opentelemetry-exporter-otlp-proto/src/util.ts similarity index 83% rename from packages/opentelemetry-exporter-collector-proto/src/util.ts rename to packages/opentelemetry-exporter-otlp-proto/src/util.ts index e7f3aeb004..d019afde80 100644 --- a/packages/opentelemetry-exporter-collector-proto/src/util.ts +++ b/packages/opentelemetry-exporter-otlp-proto/src/util.ts @@ -15,15 +15,15 @@ */ import { - collectorTypes, + otlpTypes, sendWithHttp, - CollectorExporterNodeConfigBase, + OTLPExporterNodeConfigBase, CompressionAlgorithm, -} from '@opentelemetry/exporter-collector'; +} from '@opentelemetry/exporter-otlp-http'; import * as path from 'path'; import { ServiceClientType } from './types'; -import { CollectorExporterNodeBase } from './CollectorExporterNodeBase'; +import { OTLPExporterNodeBase } from './OTLPExporterNodeBase'; import type { Type } from 'protobufjs'; import * as protobufjs from 'protobufjs'; @@ -34,8 +34,8 @@ export function getExportRequestProto(): Type | undefined { } export function onInit( - collector: CollectorExporterNodeBase, - _config: CollectorExporterNodeConfigBase + collector: OTLPExporterNodeBase, + _config: OTLPExporterNodeConfigBase ): void { const dir = path.resolve(__dirname, '..', 'protos'); const root = new protobufjs.Root(); @@ -62,11 +62,11 @@ export function onInit( } export function send( - collector: CollectorExporterNodeBase, + collector: OTLPExporterNodeBase, objects: ExportItem[], compression: CompressionAlgorithm, onSuccess: () => void, - onError: (error: collectorTypes.CollectorExporterError) => void + onError: (error: otlpTypes.OTLPExporterError) => void ): void { const serviceRequest = collector.convert(objects); @@ -83,6 +83,6 @@ export function send( ); } } else { - onError(new collectorTypes.CollectorExporterError('No proto')); + onError(new otlpTypes.OTLPExporterError('No proto')); } } \ No newline at end of file diff --git a/packages/opentelemetry-exporter-collector-proto/submodule.md b/packages/opentelemetry-exporter-otlp-proto/submodule.md similarity index 100% rename from packages/opentelemetry-exporter-collector-proto/submodule.md rename to packages/opentelemetry-exporter-otlp-proto/submodule.md diff --git a/packages/opentelemetry-exporter-collector-proto/test/CollectorMetricExporter.test.ts b/packages/opentelemetry-exporter-otlp-proto/test/OTLPMetricExporter.test.ts similarity index 90% rename from packages/opentelemetry-exporter-collector-proto/test/CollectorMetricExporter.test.ts rename to packages/opentelemetry-exporter-otlp-proto/test/OTLPMetricExporter.test.ts index 86546a3527..17716f0887 100644 --- a/packages/opentelemetry-exporter-collector-proto/test/CollectorMetricExporter.test.ts +++ b/packages/opentelemetry-exporter-otlp-proto/test/OTLPMetricExporter.test.ts @@ -22,14 +22,14 @@ import { } from '@opentelemetry/api-metrics'; import { ExportResultCode } from '@opentelemetry/core'; import { - CollectorExporterNodeConfigBase, - collectorTypes, -} from '@opentelemetry/exporter-collector'; + OTLPExporterNodeConfigBase, + otlpTypes, +} from '@opentelemetry/exporter-otlp-http'; import * as metrics from '@opentelemetry/sdk-metrics-base'; import * as assert from 'assert'; import * as http from 'http'; import * as sinon from 'sinon'; -import { CollectorMetricExporter } from '../src'; +import { OTLPMetricExporter } from '../src'; import { getExportRequestProto } from '../src/util'; import { ensureExportedCounterIsCorrect, @@ -48,16 +48,16 @@ const fakeRequest = { write: function () {}, }; -describe('CollectorMetricExporter - node with proto over http', () => { - let collectorExporter: CollectorMetricExporter; - let collectorExporterConfig: CollectorExporterNodeConfigBase; +describe('OTLPMetricExporter - node with proto over http', () => { + let collectorExporter: OTLPMetricExporter; + let collectorExporterConfig: OTLPExporterNodeConfigBase; let metrics: metrics.MetricRecord[]; describe('when configuring via environment', () => { const envSource = process.env; it('should use url defined in env', () => { envSource.OTEL_EXPORTER_OTLP_ENDPOINT = 'http://foo.bar/v1/metrics'; - const collectorExporter = new CollectorMetricExporter(); + const collectorExporter = new OTLPMetricExporter(); assert.strictEqual( collectorExporter.url, envSource.OTEL_EXPORTER_OTLP_ENDPOINT @@ -66,7 +66,7 @@ describe('CollectorMetricExporter - node with proto over http', () => { }); it('should use url defined in env and append version and signal when not present', () => { envSource.OTEL_EXPORTER_OTLP_ENDPOINT = 'http://foo.bar'; - const collectorExporter = new CollectorMetricExporter(); + const collectorExporter = new OTLPMetricExporter(); assert.strictEqual( collectorExporter.url, `${envSource.OTEL_EXPORTER_OTLP_ENDPOINT}/v1/metrics` @@ -76,7 +76,7 @@ describe('CollectorMetricExporter - node with proto over http', () => { it('should override global exporter url with signal url defined in env', () => { envSource.OTEL_EXPORTER_OTLP_ENDPOINT = 'http://foo.bar'; envSource.OTEL_EXPORTER_OTLP_METRICS_ENDPOINT = 'http://foo.metrics'; - const collectorExporter = new CollectorMetricExporter(); + const collectorExporter = new OTLPMetricExporter(); assert.strictEqual( collectorExporter.url, envSource.OTEL_EXPORTER_OTLP_METRICS_ENDPOINT @@ -86,14 +86,14 @@ describe('CollectorMetricExporter - node with proto over http', () => { }); it('should use headers defined via env', () => { envSource.OTEL_EXPORTER_OTLP_HEADERS = 'foo=bar'; - const collectorExporter = new CollectorMetricExporter(); + const collectorExporter = new OTLPMetricExporter(); assert.strictEqual(collectorExporter.headers.foo, 'bar'); envSource.OTEL_EXPORTER_OTLP_HEADERS = ''; }); it('should override global headers config with signal headers defined via env', () => { envSource.OTEL_EXPORTER_OTLP_HEADERS = 'foo=bar,bar=foo'; envSource.OTEL_EXPORTER_OTLP_METRICS_HEADERS = 'foo=boo'; - const collectorExporter = new CollectorMetricExporter(); + const collectorExporter = new OTLPMetricExporter(); assert.strictEqual(collectorExporter.headers.foo, 'boo'); assert.strictEqual(collectorExporter.headers.bar, 'foo'); envSource.OTEL_EXPORTER_OTLP_METRICS_HEADERS = ''; @@ -113,7 +113,7 @@ describe('CollectorMetricExporter - node with proto over http', () => { keepAlive: true, httpAgentOptions: { keepAliveMsecs: 2000 }, }; - collectorExporter = new CollectorMetricExporter(collectorExporterConfig); + collectorExporter = new OTLPMetricExporter(collectorExporterConfig); // Overwrites the start time to make tests consistent Object.defineProperty(collectorExporter, '_startTime', { value: 1592602232694000000, @@ -183,7 +183,7 @@ describe('CollectorMetricExporter - node with proto over http', () => { write: (...writeArgs: any[]) => { const ExportTraceServiceRequestProto = getExportRequestProto(); const data = ExportTraceServiceRequestProto?.decode(writeArgs[0]); - const json = data?.toJSON() as collectorTypes.opentelemetryProto.collector.metrics.v1.ExportMetricsServiceRequest; + const json = data?.toJSON() as otlpTypes.opentelemetryProto.collector.metrics.v1.ExportMetricsServiceRequest; const metric1 = json.resourceMetrics[0].instrumentationLibraryMetrics[0].metrics[0]; diff --git a/packages/opentelemetry-exporter-collector-proto/test/CollectorTraceExporter.test.ts b/packages/opentelemetry-exporter-otlp-proto/test/OTLPTraceExporter.test.ts similarity index 88% rename from packages/opentelemetry-exporter-collector-proto/test/CollectorTraceExporter.test.ts rename to packages/opentelemetry-exporter-otlp-proto/test/OTLPTraceExporter.test.ts index 1218d52785..cf4676f9b5 100644 --- a/packages/opentelemetry-exporter-collector-proto/test/CollectorTraceExporter.test.ts +++ b/packages/opentelemetry-exporter-otlp-proto/test/OTLPTraceExporter.test.ts @@ -17,17 +17,17 @@ import { diag } from '@opentelemetry/api'; import { ExportResultCode } from '@opentelemetry/core'; import { - CollectorExporterNodeConfigBase, - collectorTypes, + OTLPExporterNodeConfigBase, + otlpTypes, CompressionAlgorithm, -} from '@opentelemetry/exporter-collector'; +} from '@opentelemetry/exporter-otlp-http'; import { ReadableSpan } from '@opentelemetry/sdk-trace-base'; import * as assert from 'assert'; import * as http from 'http'; import * as sinon from 'sinon'; import { Stream } from 'stream'; import * as zlib from 'zlib'; -import { CollectorTraceExporter } from '../src'; +import { OTLPTraceExporter } from '../src'; import { getExportRequestProto } from '../src/util'; import { ensureExportTraceServiceRequestIsSet, @@ -42,16 +42,16 @@ const fakeRequest = { write: function () { }, }; -describe('CollectorTraceExporter - node with proto over http', () => { - let collectorExporter: CollectorTraceExporter; - let collectorExporterConfig: CollectorExporterNodeConfigBase; +describe('OTLPTraceExporter - node with proto over http', () => { + let collectorExporter: OTLPTraceExporter; + let collectorExporterConfig: OTLPExporterNodeConfigBase; let spans: ReadableSpan[]; describe('when configuring via environment', () => { const envSource = process.env; it('should use url defined in env', () => { envSource.OTEL_EXPORTER_OTLP_ENDPOINT = 'http://foo.bar/v1/traces'; - const collectorExporter = new CollectorTraceExporter(); + const collectorExporter = new OTLPTraceExporter(); assert.strictEqual( collectorExporter.url, envSource.OTEL_EXPORTER_OTLP_ENDPOINT @@ -60,7 +60,7 @@ describe('CollectorTraceExporter - node with proto over http', () => { }); it('should use url defined in env and append version and signal when not present', () => { envSource.OTEL_EXPORTER_OTLP_ENDPOINT = 'http://foo.bar'; - const collectorExporter = new CollectorTraceExporter(); + const collectorExporter = new OTLPTraceExporter(); assert.strictEqual( collectorExporter.url, `${envSource.OTEL_EXPORTER_OTLP_ENDPOINT}/v1/traces` @@ -70,7 +70,7 @@ describe('CollectorTraceExporter - node with proto over http', () => { it('should override global exporter url with signal url defined in env', () => { envSource.OTEL_EXPORTER_OTLP_ENDPOINT = 'http://foo.bar'; envSource.OTEL_EXPORTER_OTLP_TRACES_ENDPOINT = 'http://foo.traces'; - const collectorExporter = new CollectorTraceExporter(); + const collectorExporter = new OTLPTraceExporter(); assert.strictEqual( collectorExporter.url, envSource.OTEL_EXPORTER_OTLP_TRACES_ENDPOINT @@ -80,14 +80,14 @@ describe('CollectorTraceExporter - node with proto over http', () => { }); it('should use headers defined via env', () => { envSource.OTEL_EXPORTER_OTLP_HEADERS = 'foo=bar'; - const collectorExporter = new CollectorTraceExporter(); + const collectorExporter = new OTLPTraceExporter(); assert.strictEqual(collectorExporter.headers.foo, 'bar'); envSource.OTEL_EXPORTER_OTLP_HEADERS = ''; }); it('should override global headers config with signal headers defined via env', () => { envSource.OTEL_EXPORTER_OTLP_HEADERS = 'foo=bar,bar=foo'; envSource.OTEL_EXPORTER_OTLP_TRACES_HEADERS = 'foo=boo'; - const collectorExporter = new CollectorTraceExporter(); + const collectorExporter = new OTLPTraceExporter(); assert.strictEqual(collectorExporter.headers.foo, 'boo'); assert.strictEqual(collectorExporter.headers.bar, 'foo'); envSource.OTEL_EXPORTER_OTLP_TRACES_HEADERS = ''; @@ -107,7 +107,7 @@ describe('CollectorTraceExporter - node with proto over http', () => { keepAlive: true, httpAgentOptions: { keepAliveMsecs: 2000 }, }; - collectorExporter = new CollectorTraceExporter(collectorExporterConfig); + collectorExporter = new OTLPTraceExporter(collectorExporterConfig); spans = []; spans.push(Object.assign({}, mockedReadableSpan)); }); @@ -156,7 +156,7 @@ describe('CollectorTraceExporter - node with proto over http', () => { fakeRequest.on('end', () => { const ExportTraceServiceRequestProto = getExportRequestProto(); const data = ExportTraceServiceRequestProto?.decode(buff); - const json = data?.toJSON() as collectorTypes.opentelemetryProto.collector.trace.v1.ExportTraceServiceRequest; + const json = data?.toJSON() as otlpTypes.opentelemetryProto.collector.trace.v1.ExportTraceServiceRequest; const span1 = json.resourceSpans[0].instrumentationLibrarySpans[0].spans[0]; assert.ok(typeof span1 !== 'undefined', "span doesn't exist"); @@ -224,7 +224,7 @@ describe('CollectorTraceExporter - node with proto over http', () => { compression: CompressionAlgorithm.GZIP, httpAgentOptions: { keepAliveMsecs: 2000 }, }; - collectorExporter = new CollectorTraceExporter(collectorExporterConfig); + collectorExporter = new OTLPTraceExporter(collectorExporterConfig); spans = []; spans.push(Object.assign({}, mockedReadableSpan)); }); @@ -243,7 +243,7 @@ describe('CollectorTraceExporter - node with proto over http', () => { const unzippedBuff = zlib.gunzipSync(buff); const ExportTraceServiceRequestProto = getExportRequestProto(); const data = ExportTraceServiceRequestProto?.decode(unzippedBuff); - const json = data?.toJSON() as collectorTypes.opentelemetryProto.collector.trace.v1.ExportTraceServiceRequest; + const json = data?.toJSON() as otlpTypes.opentelemetryProto.collector.trace.v1.ExportTraceServiceRequest; const span1 = json.resourceSpans[0].instrumentationLibrarySpans[0].spans[0]; assert.ok(typeof span1 !== 'undefined', "span doesn't exist"); diff --git a/packages/opentelemetry-exporter-collector-proto/test/certs/ca.crt b/packages/opentelemetry-exporter-otlp-proto/test/certs/ca.crt similarity index 100% rename from packages/opentelemetry-exporter-collector-proto/test/certs/ca.crt rename to packages/opentelemetry-exporter-otlp-proto/test/certs/ca.crt diff --git a/packages/opentelemetry-exporter-collector-proto/test/certs/ca.key b/packages/opentelemetry-exporter-otlp-proto/test/certs/ca.key similarity index 100% rename from packages/opentelemetry-exporter-collector-proto/test/certs/ca.key rename to packages/opentelemetry-exporter-otlp-proto/test/certs/ca.key diff --git a/packages/opentelemetry-exporter-collector-proto/test/certs/client.crt b/packages/opentelemetry-exporter-otlp-proto/test/certs/client.crt similarity index 100% rename from packages/opentelemetry-exporter-collector-proto/test/certs/client.crt rename to packages/opentelemetry-exporter-otlp-proto/test/certs/client.crt diff --git a/packages/opentelemetry-exporter-collector-proto/test/certs/client.csr b/packages/opentelemetry-exporter-otlp-proto/test/certs/client.csr similarity index 100% rename from packages/opentelemetry-exporter-collector-proto/test/certs/client.csr rename to packages/opentelemetry-exporter-otlp-proto/test/certs/client.csr diff --git a/packages/opentelemetry-exporter-collector-proto/test/certs/client.key b/packages/opentelemetry-exporter-otlp-proto/test/certs/client.key similarity index 100% rename from packages/opentelemetry-exporter-collector-proto/test/certs/client.key rename to packages/opentelemetry-exporter-otlp-proto/test/certs/client.key diff --git a/packages/opentelemetry-exporter-collector-proto/test/certs/regenerate.sh b/packages/opentelemetry-exporter-otlp-proto/test/certs/regenerate.sh similarity index 100% rename from packages/opentelemetry-exporter-collector-proto/test/certs/regenerate.sh rename to packages/opentelemetry-exporter-otlp-proto/test/certs/regenerate.sh diff --git a/packages/opentelemetry-exporter-collector-proto/test/certs/server.crt b/packages/opentelemetry-exporter-otlp-proto/test/certs/server.crt similarity index 100% rename from packages/opentelemetry-exporter-collector-proto/test/certs/server.crt rename to packages/opentelemetry-exporter-otlp-proto/test/certs/server.crt diff --git a/packages/opentelemetry-exporter-collector-proto/test/certs/server.csr b/packages/opentelemetry-exporter-otlp-proto/test/certs/server.csr similarity index 100% rename from packages/opentelemetry-exporter-collector-proto/test/certs/server.csr rename to packages/opentelemetry-exporter-otlp-proto/test/certs/server.csr diff --git a/packages/opentelemetry-exporter-collector-proto/test/certs/server.key b/packages/opentelemetry-exporter-otlp-proto/test/certs/server.key similarity index 100% rename from packages/opentelemetry-exporter-collector-proto/test/certs/server.key rename to packages/opentelemetry-exporter-otlp-proto/test/certs/server.key diff --git a/packages/opentelemetry-exporter-collector-proto/test/helper.ts b/packages/opentelemetry-exporter-otlp-proto/test/helper.ts similarity index 93% rename from packages/opentelemetry-exporter-collector-proto/test/helper.ts rename to packages/opentelemetry-exporter-otlp-proto/test/helper.ts index 85cf2b47ce..f8b90b9fef 100644 --- a/packages/opentelemetry-exporter-collector-proto/test/helper.ts +++ b/packages/opentelemetry-exporter-otlp-proto/test/helper.ts @@ -23,7 +23,7 @@ import { ValueType, } from '@opentelemetry/api-metrics'; import { hexToBase64 } from '@opentelemetry/core'; -import { collectorTypes } from '@opentelemetry/exporter-collector'; +import { otlpTypes } from '@opentelemetry/exporter-otlp-http'; import * as metrics from '@opentelemetry/sdk-metrics-base'; import { Resource } from '@opentelemetry/resources'; import { ReadableSpan } from '@opentelemetry/sdk-trace-base'; @@ -150,7 +150,7 @@ export const mockedReadableSpan: ReadableSpan = { }; export function ensureProtoEventsAreCorrect( - events: collectorTypes.opentelemetryProto.trace.v1.Span.Event[] + events: otlpTypes.opentelemetryProto.trace.v1.Span.Event[] ) { assert.deepStrictEqual( events, @@ -201,7 +201,7 @@ export function ensureProtoEventsAreCorrect( } export function ensureProtoAttributesAreCorrect( - attributes: collectorTypes.opentelemetryProto.common.v1.KeyValue[] + attributes: otlpTypes.opentelemetryProto.common.v1.KeyValue[] ) { assert.deepStrictEqual( attributes, @@ -218,7 +218,7 @@ export function ensureProtoAttributesAreCorrect( } export function ensureProtoLinksAreCorrect( - attributes: collectorTypes.opentelemetryProto.trace.v1.Span.Link[] + attributes: otlpTypes.opentelemetryProto.trace.v1.Span.Link[] ) { assert.deepStrictEqual( attributes, @@ -242,7 +242,7 @@ export function ensureProtoLinksAreCorrect( } export function ensureProtoSpanIsCorrect( - span: collectorTypes.opentelemetryProto.trace.v1.Span + span: otlpTypes.opentelemetryProto.trace.v1.Span ) { if (span.attributes) { ensureProtoAttributesAreCorrect(span.attributes); @@ -295,7 +295,7 @@ export function ensureProtoSpanIsCorrect( } export function ensureExportedCounterIsCorrect( - metric: collectorTypes.opentelemetryProto.metrics.v1.Metric, + metric: otlpTypes.opentelemetryProto.metrics.v1.Metric, time?: number ) { assert.deepStrictEqual(metric, { @@ -317,7 +317,7 @@ export function ensureExportedCounterIsCorrect( } export function ensureExportedObserverIsCorrect( - metric: collectorTypes.opentelemetryProto.metrics.v1.Metric, + metric: otlpTypes.opentelemetryProto.metrics.v1.Metric, time?: number ) { assert.deepStrictEqual(metric, { @@ -337,7 +337,7 @@ export function ensureExportedObserverIsCorrect( } export function ensureExportedValueRecorderIsCorrect( - metric: collectorTypes.opentelemetryProto.metrics.v1.Metric, + metric: otlpTypes.opentelemetryProto.metrics.v1.Metric, time?: number, explicitBounds: number[] = [Infinity], bucketCounts: string[] = ['2', '0'] @@ -363,7 +363,7 @@ export function ensureExportedValueRecorderIsCorrect( } export function ensureExportTraceServiceRequestIsSet( - json: collectorTypes.opentelemetryProto.collector.trace.v1.ExportTraceServiceRequest + json: otlpTypes.opentelemetryProto.collector.trace.v1.ExportTraceServiceRequest ) { const resourceSpans = json.resourceSpans; assert.strictEqual( @@ -396,7 +396,7 @@ export function ensureExportTraceServiceRequestIsSet( } export function ensureExportMetricsServiceRequestIsSet( - json: collectorTypes.opentelemetryProto.collector.metrics.v1.ExportMetricsServiceRequest + json: otlpTypes.opentelemetryProto.collector.metrics.v1.ExportMetricsServiceRequest ) { const resourceMetrics = json.resourceMetrics; assert.strictEqual( diff --git a/packages/opentelemetry-exporter-collector-proto/tsconfig.json b/packages/opentelemetry-exporter-otlp-proto/tsconfig.json similarity index 87% rename from packages/opentelemetry-exporter-collector-proto/tsconfig.json rename to packages/opentelemetry-exporter-otlp-proto/tsconfig.json index 14cedee9b7..cfc7b73a48 100644 --- a/packages/opentelemetry-exporter-collector-proto/tsconfig.json +++ b/packages/opentelemetry-exporter-otlp-proto/tsconfig.json @@ -13,7 +13,7 @@ "path": "../opentelemetry-core" }, { - "path": "../opentelemetry-exporter-collector" + "path": "../opentelemetry-exporter-otlp-http" }, { "path": "../opentelemetry-resources" diff --git a/tsconfig.esm.json b/tsconfig.esm.json index fbac179b7c..55c72fc2a7 100644 --- a/tsconfig.esm.json +++ b/tsconfig.esm.json @@ -24,16 +24,16 @@ "path": "packages/opentelemetry-core/tsconfig.esm.json" }, { - "path": "packages/opentelemetry-exporter-collector-grpc" + "path": "packages/opentelemetry-exporter-jaeger" }, { - "path": "packages/opentelemetry-exporter-collector-proto" + "path": "packages/opentelemetry-exporter-otlp-grpc" }, { - "path": "packages/opentelemetry-exporter-collector/tsconfig.esm.json" + "path": "packages/opentelemetry-exporter-otlp-http/tsconfig.esm.json" }, { - "path": "packages/opentelemetry-exporter-jaeger" + "path": "packages/opentelemetry-exporter-otlp-proto" }, { "path": "packages/opentelemetry-exporter-prometheus" diff --git a/tsconfig.json b/tsconfig.json index 0c64abed8c..11b773288c 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -3,32 +3,32 @@ "files": [], "typedocOptions": { "packages": [ - "packages/opentelemetry-api-metrics", + "experimental/packages/opentelemetry-api-metrics", + "experimental/packages/opentelemetry-instrumentation-fetch", + "experimental/packages/opentelemetry-instrumentation-grpc", + "experimental/packages/opentelemetry-instrumentation-http", + "experimental/packages/opentelemetry-instrumentation-xml-http-request", + "experimental/packages/opentelemetry-instrumentation", + "experimental/packages/opentelemetry-sdk-node", "packages/opentelemetry-context-async-hooks", - "packages/opentelemetry-context-zone", "packages/opentelemetry-context-zone-peer-dep", + "packages/opentelemetry-context-zone", "packages/opentelemetry-core", - "packages/opentelemetry-exporter-collector", - "packages/opentelemetry-exporter-collector-grpc", - "packages/opentelemetry-exporter-collector-proto", "packages/opentelemetry-exporter-jaeger", + "packages/opentelemetry-exporter-otlp-grpc", + "packages/opentelemetry-exporter-otlp-http", + "packages/opentelemetry-exporter-otlp-proto", "packages/opentelemetry-exporter-prometheus", "packages/opentelemetry-exporter-zipkin", - "packages/opentelemetry-instrumentation", - "packages/opentelemetry-instrumentation-fetch", - "packages/opentelemetry-instrumentation-grpc", - "packages/opentelemetry-instrumentation-http", - "packages/opentelemetry-instrumentation-xml-http-request", - "packages/opentelemetry-metrics", - "packages/opentelemetry-node", "packages/opentelemetry-propagator-b3", "packages/opentelemetry-propagator-jaeger", "packages/opentelemetry-resources", - "packages/opentelemetry-sdk-node", + "packages/opentelemetry-sdk-metrics-base", + "packages/opentelemetry-sdk-trace-base", + "packages/opentelemetry-sdk-trace-node", + "packages/opentelemetry-sdk-trace-web", "packages/opentelemetry-semantic-conventions", - "packages/opentelemetry-shim-opentracing", - "packages/opentelemetry-tracing", - "packages/opentelemetry-web" + "packages/opentelemetry-shim-opentracing" ], "out": "docs", "exclude": [ @@ -63,16 +63,16 @@ "path": "packages/opentelemetry-core" }, { - "path": "packages/opentelemetry-exporter-collector-grpc" + "path": "packages/opentelemetry-exporter-jaeger" }, { - "path": "packages/opentelemetry-exporter-collector-proto" + "path": "packages/opentelemetry-exporter-otlp-grpc" }, { - "path": "packages/opentelemetry-exporter-collector" + "path": "packages/opentelemetry-exporter-otlp-http" }, { - "path": "packages/opentelemetry-exporter-jaeger" + "path": "packages/opentelemetry-exporter-otlp-proto" }, { "path": "packages/opentelemetry-exporter-prometheus"