From e44f6d1a109123739017330d710e0eb91995a004 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gerhard=20St=C3=B6bich?= Date: Sat, 28 May 2022 11:17:34 +0200 Subject: [PATCH] fix: remove attributes from OTLPExporterConfigBase (#2991) Co-authored-by: Valentin Marchaud --- experimental/CHANGELOG.md | 1 + .../test/browser/CollectorTraceExporter.test.ts | 2 -- .../test/node/CollectorTraceExporter.test.ts | 3 --- .../exporter-trace-otlp-proto/test/OTLPTraceExporter.test.ts | 2 -- .../test/common/CollectorMetricExporter.test.ts | 2 -- .../test/node/CollectorMetricExporter.test.ts | 1 - .../test/OTLPMetricExporter.test.ts | 1 - .../packages/otlp-exporter-base/src/OTLPExporterBase.ts | 5 +---- experimental/packages/otlp-exporter-base/src/types.ts | 3 --- .../otlp-exporter-base/test/common/CollectorExporter.test.ts | 2 -- 10 files changed, 2 insertions(+), 20 deletions(-) diff --git a/experimental/CHANGELOG.md b/experimental/CHANGELOG.md index 5c2a8fbe12..f24fbe0ea0 100644 --- a/experimental/CHANGELOG.md +++ b/experimental/CHANGELOG.md @@ -25,6 +25,7 @@ All notable changes to experimental packages in this project will be documented * removed the second parameter `callback` * returns an `Observable` object on which callbacks can be registered or unregistered. * added `meter.addBatchObservableCallback` and `meter.removeBatchObservableCallback`. +* fix: remove attributes from OTLPExporterConfigBase #2991 @flarna ### :rocket: (Enhancement) diff --git a/experimental/packages/exporter-trace-otlp-http/test/browser/CollectorTraceExporter.test.ts b/experimental/packages/exporter-trace-otlp-http/test/browser/CollectorTraceExporter.test.ts index 4e933cf6a5..8981d865eb 100644 --- a/experimental/packages/exporter-trace-otlp-http/test/browser/CollectorTraceExporter.test.ts +++ b/experimental/packages/exporter-trace-otlp-http/test/browser/CollectorTraceExporter.test.ts @@ -57,7 +57,6 @@ describe('OTLPTraceExporter - web', () => { onInitSpy = sinon.stub(OTLPTraceExporter.prototype, 'onInit'); collectorExporterConfig = { hostname: 'foo', - attributes: {}, url: 'http://foo.bar.com', }; collectorTraceExporter = new OTLPTraceExporter(collectorExporterConfig); @@ -86,7 +85,6 @@ describe('OTLPTraceExporter - web', () => { beforeEach(() => { collectorExporterConfig = { hostname: 'foo', - attributes: {}, url: 'http://foo.bar.com', }; }); diff --git a/experimental/packages/exporter-trace-otlp-http/test/node/CollectorTraceExporter.test.ts b/experimental/packages/exporter-trace-otlp-http/test/node/CollectorTraceExporter.test.ts index 7ba730da61..4e0a8e4c12 100644 --- a/experimental/packages/exporter-trace-otlp-http/test/node/CollectorTraceExporter.test.ts +++ b/experimental/packages/exporter-trace-otlp-http/test/node/CollectorTraceExporter.test.ts @@ -195,7 +195,6 @@ describe('OTLPTraceExporter - node with json over http', () => { foo: 'bar', }, hostname: 'foo', - attributes: {}, url: 'http://foo.bar.com', keepAlive: true, httpAgentOptions: { keepAliveMsecs: 2000 }, @@ -394,7 +393,6 @@ describe('OTLPTraceExporter - node with json over http', () => { foo: 'bar', }, hostname: 'foo', - attributes: {}, url: 'http://foo.bar.com', keepAlive: true, compression: CompressionAlgorithm.GZIP, @@ -469,7 +467,6 @@ describe('OTLPTraceExporter - node with json over http', () => { foo: 'bar', }, hostname: 'foo', - attributes: {}, url: 'http://foo.bar.com', keepAlive: true, httpAgentOptions: { keepAliveMsecs: 2000 }, diff --git a/experimental/packages/exporter-trace-otlp-proto/test/OTLPTraceExporter.test.ts b/experimental/packages/exporter-trace-otlp-proto/test/OTLPTraceExporter.test.ts index 983f3d55df..486a4fad6b 100644 --- a/experimental/packages/exporter-trace-otlp-proto/test/OTLPTraceExporter.test.ts +++ b/experimental/packages/exporter-trace-otlp-proto/test/OTLPTraceExporter.test.ts @@ -145,7 +145,6 @@ describe('OTLPTraceExporter - node with proto over http', () => { foo: 'bar', }, hostname: 'foo', - attributes: {}, url: 'http://foo.bar.com', keepAlive: true, httpAgentOptions: { keepAliveMsecs: 2000 }, @@ -273,7 +272,6 @@ describe('OTLPTraceExporter - node with proto over http', () => { foo: 'bar', }, hostname: 'foo', - attributes: {}, url: 'http://foo.bar.com', keepAlive: true, compression: CompressionAlgorithm.GZIP, diff --git a/experimental/packages/opentelemetry-exporter-metrics-otlp-http/test/common/CollectorMetricExporter.test.ts b/experimental/packages/opentelemetry-exporter-metrics-otlp-http/test/common/CollectorMetricExporter.test.ts index a7ff541332..51b3b04a68 100644 --- a/experimental/packages/opentelemetry-exporter-metrics-otlp-http/test/common/CollectorMetricExporter.test.ts +++ b/experimental/packages/opentelemetry-exporter-metrics-otlp-http/test/common/CollectorMetricExporter.test.ts @@ -62,7 +62,6 @@ describe('OTLPMetricExporter - common', () => { onInitSpy = sinon.stub(OTLPMetricExporter.prototype, 'onInit'); collectorExporterConfig = { hostname: 'foo', - attributes: {}, url: 'http://foo.bar.com', }; collectorExporter = new OTLPMetricExporter(collectorExporterConfig); @@ -182,7 +181,6 @@ describe('OTLPMetricExporter - common', () => { ); collectorExporterConfig = { hostname: 'foo', - attributes: {}, url: 'http://foo.bar.com', }; collectorExporter = new OTLPMetricExporter(collectorExporterConfig); diff --git a/experimental/packages/opentelemetry-exporter-metrics-otlp-http/test/node/CollectorMetricExporter.test.ts b/experimental/packages/opentelemetry-exporter-metrics-otlp-http/test/node/CollectorMetricExporter.test.ts index a34f1e4f67..c6607f5d64 100644 --- a/experimental/packages/opentelemetry-exporter-metrics-otlp-http/test/node/CollectorMetricExporter.test.ts +++ b/experimental/packages/opentelemetry-exporter-metrics-otlp-http/test/node/CollectorMetricExporter.test.ts @@ -197,7 +197,6 @@ describe('OTLPMetricExporter - node with json over http', () => { foo: 'bar', }, hostname: 'foo', - attributes: {}, url: 'http://foo.bar.com', keepAlive: true, httpAgentOptions: { keepAliveMsecs: 2000 }, diff --git a/experimental/packages/opentelemetry-exporter-metrics-otlp-proto/test/OTLPMetricExporter.test.ts b/experimental/packages/opentelemetry-exporter-metrics-otlp-proto/test/OTLPMetricExporter.test.ts index d0d41865fa..c513289d46 100644 --- a/experimental/packages/opentelemetry-exporter-metrics-otlp-proto/test/OTLPMetricExporter.test.ts +++ b/experimental/packages/opentelemetry-exporter-metrics-otlp-proto/test/OTLPMetricExporter.test.ts @@ -150,7 +150,6 @@ describe('OTLPMetricExporter - node with proto over http', () => { foo: 'bar', }, hostname: 'foo', - attributes: {}, url: 'http://foo.bar.com', keepAlive: true, httpAgentOptions: { keepAliveMsecs: 2000 }, diff --git a/experimental/packages/otlp-exporter-base/src/OTLPExporterBase.ts b/experimental/packages/otlp-exporter-base/src/OTLPExporterBase.ts index 5cc2ae5338..013879dd25 100644 --- a/experimental/packages/otlp-exporter-base/src/OTLPExporterBase.ts +++ b/experimental/packages/otlp-exporter-base/src/OTLPExporterBase.ts @@ -14,7 +14,7 @@ * limitations under the License. */ -import { SpanAttributes, diag } from '@opentelemetry/api'; +import { diag } from '@opentelemetry/api'; import { ExportResult, ExportResultCode, BindOnceFuture } from '@opentelemetry/core'; import { OTLPExporterError, @@ -33,7 +33,6 @@ export abstract class OTLPExporterBase< > { public readonly url: string; public readonly hostname: string | undefined; - public readonly attributes?: SpanAttributes; public readonly timeoutMillis: number; protected _concurrencyLimit: number; protected _sendingPromises: Promise[] = []; @@ -48,8 +47,6 @@ export abstract class OTLPExporterBase< this.hostname = config.hostname; } - this.attributes = config.attributes; - this.shutdown = this.shutdown.bind(this); this._shutdownOnce = new BindOnceFuture(this._shutdown, this); diff --git a/experimental/packages/otlp-exporter-base/src/types.ts b/experimental/packages/otlp-exporter-base/src/types.ts index 5233f940cd..a8ee1db743 100644 --- a/experimental/packages/otlp-exporter-base/src/types.ts +++ b/experimental/packages/otlp-exporter-base/src/types.ts @@ -14,8 +14,6 @@ * limitations under the License. */ -import { SpanAttributes } from '@opentelemetry/api'; - /** * Interface for handling error */ @@ -49,7 +47,6 @@ export interface ExportServiceError { export interface OTLPExporterConfigBase { headers?: Partial>; hostname?: string; - attributes?: SpanAttributes; url?: string; concurrencyLimit?: number; /** Maximum time the OTLP exporter will wait for each batch export. diff --git a/experimental/packages/otlp-exporter-base/test/common/CollectorExporter.test.ts b/experimental/packages/otlp-exporter-base/test/common/CollectorExporter.test.ts index c03fafc159..30c16d1882 100644 --- a/experimental/packages/otlp-exporter-base/test/common/CollectorExporter.test.ts +++ b/experimental/packages/otlp-exporter-base/test/common/CollectorExporter.test.ts @@ -73,7 +73,6 @@ describe('OTLPTraceExporter - common', () => { onInitSpy = sinon.stub(OTLPTraceExporter.prototype, 'onInit'); collectorExporterConfig = { hostname: 'foo', - attributes: {}, url: 'http://foo.bar.com', }; collectorExporter = new OTLPTraceExporter(collectorExporterConfig); @@ -207,7 +206,6 @@ describe('OTLPTraceExporter - common', () => { ); collectorExporterConfig = { hostname: 'foo', - attributes: {}, url: 'http://foo.bar.com', }; collectorExporter = new OTLPTraceExporter(collectorExporterConfig);