@@ -4,12 +4,6 @@ import * as github from '@actions/github'
44import { ingestDir } from './junit-parser.js'
55import { generateMetrics , type TMetricsConfig } from './metrics-generator.js'
66import { MetricsSubmitter } from './metrics-submitter.js'
7- import {
8- InstrumentType ,
9- MeterProvider ,
10- PeriodicExportingMetricReader
11- } from '@opentelemetry/sdk-metrics'
12- import { AggregationType } from '@opentelemetry/sdk-metrics'
137import { OTLPMetricExporter } from '@opentelemetry/exporter-metrics-otlp-proto'
148import { resourceFromAttributes } from '@opentelemetry/resources'
159import {
@@ -30,9 +24,16 @@ import {
3024 DiagLogger ,
3125 diag
3226} from '@opentelemetry/api'
27+
28+ import {
29+ AggregationSelector ,
30+ MeterProvider ,
31+ PeriodicExportingMetricReader
32+ } from '@opentelemetry/sdk-metrics'
3333import { DEFAULT_AGGREGATION_SELECTOR } from '@opentelemetry/sdk-metrics/build/src/export/AggregationSelector.js'
34- import { ExponentialHistogramAggregationOption } from '@opentelemetry/sdk-metrics/build/src/view/AggregationOption .js'
34+ import { InstrumentType } from '@opentelemetry/sdk-metrics/build/src/export/MetricData .js'
3535
36+ import { AggregationType } from '@opentelemetry/sdk-metrics'
3637class CapturingDiagLogger implements DiagLogger {
3738 private baseLogger : DiagConsoleLogger
3839 private capturedOutput : string = ''
@@ -98,7 +99,7 @@ export async function run(): Promise<void> {
9899
99100 const metricsNamespace = core . getInput ( 'metrics-namespace' ) || 'cae'
100101
101- const metricsVersion = core . getInput ( 'metrics-version' ) || 'v3 '
102+ const metricsVersion = core . getInput ( 'metrics-version' ) || 'v4 '
102103
103104 const config : TMetricsConfig = {
104105 serviceName,
@@ -126,17 +127,21 @@ export async function run(): Promise<void> {
126127 [ ATTR_DEPLOYMENT_ENVIRONMENT_NAME ] : deploymentEnvironment
127128 } )
128129
129- const aggregationPreference = ( t : InstrumentType ) => {
130- if ( t === 'HISTOGRAM' ) {
130+ const aggregationPreference : AggregationSelector = ( t : InstrumentType ) => {
131+ if ( t === InstrumentType . HISTOGRAM ) {
132+ core . info (
133+ `The current aggregationPreference for histograms is: EXPONENTIAL_HISTOGRAM `
134+ )
131135 return {
132136 type : AggregationType . EXPONENTIAL_HISTOGRAM ,
133137 options : {
134138 recordMinMax : true
135139 }
136- } as ExponentialHistogramAggregationOption
140+ }
137141 }
138142 return DEFAULT_AGGREGATION_SELECTOR ( t )
139143 }
144+
140145 const exporter = new OTLPMetricExporter ( {
141146 aggregationPreference,
142147 url : otlpEndpoint ,
0 commit comments