@@ -32,6 +32,7 @@ import {
3232 MeterProvider ,
3333 PeriodicExportingMetricReader ,
3434 type MetricReader ,
35+ type PushMetricExporter ,
3536} from "@opentelemetry/sdk-metrics" ;
3637import { RandomIdGenerator , SpanProcessor } from "@opentelemetry/sdk-trace-base" ;
3738import {
@@ -83,6 +84,7 @@ export type TracingSDKConfig = {
8384 instrumentations ?: Instrumentation [ ] ;
8485 exporters ?: SpanExporter [ ] ;
8586 logExporters ?: LogRecordExporter [ ] ;
87+ metricExporters ?: PushMetricExporter [ ] ;
8688 metricReaders ?: MetricReader [ ] ;
8789 diagLogLevel ?: TracingDiagnosticLogLevel ;
8890 resource ?: Resource ;
@@ -319,6 +321,14 @@ export class TracingSDK {
319321 exportIntervalMillis : collectionIntervalMs ,
320322 exportTimeoutMillis : Math . min ( exportTimeoutMillis , collectionIntervalMs ) ,
321323 } ) ,
324+ ...( config . metricExporters ?? [ ] ) . map (
325+ ( exporter ) =>
326+ new PeriodicExportingMetricReader ( {
327+ exporter,
328+ exportIntervalMillis : collectionIntervalMs ,
329+ exportTimeoutMillis : Math . min ( exportTimeoutMillis , collectionIntervalMs ) ,
330+ } )
331+ ) ,
322332 ...( config . metricReaders ?? [ ] ) ,
323333 ] ;
324334
0 commit comments