From be3df87a4f19568c6092d9b79bafc08fac426424 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gerhard=20St=C3=B6bich?= <18708370+Flarna@users.noreply.github.com> Date: Tue, 24 May 2022 09:05:36 +0200 Subject: [PATCH 1/2] fix: remove attributes from OTLPExporterConfigBase Remove the optional attributes property from OTLPExporterConfigBase because it's not part of the spec and it's actually not exported at all. --- .../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 -- 9 files changed, 1 insertion(+), 20 deletions(-) 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); From 3515107d609c93d7602988aec1e99eea94b807f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gerhard=20St=C3=B6bich?= <18708370+Flarna@users.noreply.github.com> Date: Tue, 24 May 2022 09:11:39 +0200 Subject: [PATCH 2/2] add changelog --- experimental/CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/experimental/CHANGELOG.md b/experimental/CHANGELOG.md index 1aaa61599c..ed6a6974cf 100644 --- a/experimental/CHANGELOG.md +++ b/experimental/CHANGELOG.md @@ -8,6 +8,7 @@ All notable changes to experimental packages in this project will be documented * feat(metrics): metric readers and exporters now select aggregation temporality based on instrument type #2902 @seemk * refactor(metrics-sdk): rename InstrumentationLibrary -> InstrumentationScope #2959 @pichlermarc +* fix: remove attributes from OTLPExporterConfigBase #2991 @flarna ### :rocket: (Enhancement)