From 4819ba2ec4dfc981e29692981cab48776fb49cb4 Mon Sep 17 00:00:00 2001 From: Aksel Allas Date: Wed, 10 Jan 2024 17:15:37 +0200 Subject: [PATCH] feat(add-aggregation-selector-option-to-otlp-metric-exporter) --- .../src/OTLPMetricExporterBase.ts | 3 +++ .../src/OTLPMetricExporterOptions.ts | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/experimental/packages/opentelemetry-exporter-metrics-otlp-http/src/OTLPMetricExporterBase.ts b/experimental/packages/opentelemetry-exporter-metrics-otlp-http/src/OTLPMetricExporterBase.ts index db8a4a32ed1..6196827fffa 100644 --- a/experimental/packages/opentelemetry-exporter-metrics-otlp-http/src/OTLPMetricExporterBase.ts +++ b/experimental/packages/opentelemetry-exporter-metrics-otlp-http/src/OTLPMetricExporterBase.ts @@ -117,6 +117,9 @@ export class OTLPMetricExporterBase< constructor(exporter: T, config?: OTLPMetricExporterOptions) { this._otlpExporter = exporter; + if (config?.aggregationSelector) { + this._otlpExporter.aggregationSelector = config.aggregationSelector + } this._aggregationTemporalitySelector = chooseTemporalitySelector( config?.temporalityPreference ); diff --git a/experimental/packages/opentelemetry-exporter-metrics-otlp-http/src/OTLPMetricExporterOptions.ts b/experimental/packages/opentelemetry-exporter-metrics-otlp-http/src/OTLPMetricExporterOptions.ts index e03bde4e75e..b6823985bfa 100644 --- a/experimental/packages/opentelemetry-exporter-metrics-otlp-http/src/OTLPMetricExporterOptions.ts +++ b/experimental/packages/opentelemetry-exporter-metrics-otlp-http/src/OTLPMetricExporterOptions.ts @@ -15,12 +15,13 @@ */ import { OTLPExporterConfigBase } from '@opentelemetry/otlp-exporter-base'; -import { AggregationTemporality } from '@opentelemetry/sdk-metrics'; +import { AggregationTemporality, AggregationSelector } from '@opentelemetry/sdk-metrics'; export interface OTLPMetricExporterOptions extends OTLPExporterConfigBase { temporalityPreference?: | AggregationTemporalityPreference | AggregationTemporality; + aggregationSelector? : AggregationSelector } export enum AggregationTemporalityPreference {