From 5afa1e2395f8d7815812f1c904aa176a50bf27cb Mon Sep 17 00:00:00 2001 From: "marc.pichler" Date: Wed, 24 Aug 2022 13:41:57 +0200 Subject: [PATCH 1/5] chore(sdk-metrics): clean up exports --- .../src/export/MetricData.ts | 2 +- .../opentelemetry-sdk-metrics/src/index.ts | 87 +++++++++++++++---- .../test/ObservableResult.test.ts | 7 +- .../test/state/MeterSharedState.test.ts | 2 +- .../test/state/MetricCollector.test.ts | 3 +- 5 files changed, 80 insertions(+), 21 deletions(-) diff --git a/experimental/packages/opentelemetry-sdk-metrics/src/export/MetricData.ts b/experimental/packages/opentelemetry-sdk-metrics/src/export/MetricData.ts index 36e031e2d31..f31c748e0ba 100644 --- a/experimental/packages/opentelemetry-sdk-metrics/src/export/MetricData.ts +++ b/experimental/packages/opentelemetry-sdk-metrics/src/export/MetricData.ts @@ -25,7 +25,7 @@ import { Histogram } from '../aggregator/types'; /** * Basic metric data fields. */ -export interface BaseMetricData { +interface BaseMetricData { readonly descriptor: InstrumentDescriptor; readonly aggregationTemporality: AggregationTemporality; /** diff --git a/experimental/packages/opentelemetry-sdk-metrics/src/index.ts b/experimental/packages/opentelemetry-sdk-metrics/src/index.ts index e9ad1ef4b94..75364b1c62b 100644 --- a/experimental/packages/opentelemetry-sdk-metrics/src/index.ts +++ b/experimental/packages/opentelemetry-sdk-metrics/src/index.ts @@ -14,19 +14,74 @@ * limitations under the License. */ -export { Sum, LastValue, Histogram } from './aggregator/types'; -export * from './export/AggregationTemporality'; -export * from './export/MetricData'; -export * from './export/MetricExporter'; -export * from './export/MetricProducer'; -export * from './export/MetricReader'; -export * from './export/PeriodicExportingMetricReader'; -export * from './export/InMemoryMetricExporter'; -export * from './export/ConsoleMetricExporter'; -export { InstrumentDescriptor, InstrumentType } from './InstrumentDescriptor'; -export * from './Meter'; -export * from './MeterProvider'; -export * from './ObservableResult'; -export { TimeoutError } from './utils'; -export * from './view/Aggregation'; -export * from './view/View'; +export { + Sum, + LastValue, + Histogram, +} from './aggregator/types'; + +export { + AggregationTemporality, + AggregationTemporalitySelector, +} from './export/AggregationTemporality'; + +export { + DataPoint, + DataPointType, + SumMetricData, + GaugeMetricData, + HistogramMetricData, + ResourceMetrics, + ScopeMetrics, + MetricData, +} from './export/MetricData'; + +export { + PushMetricExporter, +} from './export/MetricExporter'; + +export { + MetricReader, +} from './export/MetricReader'; + +export { + PeriodicExportingMetricReader, + PeriodicExportingMetricReaderOptions, +} from './export/PeriodicExportingMetricReader'; + +export { + InMemoryMetricExporter, +} from './export/InMemoryMetricExporter'; + +export { + ConsoleMetricExporter, +} from './export/ConsoleMetricExporter'; + +export { + InstrumentDescriptor, + InstrumentType, +} from './InstrumentDescriptor'; + +export { + Meter, +} from './Meter'; + +export { + MeterProvider, + MeterProviderOptions, +} from './MeterProvider'; + +export { + DefaultAggregation, + ExplicitBucketHistogramAggregation, + DropAggregation, + HistogramAggregation, + LastValueAggregation, + SumAggregation, + Aggregation +} from './view/Aggregation'; + +export { + View, + ViewOptions, +} from './view/View'; diff --git a/experimental/packages/opentelemetry-sdk-metrics/test/ObservableResult.test.ts b/experimental/packages/opentelemetry-sdk-metrics/test/ObservableResult.test.ts index f6a38ce4431..aaa97768b89 100644 --- a/experimental/packages/opentelemetry-sdk-metrics/test/ObservableResult.test.ts +++ b/experimental/packages/opentelemetry-sdk-metrics/test/ObservableResult.test.ts @@ -16,9 +16,12 @@ import { ValueType } from '@opentelemetry/api-metrics'; import * as assert from 'assert'; -import { BatchObservableResultImpl, InstrumentType } from '../src'; +import { InstrumentType } from '../src'; import { ObservableInstrument } from '../src/Instruments'; -import { ObservableResultImpl } from '../src/ObservableResult'; +import { + BatchObservableResultImpl, + ObservableResultImpl +} from '../src/ObservableResult'; import { ObservableRegistry } from '../src/state/ObservableRegistry'; import { commonAttributes, commonValues, defaultInstrumentDescriptor } from './util'; diff --git a/experimental/packages/opentelemetry-sdk-metrics/test/state/MeterSharedState.test.ts b/experimental/packages/opentelemetry-sdk-metrics/test/state/MeterSharedState.test.ts index bacbe87e3f5..0a4b504b9ff 100644 --- a/experimental/packages/opentelemetry-sdk-metrics/test/state/MeterSharedState.test.ts +++ b/experimental/packages/opentelemetry-sdk-metrics/test/state/MeterSharedState.test.ts @@ -21,12 +21,12 @@ import { Meter, MeterProvider, DataPointType, - CollectionResult, View } from '../../src'; import { assertMetricData, defaultInstrumentationScope, defaultResource, sleep } from '../util'; import { TestMetricReader } from '../export/TestMetricReader'; import { MeterSharedState } from '../../src/state/MeterSharedState'; +import { CollectionResult } from '../../src/export/MetricData'; describe('MeterSharedState', () => { afterEach(() => { diff --git a/experimental/packages/opentelemetry-sdk-metrics/test/state/MetricCollector.test.ts b/experimental/packages/opentelemetry-sdk-metrics/test/state/MetricCollector.test.ts index 77047d9f52b..ad65f1c027e 100644 --- a/experimental/packages/opentelemetry-sdk-metrics/test/state/MetricCollector.test.ts +++ b/experimental/packages/opentelemetry-sdk-metrics/test/state/MetricCollector.test.ts @@ -16,7 +16,8 @@ import * as assert from 'assert'; import * as sinon from 'sinon'; -import { MeterProvider, TimeoutError } from '../../src'; +import { MeterProvider } from '../../src'; +import { TimeoutError } from '../../src/utils'; import { DataPointType } from '../../src/export/MetricData'; import { PushMetricExporter } from '../../src/export/MetricExporter'; import { MeterProviderSharedState } from '../../src/state/MeterProviderSharedState'; From d76049bce4fb27b00e625a8b8675d87c3efcb2de Mon Sep 17 00:00:00 2001 From: "marc.pichler" Date: Wed, 24 Aug 2022 16:12:32 +0200 Subject: [PATCH 2/5] fix(changelog): add entry. --- experimental/CHANGELOG.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/experimental/CHANGELOG.md b/experimental/CHANGELOG.md index 56c18df4ccb..767fff785d6 100644 --- a/experimental/CHANGELOG.md +++ b/experimental/CHANGELOG.md @@ -7,6 +7,17 @@ All notable changes to experimental packages in this project will be documented ### :boom: Breaking Change * Rename @opentelemetry/sdk-metrics-base package to @opentelemetry/sdk-metrics [#3162](/~https://github.com/open-telemetry/opentelemetry-js/pull/3162) @hectorhdzg +* chore(metrics-sdk): clean up exports [#3197](/~https://github.com/open-telemetry/opentelemetry-js/pull/3197) @pichlermarc + * removes export for: + * `AccumulationRecord` + * `Aggregator` + * `AggregatorKind` + * `Accumulation` + * `CollectionResult` + * `createInstrumentDescriptor` + * `createInstrumentDescriptorWithView` + * `isDescriptorCompatibleWith` + * `TimeoutError` ### :rocket: (Enhancement) From ec1ba399870a97ee4c6b6014ecdb51b630788fac Mon Sep 17 00:00:00 2001 From: "marc.pichler" Date: Thu, 25 Aug 2022 12:00:49 +0200 Subject: [PATCH 3/5] fix(changelog): move entry to unreleased. --- experimental/CHANGELOG.md | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/experimental/CHANGELOG.md b/experimental/CHANGELOG.md index 9c9216fb2b6..7ac0e3cf418 100644 --- a/experimental/CHANGELOG.md +++ b/experimental/CHANGELOG.md @@ -6,6 +6,18 @@ All notable changes to experimental packages in this project will be documented ### :boom: Breaking Change +* chore(metrics-sdk): clean up exports [#3197](/~https://github.com/open-telemetry/opentelemetry-js/pull/3197) @pichlermarc + * removes export for: + * `AccumulationRecord` + * `Aggregator` + * `AggregatorKind` + * `Accumulation` + * `CollectionResult` + * `createInstrumentDescriptor` + * `createInstrumentDescriptorWithView` + * `isDescriptorCompatibleWith` + * `TimeoutError` + ### :rocket: (Enhancement) ### :bug: (Bug Fix) @@ -19,17 +31,6 @@ All notable changes to experimental packages in this project will be documented ### :boom: Breaking Change * Rename @opentelemetry/sdk-metrics-base package to @opentelemetry/sdk-metrics [#3162](/~https://github.com/open-telemetry/opentelemetry-js/pull/3162) @hectorhdzg -* chore(metrics-sdk): clean up exports [#3197](/~https://github.com/open-telemetry/opentelemetry-js/pull/3197) @pichlermarc - * removes export for: - * `AccumulationRecord` - * `Aggregator` - * `AggregatorKind` - * `Accumulation` - * `CollectionResult` - * `createInstrumentDescriptor` - * `createInstrumentDescriptorWithView` - * `isDescriptorCompatibleWith` - * `TimeoutError` ### :rocket: (Enhancement) From e2400cea78ae1502c17d1de1565bf50ad364f1c6 Mon Sep 17 00:00:00 2001 From: "marc.pichler" Date: Thu, 25 Aug 2022 13:04:59 +0200 Subject: [PATCH 4/5] fix: add TimeoutError back. --- experimental/packages/opentelemetry-sdk-metrics/src/index.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/experimental/packages/opentelemetry-sdk-metrics/src/index.ts b/experimental/packages/opentelemetry-sdk-metrics/src/index.ts index 75364b1c62b..3a7123e8cbb 100644 --- a/experimental/packages/opentelemetry-sdk-metrics/src/index.ts +++ b/experimental/packages/opentelemetry-sdk-metrics/src/index.ts @@ -85,3 +85,7 @@ export { View, ViewOptions, } from './view/View'; + +export { + TimeoutError +} from './utils'; From 291470cbccbd7a3efe0566723e23204fc23ffe72 Mon Sep 17 00:00:00 2001 From: "marc.pichler" Date: Fri, 26 Aug 2022 10:34:22 +0200 Subject: [PATCH 5/5] fix: add CollectionResult back in and update changelog. --- experimental/CHANGELOG.md | 2 -- experimental/packages/opentelemetry-sdk-metrics/src/index.ts | 1 + 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/experimental/CHANGELOG.md b/experimental/CHANGELOG.md index 7ac0e3cf418..f420b3f4686 100644 --- a/experimental/CHANGELOG.md +++ b/experimental/CHANGELOG.md @@ -12,11 +12,9 @@ All notable changes to experimental packages in this project will be documented * `Aggregator` * `AggregatorKind` * `Accumulation` - * `CollectionResult` * `createInstrumentDescriptor` * `createInstrumentDescriptorWithView` * `isDescriptorCompatibleWith` - * `TimeoutError` ### :rocket: (Enhancement) diff --git a/experimental/packages/opentelemetry-sdk-metrics/src/index.ts b/experimental/packages/opentelemetry-sdk-metrics/src/index.ts index 3a7123e8cbb..3ce97504de1 100644 --- a/experimental/packages/opentelemetry-sdk-metrics/src/index.ts +++ b/experimental/packages/opentelemetry-sdk-metrics/src/index.ts @@ -34,6 +34,7 @@ export { ResourceMetrics, ScopeMetrics, MetricData, + CollectionResult, } from './export/MetricData'; export {