in runtimes/runtimes/operational-telemetry/operational-telemetry-service.ts [105:138]
private startupSdk() {
const metricExporter = new OTLPMetricExporter({
url: this.awsConfig.endpoint,
})
const logsExporter = new OTLPLogExporter({
url: this.awsConfig.endpoint,
})
const fiveMinutes = 300000
const fiveSeconds = 5000
// Collects metrics every `exportIntervalMillis` and sends it to exporter.
// Registered callbacks are evaluated once during the collection process.
const metricReader = new PeriodicExportingMetricReader({
exporter: metricExporter,
exportIntervalMillis: fiveMinutes,
})
// Sends collected logs every `scheduledDelayMillis` if batch is non-empty.
// Triggers export immediately when collected logs reach `maxExportBatchSize` limit.
const logProcessor = new BatchLogRecordProcessor(logsExporter, {
maxExportBatchSize: 20,
scheduledDelayMillis: fiveSeconds,
})
this.sdk = new NodeSDK({
resource: this.baseResource,
autoDetectResources: false,
metricReader: metricReader,
logRecordProcessors: [logProcessor],
})
this.sdk.start()
}