Skip to content

Commit

Permalink
fix: missing forceFlush on noop meter provider (#788)
Browse files Browse the repository at this point in the history
  • Loading branch information
seemk authored Aug 28, 2023
1 parent f0d11d7 commit 25f014d
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/start.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ import {
DiagLogLevel,
metrics as metricsApi,
MeterOptions,
MeterProvider,
createNoopMeter,
} from '@opentelemetry/api';

Expand Down Expand Up @@ -146,12 +145,15 @@ export const start = (options: Partial<Options> = {}) => {
}
};

function createNoopMeterProvider(): MeterProvider {
function createNoopMeterProvider() {
const meter = createNoopMeter();
return {
getMeter(_name: string, _version?: string, _options?: MeterOptions) {
return meter;
},
// AWS Lambda instrumentation check for the existence of forceFlush,
// if it does not exist, an error is logged for each span.
forceFlush() {},
};
}

Expand Down

0 comments on commit 25f014d

Please sign in to comment.